Skip to content

Add a feature flag for disabling erase cache #12931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ydb/core/protos/feature_flags.proto
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,5 @@ message TFeatureFlags {
optional bool EnableVDiskThrottling = 158 [default = false];
optional bool EnableDataShardInMemoryStateMigration = 159 [default = true];
optional bool EnableDataShardInMemoryStateMigrationAcrossGenerations = 160 [default = false];
optional bool DisableLocalDBEraseCache = 161 [default = false];
}
14 changes: 12 additions & 2 deletions ydb/core/tablet_flat/flat_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include "util_fmt_abort.h"

#include <ydb/library/yverify_stream/yverify_stream.h>
#include <ydb/core/base/appdata_fwd.h>
#include <ydb/core/base/feature_flags.h>

namespace NKikimr {
namespace NTable {
Expand Down Expand Up @@ -1070,7 +1072,11 @@ TAutoPtr<TTableIter> TTable::Iterate(TRawVals key_, TTagsRef tags, IPages* env,
}

if (EraseCacheEnabled && (!RollbackState || !RollbackState->DisableEraseCache)) {
if (!ErasedKeysCache) {
if (HasAppData() && AppData()->FeatureFlags.GetDisableLocalDBEraseCache()) {
// Note: it's not very clean adding dependency to appdata here, but
// we want to allow disabling erase cache at runtime without alters.
ErasedKeysCache.Reset();
} else if (!ErasedKeysCache) {
ErasedKeysCache = new TKeyRangeCache(*Scheme->Keys, EraseCacheConfig, EraseCacheGCList);
}
dbIter->ErasedKeysCache = ErasedKeysCache;
Expand Down Expand Up @@ -1118,7 +1124,11 @@ TAutoPtr<TTableReverseIter> TTable::IterateReverse(TRawVals key_, TTagsRef tags,
}

if (EraseCacheEnabled && (!RollbackState || !RollbackState->DisableEraseCache)) {
if (!ErasedKeysCache) {
if (HasAppData() && AppData()->FeatureFlags.GetDisableLocalDBEraseCache()) {
// Note: it's not very clean adding dependency to appdata here, but
// we want to allow disabling erase cache at runtime without alters.
ErasedKeysCache.Reset();
} else if (!ErasedKeysCache) {
ErasedKeysCache = new TKeyRangeCache(*Scheme->Keys, EraseCacheConfig, EraseCacheGCList);
}
dbIter->ErasedKeysCache = ErasedKeysCache;
Expand Down
Loading