Skip to content

Commit 1a7266c

Browse files
authored
Add a feature flag for disabling erase cache (#12931)
1 parent d014966 commit 1a7266c

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

ydb/core/protos/feature_flags.proto

+1
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,5 @@ message TFeatureFlags {
183183
optional bool EnableVDiskThrottling = 158 [default = false];
184184
optional bool EnableDataShardInMemoryStateMigration = 159 [default = true];
185185
optional bool EnableDataShardInMemoryStateMigrationAcrossGenerations = 160 [default = false];
186+
optional bool DisableLocalDBEraseCache = 161 [default = false];
186187
}

ydb/core/tablet_flat/flat_table.cpp

+12-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#include "util_fmt_abort.h"
1313

1414
#include <ydb/library/yverify_stream/yverify_stream.h>
15+
#include <ydb/core/base/appdata_fwd.h>
16+
#include <ydb/core/base/feature_flags.h>
1517

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

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

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

0 commit comments

Comments
 (0)