Skip to content

Commit

Permalink
24-3 Fix tests with EnableLocalDBBtreeIndex = false (ydb-platform#6391)
Browse files Browse the repository at this point in the history
  • Loading branch information
kunga authored and azevaykin committed Feb 14, 2025
1 parent c8c24c8 commit 0478569
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions ydb/core/tablet_flat/flat_executor_ut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6230,13 +6230,15 @@ Y_UNIT_TEST_SUITE(TFlatTableExecutor_BTreeIndex) {
}
};

Y_UNIT_TEST(EnableLocalDBBtreeIndex_Default) { // uses b-tree index
Y_UNIT_TEST(EnableLocalDBBtreeIndex_Default) { // uses flat index
TMyEnvBase env;
TRowsModel rows;

auto &appData = env->GetAppData();
UNIT_ASSERT_VALUES_EQUAL(appData.FeatureFlags.HasEnableLocalDBBtreeIndex(), false);
UNIT_ASSERT_VALUES_EQUAL(appData.FeatureFlags.HasEnableLocalDBFlatIndex(), false);
UNIT_ASSERT_VALUES_EQUAL(appData.FeatureFlags.GetEnableLocalDBBtreeIndex(), false);
UNIT_ASSERT_VALUES_EQUAL(appData.FeatureFlags.GetEnableLocalDBFlatIndex(), true);
auto counters = GetSharedPageCounters(env);
int readRows = 0, failedAttempts = 0;

Expand All @@ -6252,8 +6254,8 @@ Y_UNIT_TEST_SUITE(TFlatTableExecutor_BTreeIndex) {
env.SendSync(new NFake::TEvCompact(TRowsModel::TableId));
env.WaitFor<NFake::TEvCompacted>();

// all pages are always kept in shared cache (except flat index)
UNIT_ASSERT_VALUES_EQUAL(counters->ActivePages->Val(), 334);
// all pages are always kept in shared cache
UNIT_ASSERT_VALUES_EQUAL(counters->ActivePages->Val(), 290);

env.SendSync(new NFake::TEvExecute{ new TTxFullScan(readRows, failedAttempts) });
UNIT_ASSERT_VALUES_EQUAL(readRows, 1000);
Expand All @@ -6266,7 +6268,7 @@ Y_UNIT_TEST_SUITE(TFlatTableExecutor_BTreeIndex) {
// after restart we have no pages in private cache
env.SendSync(new NFake::TEvExecute{ new TTxFullScan(readRows, failedAttempts) }, true);
UNIT_ASSERT_VALUES_EQUAL(readRows, 1000);
UNIT_ASSERT_VALUES_EQUAL(failedAttempts, 330);
UNIT_ASSERT_VALUES_EQUAL(failedAttempts, 286);
}

Y_UNIT_TEST(EnableLocalDBBtreeIndex_True) { // uses b-tree index
Expand Down
3 changes: 2 additions & 1 deletion ydb/core/tx/datashard/datashard_ut_followers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,8 @@ Y_UNIT_TEST_SUITE(DataShardFollowers) {
Cerr << "Captured pages request" << Endl;
for (auto pageId : msg->Fetch->Pages) {
auto type = NTable::NPage::EPage(msg->Fetch->PageCollection->Page(pageId).Type);
UNIT_ASSERT_C(type != NTable::EPage::BTreeIndex && type != NTable::EPage::FlatIndex, "Index pages should be preload during a part switch");
// Note: FlatIndex pages also have been preloaded, but don't stick in private cache (see TLoaderEnv)
UNIT_ASSERT_C(type != NTable::EPage::BTreeIndex, "Index pages should be preload during a part switch");
}
});

Expand Down

0 comments on commit 0478569

Please sign in to comment.