aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordcherednik <dcherednik@ydb.tech>2022-07-15 16:49:33 +0300
committerdcherednik <dcherednik@ydb.tech>2022-07-15 16:49:33 +0300
commit48398942049975801edffa7309987db284cf0a33 (patch)
tree3bcd162e342577d8223e3581c0fea53e96776bc1
parentd21540b5bd67d066badf68527d2aa7cc595a4c65 (diff)
downloadydb-48398942049975801edffa7309987db284cf0a33.tar.gz
Feature flag to online enable/disable move index.
-rw-r--r--ydb/core/kqp/ut/common/kqp_ut_common.cpp1
-rw-r--r--ydb/core/protos/config.proto1
-rw-r--r--ydb/core/testlib/basics/feature_flags.h1
-rw-r--r--ydb/core/tx/schemeshard/schemeshard__operation_move_index.cpp5
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_impl.cpp2
-rw-r--r--ydb/core/tx/schemeshard/schemeshard_impl.h1
-rw-r--r--ydb/core/tx/schemeshard/ut_compaction.cpp13
-rw-r--r--ydb/core/tx/schemeshard/ut_helpers/helpers.cpp13
-rw-r--r--ydb/core/tx/schemeshard/ut_helpers/helpers.h7
-rw-r--r--ydb/core/tx/schemeshard/ut_helpers/test_env.cpp4
-rw-r--r--ydb/core/tx/schemeshard/ut_helpers/test_env.h1
-rw-r--r--ydb/core/tx/schemeshard/ut_move.cpp23
12 files changed, 55 insertions, 17 deletions
diff --git a/ydb/core/kqp/ut/common/kqp_ut_common.cpp b/ydb/core/kqp/ut/common/kqp_ut_common.cpp
index 1453ba58d3e..4402dca0371 100644
--- a/ydb/core/kqp/ut/common/kqp_ut_common.cpp
+++ b/ydb/core/kqp/ut/common/kqp_ut_common.cpp
@@ -112,6 +112,7 @@ TKikimrRunner::TKikimrRunner(const TKikimrSettings& settings) {
ServerSettings->SetFrFactory(&UdfFrFactory);
ServerSettings->SetEnableNotNullColumns(true);
ServerSettings->SetEnableKqpScanQueryStreamLookup(false);
+ ServerSettings->SetEnableMoveIndex(true);
if (settings.LogStream)
ServerSettings->SetLogBackend(new TStreamLogBackend(settings.LogStream));
diff --git a/ydb/core/protos/config.proto b/ydb/core/protos/config.proto
index a601216ec0a..eeeab6425aa 100644
--- a/ydb/core/protos/config.proto
+++ b/ydb/core/protos/config.proto
@@ -703,6 +703,7 @@ message TFeatureFlags {
optional bool EnableKqpScanQueryMultipleOlapShardsReads = 67 [default = false];
optional bool EnablePredicateExtractForDataQueries = 68 [default = false];
optional bool EnableKqpPatternCacheLiteral = 69 [default = false];
+ optional bool EnableMoveIndex = 70 [default = false];
}
diff --git a/ydb/core/testlib/basics/feature_flags.h b/ydb/core/testlib/basics/feature_flags.h
index a7ed81b02e9..47e4b76322b 100644
--- a/ydb/core/testlib/basics/feature_flags.h
+++ b/ydb/core/testlib/basics/feature_flags.h
@@ -36,6 +36,7 @@ public:
FEATURE_FLAG_SETTER(EnableChangefeeds)
FEATURE_FLAG_SETTER(EnableKqpSessionActor)
FEATURE_FLAG_SETTER(EnableKqpScanQueryStreamLookup)
+ FEATURE_FLAG_SETTER(EnableMoveIndex)
TDerived& SetEnableMvcc(std::optional<bool> value) {
if (value) {
diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_move_index.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_move_index.cpp
index fb3b4f2a816..539c7d74c36 100644
--- a/ydb/core/tx/schemeshard/schemeshard__operation_move_index.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard__operation_move_index.cpp
@@ -498,6 +498,11 @@ TVector<ISubOperationBase::TPtr> CreateConsistentMoveIndex(TOperationId nextId,
TVector<ISubOperationBase::TPtr> result;
+ if (!context.SS->EnableMoveIndex) {
+ TString errStr = "Move index is not supported yet";
+ return {CreateReject(nextId, NKikimrScheme::EStatus::StatusPreconditionFailed, errStr)};
+ }
+
{
TString errStr;
if (!context.SS->CheckApplyIf(tx, errStr)) {
diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.cpp b/ydb/core/tx/schemeshard/schemeshard_impl.cpp
index 115ae128726..6a1c1385736 100644
--- a/ydb/core/tx/schemeshard/schemeshard_impl.cpp
+++ b/ydb/core/tx/schemeshard/schemeshard_impl.cpp
@@ -3835,6 +3835,7 @@ void TSchemeShard::OnActivateExecutor(const TActorContext &ctx) {
EnableBackgroundCompaction = appData->FeatureFlags.GetEnableBackgroundCompaction();
EnableBackgroundCompactionServerless = appData->FeatureFlags.GetEnableBackgroundCompactionServerless();
+ EnableMoveIndex = appData->FeatureFlags.GetEnableMoveIndex();
ConfigureCompactionQueues(appData->CompactionConfig, ctx);
ConfigureStatsBatching(appData->SchemeShardConfig, ctx);
@@ -6118,6 +6119,7 @@ void TSchemeShard::ApplyConsoleConfigs(const NKikimrConfig::TFeatureFlags& featu
EnableBackgroundCompaction = featureFlags.GetEnableBackgroundCompaction();
EnableBackgroundCompactionServerless = featureFlags.GetEnableBackgroundCompactionServerless();
+ EnableMoveIndex = featureFlags.GetEnableMoveIndex();
}
void TSchemeShard::ConfigureStatsBatching(const NKikimrConfig::TSchemeShardConfig& config, const TActorContext& ctx) {
diff --git a/ydb/core/tx/schemeshard/schemeshard_impl.h b/ydb/core/tx/schemeshard/schemeshard_impl.h
index 4a434e59a3b..d68e328952b 100644
--- a/ydb/core/tx/schemeshard/schemeshard_impl.h
+++ b/ydb/core/tx/schemeshard/schemeshard_impl.h
@@ -243,6 +243,7 @@ public:
THashSet<TShardIdx> ShardsWithLoaned; // shards have parts loaned to another shards
bool EnableBackgroundCompaction = false;
bool EnableBackgroundCompactionServerless = false;
+ bool EnableMoveIndex = false;
TShardDeleter ShardDeleter;
diff --git a/ydb/core/tx/schemeshard/ut_compaction.cpp b/ydb/core/tx/schemeshard/ut_compaction.cpp
index 6cec84ff8cd..f80f73621ec 100644
--- a/ydb/core/tx/schemeshard/ut_compaction.cpp
+++ b/ydb/core/tx/schemeshard/ut_compaction.cpp
@@ -128,19 +128,6 @@ void CreateTableWithData(
WriteData(runtime, name, 0, 100);
}
-void SetConfig(
- TTestActorRuntime &runtime,
- ui64 schemeShard,
- THolder<NConsole::TEvConsole::TEvConfigNotificationRequest> request)
-{
- auto sender = runtime.AllocateEdgeActor();
-
- runtime.SendToPipe(schemeShard, sender, request.Release(), 0, GetPipeConfigWithRetries());
-
- TAutoPtr<IEventHandle> handle;
- runtime.GrabEdgeEventRethrow<NConsole::TEvConsole::TEvConfigNotificationResponse>(handle);
-}
-
THolder<NConsole::TEvConsole::TEvConfigNotificationRequest> GetTestCompactionConfig() {
auto request = MakeHolder<NConsole::TEvConsole::TEvConfigNotificationRequest>();
diff --git a/ydb/core/tx/schemeshard/ut_helpers/helpers.cpp b/ydb/core/tx/schemeshard/ut_helpers/helpers.cpp
index 37d8562be7f..0eca056a6f4 100644
--- a/ydb/core/tx/schemeshard/ut_helpers/helpers.cpp
+++ b/ydb/core/tx/schemeshard/ut_helpers/helpers.cpp
@@ -21,6 +21,19 @@
namespace NSchemeShardUT_Private {
using namespace NKikimr;
+ void SetConfig(
+ TTestActorRuntime &runtime,
+ ui64 schemeShard,
+ THolder<NConsole::TEvConsole::TEvConfigNotificationRequest> request)
+ {
+ auto sender = runtime.AllocateEdgeActor();
+
+ runtime.SendToPipe(schemeShard, sender, request.Release(), 0, GetPipeConfigWithRetries());
+
+ TAutoPtr<IEventHandle> handle;
+ runtime.GrabEdgeEventRethrow<NConsole::TEvConsole::TEvConfigNotificationResponse>(handle);
+ }
+
template <typename TEvResponse, typename TEvRequest, typename TStatus>
static ui32 ReliableProposeImpl(
NActors::TTestActorRuntime& runtime, const TActorId& proposer,
diff --git a/ydb/core/tx/schemeshard/ut_helpers/helpers.h b/ydb/core/tx/schemeshard/ut_helpers/helpers.h
index e3015f9ca52..78701f59a77 100644
--- a/ydb/core/tx/schemeshard/ut_helpers/helpers.h
+++ b/ydb/core/tx/schemeshard/ut_helpers/helpers.h
@@ -14,6 +14,8 @@
#include <ydb/core/tx/schemeshard/schemeshard_export.h>
#include <ydb/core/tx/schemeshard/schemeshard_import.h>
#include <ydb/core/tx/schemeshard/schemeshard_types.h>
+#include <ydb/core/cms/console/console.h>
+
#include <ydb/library/yql/minikql/mkql_alloc.h>
#include <ydb/library/yql/minikql/mkql_node_serialization.h>
@@ -33,6 +35,11 @@ namespace NSchemeShardUT_Private {
using TEvTx = TEvSchemeShard::TEvModifySchemeTransaction;
+ void SetConfig(
+ TTestActorRuntime &runtime,
+ ui64 schemeShard,
+ THolder<NConsole::TEvConsole::TEvConfigNotificationRequest> request);
+
////////// tablet
NKikimrProto::EReplyStatus LocalMiniKQL(TTestActorRuntime& runtime, ui64 tabletId, const TString& query, NKikimrMiniKQL::TResult& result, TString& err);
NKikimrMiniKQL::TResult LocalMiniKQL(TTestActorRuntime& runtime, ui64 tabletId, const TString& query);
diff --git a/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp b/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp
index 750ed537c12..f4823fbd622 100644
--- a/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp
+++ b/ydb/core/tx/schemeshard/ut_helpers/test_env.cpp
@@ -505,6 +505,7 @@ NSchemeShardUT_Private::TTestEnv::TTestEnv(TTestActorRuntime& runtime, const TTe
app.SetEnableProtoSourceIdInfo(opts.EnableProtoSourceIdInfo_);
app.SetEnableBackgroundCompaction(opts.EnableBackgroundCompaction_);
app.FeatureFlags.SetEnablePublicApiExternalBlobs(true);
+ app.SetEnableMoveIndex(opts.EnableMoveIndex_);
if (opts.DisableStatsBatching_.value_or(false)) {
app.SchemeShardConfig.SetStatsMaxBatchSize(0);
@@ -1013,5 +1014,6 @@ NSchemeShardUT_Private::TTestEnvOptions NSchemeShardUT_Private::TTestWithReboots
.EnableAsyncIndexes(true)
.EnableNotNullColumns(true)
.EnableProtoSourceIdInfo(true)
- .DisableStatsBatching(true);
+ .DisableStatsBatching(true)
+ .EnableMoveIndex(true);
}
diff --git a/ydb/core/tx/schemeshard/ut_helpers/test_env.h b/ydb/core/tx/schemeshard/ut_helpers/test_env.h
index ae7594615ad..bbc3ad8c6e8 100644
--- a/ydb/core/tx/schemeshard/ut_helpers/test_env.h
+++ b/ydb/core/tx/schemeshard/ut_helpers/test_env.h
@@ -43,6 +43,7 @@ namespace NSchemeShardUT_Private {
OPTION(std::optional<bool>, EnableBackgroundCompaction, std::nullopt);
OPTION(std::optional<bool>, DisableStatsBatching, std::nullopt);
OPTION(THashSet<TString>, SystemBackupSIDs, {});
+ OPTION(std::optional<bool>, EnableMoveIndex, std::nullopt);
#undef OPTION
};
diff --git a/ydb/core/tx/schemeshard/ut_move.cpp b/ydb/core/tx/schemeshard/ut_move.cpp
index 6007936f6e0..6568c096cc4 100644
--- a/ydb/core/tx/schemeshard/ut_move.cpp
+++ b/ydb/core/tx/schemeshard/ut_move.cpp
@@ -12,6 +12,15 @@ using namespace NKikimr;
using namespace NSchemeShard;
using namespace NSchemeShardUT_Private;
+void SetEnableMoveIndex(TTestActorRuntime &runtime, TTestEnv&, ui64 schemeShard, bool value) {
+ auto request = MakeHolder<NConsole::TEvConsole::TEvConfigNotificationRequest>();
+
+ NKikimrConfig::TFeatureFlags features;
+ features.SetEnableMoveIndex(value);
+ *request->Record.MutableConfig()->MutableFeatureFlags() = features;
+ SetConfig(runtime, schemeShard, std::move(request));
+}
+
Y_UNIT_TEST_SUITE(TSchemeShardMoveTest) {
Y_UNIT_TEST(Boot) {
TTestBasicRuntime runtime;
@@ -766,6 +775,11 @@ Y_UNIT_TEST_SUITE(TSchemeShardMoveTest) {
NLs::CheckColumns("Table", {"key", "value0", "value1", "valueFloat"}, {}, {"key"}),
NLs::IndexesCount(2)});
+ TestMoveIndex(runtime, ++txId, "/MyRoot/Table", "Sync", "MovedSync", false, {NKikimrScheme::StatusPreconditionFailed});
+ env.TestWaitNotification(runtime, txId);
+
+ SetEnableMoveIndex(runtime, env, TTestTxConfig::SchemeShard, true);
+
TestMoveIndex(runtime, ++txId, "/MyRoot/Table", "Sync", "MovedSync", false);
env.TestWaitNotification(runtime, txId);
@@ -799,7 +813,8 @@ Y_UNIT_TEST_SUITE(TSchemeShardMoveTest) {
TTestBasicRuntime runtime;
TTestEnv env(runtime,
TTestEnvOptions()
- .EnableAsyncIndexes(true));
+ .EnableAsyncIndexes(true)
+ .EnableMoveIndex(true));
ui64 txId = 100;
TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
@@ -866,7 +881,8 @@ Y_UNIT_TEST_SUITE(TSchemeShardMoveTest) {
TTestBasicRuntime runtime;
TTestEnv env(runtime,
TTestEnvOptions()
- .EnableAsyncIndexes(true));
+ .EnableAsyncIndexes(true)
+ .EnableMoveIndex(true));
ui64 txId = 100;
TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(
@@ -933,7 +949,8 @@ Y_UNIT_TEST_SUITE(TSchemeShardMoveTest) {
TTestBasicRuntime runtime;
TTestEnv env(runtime,
TTestEnvOptions()
- .EnableAsyncIndexes(true));
+ .EnableAsyncIndexes(true)
+ .EnableMoveIndex(true));
ui64 txId = 100;
TestCreateIndexedTable(runtime, ++txId, "/MyRoot", R"(