@@ -155,14 +155,36 @@ TPathId ResolvePathId(TTestActorRuntime& runtime, const TString& path, TPathId*
155
155
*domainKey = resultEntry.DomainInfo ->DomainKey ;
156
156
}
157
157
158
- if (saTabletId && resultEntry.DomainInfo ->Params .HasStatisticsAggregator ()) {
159
- *saTabletId = resultEntry.DomainInfo ->Params .GetStatisticsAggregator ();
158
+ if (saTabletId) {
159
+ if (resultEntry.DomainInfo ->Params .HasStatisticsAggregator ()) {
160
+ *saTabletId = resultEntry.DomainInfo ->Params .GetStatisticsAggregator ();
161
+ } else {
162
+ auto resourcesDomainKey = resultEntry.DomainInfo ->ResourcesDomainKey ;
163
+ auto request = std::make_unique<TNavigate>();
164
+ auto & entry = request->ResultSet .emplace_back ();
165
+ entry.TableId = TTableId (resourcesDomainKey.OwnerId , resourcesDomainKey.LocalPathId );
166
+ entry.RequestType = TNavigate::TEntry::ERequestType::ByTableId;
167
+ entry.Operation = TNavigate::EOp::OpPath;
168
+ entry.RedirectRequired = false ;
169
+ runtime.Send (MakeSchemeCacheID (), sender, new TEvRequest (request.release ()));
170
+
171
+ auto ev = runtime.GrabEdgeEventRethrow <TEvResponse>(sender);
172
+ UNIT_ASSERT (ev);
173
+ UNIT_ASSERT (ev->Get ());
174
+ std::unique_ptr<TNavigate> response (ev->Get ()->Request .Release ());
175
+ UNIT_ASSERT (response->ResultSet .size () == 1 );
176
+ auto & secondResultEntry = response->ResultSet [0 ];
177
+
178
+ if (secondResultEntry.DomainInfo ->Params .HasStatisticsAggregator ()) {
179
+ *saTabletId = secondResultEntry.DomainInfo ->Params .GetStatisticsAggregator ();
180
+ }
181
+ }
160
182
}
161
183
162
184
return resultEntry.TableId .PathId ;
163
185
}
164
186
165
- NKikimrScheme::TEvDescribeSchemeResult DescribeTable (TTestActorRuntime& runtime, TActorId sender, const TString & path)
187
+ NKikimrScheme::TEvDescribeSchemeResult DescribeTable (TTestActorRuntime& runtime, TActorId sender, const TString& path)
166
188
{
167
189
TAutoPtr<IEventHandle> handle;
168
190
@@ -175,7 +197,7 @@ NKikimrScheme::TEvDescribeSchemeResult DescribeTable(TTestActorRuntime& runtime,
175
197
return *reply->MutableRecord ();
176
198
}
177
199
178
- TVector<ui64> GetTableShards (TTestActorRuntime& runtime, TActorId sender, const TString & path)
200
+ TVector<ui64> GetTableShards (TTestActorRuntime& runtime, TActorId sender, const TString& path)
179
201
{
180
202
TVector<ui64> shards;
181
203
auto lsResult = DescribeTable (runtime, sender, path);
@@ -185,7 +207,7 @@ TVector<ui64> GetTableShards(TTestActorRuntime& runtime, TActorId sender, const
185
207
return shards;
186
208
}
187
209
188
- TVector<ui64> GetColumnTableShards (TTestActorRuntime& runtime, TActorId sender,const TString & path)
210
+ TVector<ui64> GetColumnTableShards (TTestActorRuntime& runtime, TActorId sender, const TString& path)
189
211
{
190
212
TVector<ui64> shards;
191
213
auto lsResult = DescribeTable (runtime, sender, path);
@@ -275,6 +297,21 @@ void CreateColumnStoreTable(TTestEnv& env, const TString& databaseName, const TS
275
297
env.GetController ()->WaitActualization (TDuration::Seconds (1 ));
276
298
}
277
299
300
+ std::vector<TTableInfo> GatherColumnTablesInfo (TTestEnv& env, ui8 tableCount) {
301
+ auto & runtime = *env.GetServer ().GetRuntime ();
302
+ auto sender = runtime.AllocateEdgeActor ();
303
+
304
+ std::vector<TTableInfo> ret;
305
+ for (ui8 tableId = 1 ; tableId <= tableCount; tableId++) {
306
+ TTableInfo tableInfo;
307
+ const TString path = Sprintf (" /Root/Database/Table%u" , tableId);
308
+ tableInfo.ShardIds = GetColumnTableShards (runtime, sender, path);
309
+ tableInfo.PathId = ResolvePathId (runtime, path, &tableInfo.DomainKey , &tableInfo.SaTabletId );
310
+ ret.emplace_back (tableInfo);
311
+ }
312
+ return ret;
313
+ }
314
+
278
315
std::vector<TTableInfo> CreateDatabaseColumnTables (TTestEnv& env, ui8 tableCount, ui8 shardCount) {
279
316
auto init = [&] () {
280
317
CreateDatabase (env, " Database" );
@@ -285,20 +322,38 @@ std::vector<TTableInfo> CreateDatabaseColumnTables(TTestEnv& env, ui8 tableCount
285
322
std::thread initThread (init);
286
323
287
324
auto & runtime = *env.GetServer ().GetRuntime ();
288
- auto sender = runtime.AllocateEdgeActor ();
289
325
290
326
runtime.SimulateSleep (TDuration::Seconds (10 ));
291
327
initThread.join ();
292
328
293
- std::vector<TTableInfo> ret;
294
- for (ui8 tableId = 1 ; tableId <= tableCount; tableId++) {
295
- TTableInfo tableInfo;
296
- const TString path = Sprintf (" /Root/Database/Table%u" , tableId);
297
- tableInfo.ShardIds = GetColumnTableShards (runtime, sender, path);
298
- tableInfo.PathId = ResolvePathId (runtime, path, &tableInfo.DomainKey , &tableInfo.SaTabletId );
299
- ret.emplace_back (tableInfo);
300
- }
301
- return ret;
329
+ return GatherColumnTablesInfo (env, tableCount);
330
+ }
331
+
332
+ std::vector<TTableInfo> CreateServerlessDatabaseColumnTables (TTestEnv& env, ui8 tableCount, ui8 shardCount) {
333
+ auto init = [&] () {
334
+ CreateDatabase (env, " Shared" );
335
+ };
336
+ std::thread initThread (init);
337
+
338
+ auto & runtime = *env.GetServer ().GetRuntime ();
339
+ runtime.SimulateSleep (TDuration::Seconds (5 ));
340
+ initThread.join ();
341
+
342
+ TPathId domainKey;
343
+ ResolvePathId (runtime, " /Root/Shared" , &domainKey);
344
+
345
+ auto init2 = [&] () {
346
+ CreateServerlessDatabase (env, " Database" , domainKey);
347
+ for (ui8 tableId = 1 ; tableId <= tableCount; tableId++) {
348
+ CreateColumnStoreTable (env, " Database" , Sprintf (" Table%u" , tableId), shardCount);
349
+ }
350
+ };
351
+ std::thread init2Thread (init2);
352
+
353
+ runtime.SimulateSleep (TDuration::Seconds (5 ));
354
+ init2Thread.join ();
355
+
356
+ return GatherColumnTablesInfo (env, tableCount);
302
357
}
303
358
304
359
void DropTable (TTestEnv& env, const TString& databaseName, const TString& tableName) {
0 commit comments