Skip to content

Commit 0682f71

Browse files
authored
Remove using hardcoded pathId of olap table in tiering test (#20090)
1 parent 91f3e44 commit 0682f71

File tree

1 file changed

+12
-9
lines changed

1 file changed

+12
-9
lines changed

ydb/core/kqp/ut/olap/tiering_ut.cpp

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ Y_UNIT_TEST_SUITE(KqpOlapTiering) {
288288
// auto selectQuery = TString(R"(
289289
// SELECT MAX(timestamp) AS timestamp FROM `/Root/olapStore/olapTable`
290290
// )");
291-
//
291+
//
292292
// auto rows = ExecuteScanQuery(tableClient, selectQuery);
293293
// UNIT_ASSERT_VALUES_EQUAL(rows.size(), 1);
294294
// UNIT_ASSERT_GT(GetTimestamp(rows[0].at(DEFAULT_COLUMN_NAME)), TInstant::Now() - TDuration::Days(100));
@@ -329,17 +329,20 @@ Y_UNIT_TEST_SUITE(KqpOlapTiering) {
329329
auto& csController = tieringHelper.GetCsController();
330330
auto& olapHelper = tieringHelper.GetOlapHelper();
331331
auto& testHelper = tieringHelper.GetTestHelper();
332-
NYdb::NTable::TTableClient tableClient = testHelper.GetKikimr().GetTableClient();
332+
const auto& kikimr = testHelper.GetKikimr();
333+
NYdb::NTable::TTableClient tableClient = kikimr.GetTableClient();
333334

334335
olapHelper.CreateTestOlapTable();
336+
const auto describeResult = kikimr.GetTestClient().Describe(
337+
kikimr.GetTestServer().GetRuntime(), "Root/olapStore/olapTable");
338+
const auto tablePathId = NColumnShard::TSchemeShardLocalPathId::FromRawValue(describeResult.GetPathId());
339+
335340
tieringHelper.WriteSampleData();
336341
csController->WaitCompactions(TDuration::Seconds(5));
337342
THashSet<NColumnShard::TInternalPathId> pathsToLock;
338343
for (const auto& [_, pathIdTranslator]: csController->GetActiveTablets()) {
339-
for (size_t i = 0; i != 6; ++i) {
340-
if (auto internalPathId = pathIdTranslator->ResolveInternalPathId(NColumnShard::TSchemeShardLocalPathId::FromRawValue(i))) {
341-
pathsToLock.insert(*internalPathId);
342-
}
344+
if (auto internalPathId = pathIdTranslator->ResolveInternalPathId(tablePathId)) {
345+
pathsToLock.insert(*internalPathId);
343346
}
344347
};
345348

@@ -412,13 +415,13 @@ Y_UNIT_TEST_SUITE(KqpOlapTiering) {
412415
auto& putController = tieringHelper.GetCsController();
413416
auto& olapHelper = tieringHelper.GetOlapHelper();
414417
auto& testHelper = tieringHelper.GetTestHelper();
415-
416-
418+
419+
417420
olapHelper.CreateTestOlapTable();
418421
testHelper.CreateTier("tier1");
419422
tieringHelper.WriteSampleData();
420423
putController->WaitCompactions(TDuration::Seconds(5));
421-
424+
422425
putController->SetExternalStorageUnavailable(true);
423426
testHelper.SetTiering(DEFAULT_TABLE_NAME,
424427
DEFAULT_TIER_NAME,

0 commit comments

Comments
 (0)