aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksei Borzenkov <snaury@ydb.tech>2024-12-25 10:16:29 +0300
committerGitHub <noreply@github.com>2024-12-25 10:16:29 +0300
commit1a7266cf43b67e174a8a4ef2fcbc476e7dff3d1d (patch)
treeb0771e69cdfc0864d177d7613b42f26726c3aac7
parentd014966628b504e87b452019ecb9a2db047e4a46 (diff)
downloadydb-1a7266cf43b67e174a8a4ef2fcbc476e7dff3d1d.tar.gz
Add a feature flag for disabling erase cache (#12931)
-rw-r--r--ydb/core/protos/feature_flags.proto1
-rw-r--r--ydb/core/tablet_flat/flat_table.cpp14
2 files changed, 13 insertions, 2 deletions
diff --git a/ydb/core/protos/feature_flags.proto b/ydb/core/protos/feature_flags.proto
index 9fa1613978..1f8a704658 100644
--- a/ydb/core/protos/feature_flags.proto
+++ b/ydb/core/protos/feature_flags.proto
@@ -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];
}
diff --git a/ydb/core/tablet_flat/flat_table.cpp b/ydb/core/tablet_flat/flat_table.cpp
index 8475ea7529..3e9adf1dff 100644
--- a/ydb/core/tablet_flat/flat_table.cpp
+++ b/ydb/core/tablet_flat/flat_table.cpp
@@ -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 {
@@ -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;
@@ -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;