diff options
author | Aleksei Borzenkov <snaury@ydb.tech> | 2024-12-25 10:16:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-25 10:16:29 +0300 |
commit | 1a7266cf43b67e174a8a4ef2fcbc476e7dff3d1d (patch) | |
tree | b0771e69cdfc0864d177d7613b42f26726c3aac7 | |
parent | d014966628b504e87b452019ecb9a2db047e4a46 (diff) | |
download | ydb-1a7266cf43b67e174a8a4ef2fcbc476e7dff3d1d.tar.gz |
Add a feature flag for disabling erase cache (#12931)
-rw-r--r-- | ydb/core/protos/feature_flags.proto | 1 | ||||
-rw-r--r-- | ydb/core/tablet_flat/flat_table.cpp | 14 |
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; |