Skip to content

Commit e9799ec

Browse files
authored
25-3-1: Feature-flag EnableReplication (#29574)
2 parents ce80288 + 3e93705 commit e9799ec

File tree

6 files changed

+24
-0
lines changed

6 files changed

+24
-0
lines changed

ydb/core/protos/feature_flags.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,5 @@ message TFeatureFlags {
233233
optional bool EnableTinyDisks = 207 [default = false];
234234
optional bool EnableMetricsLevel = 208 [default = false];
235235
optional bool DisableMissingDefaultColumnsInBulkUpsert = 215 [default = false];
236+
optional bool EnableReplication = 217 [default = true];
236237
}

ydb/core/testlib/basics/feature_flags.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class TTestFeatureFlagsHolder {
7171
FEATURE_FLAG_SETTER(EnableTopicAutopartitioningForCDC)
7272
FEATURE_FLAG_SETTER(EnableFollowerStats)
7373
FEATURE_FLAG_SETTER(EnableChecksumsExport)
74+
FEATURE_FLAG_SETTER(EnableReplication)
7475
FEATURE_FLAG_SETTER(EnableTopicTransfer)
7576
FEATURE_FLAG_SETTER(EnableStrictUserManagement)
7677
FEATURE_FLAG_SETTER(EnableDatabaseAdmin)

ydb/core/tx/schemeshard/schemeshard__operation_create_replication.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ struct TReplicationStrategy : public IStrategy {
2727
};
2828

2929
bool Validate(TProposeResponse& result, const NKikimrSchemeOp::TReplicationDescription& desc, const TOperationContext&) const override {
30+
if (!AppData()->FeatureFlags.GetEnableReplication()) {
31+
result.SetError(NKikimrScheme::StatusPreconditionFailed, "Asynchronous replication is disabled");
32+
return true;
33+
}
3034
if (desc.GetConfig().HasTransferSpecific()) {
3135
result.SetError(NKikimrScheme::StatusInvalidParameter, "Wrong replication configuration");
3236
return true;

ydb/core/tx/schemeshard/ut_helpers/test_env.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -615,6 +615,7 @@ NSchemeShardUT_Private::TTestEnv::TTestEnv(TTestActorRuntime& runtime, const TTe
615615
app.SetEnableTopicAutopartitioningForCDC(opts.EnableTopicAutopartitioningForCDC_);
616616
app.SetEnableBackupService(opts.EnableBackupService_);
617617
app.SetEnableChecksumsExport(opts.EnableChecksumsExport_);
618+
app.SetEnableReplication(opts.EnableReplication_);
618619
app.SetEnableTopicTransfer(opts.EnableTopicTransfer_);
619620
app.SetEnablePermissionsExport(opts.EnablePermissionsExport_);
620621
app.SetEnableLocalDBBtreeIndex(opts.EnableLocalDBBtreeIndex_);

ydb/core/tx/schemeshard/ut_helpers/test_env.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ namespace NSchemeShardUT_Private {
6969
OPTION(std::optional<bool>, EnableParameterizedDecimal, std::nullopt);
7070
OPTION(std::optional<bool>, EnableTopicAutopartitioningForCDC, std::nullopt);
7171
OPTION(std::optional<bool>, EnableBackupService, std::nullopt);
72+
OPTION(std::optional<bool>, EnableReplication, std::nullopt);
7273
OPTION(std::optional<bool>, EnableTopicTransfer, std::nullopt);
7374
OPTION(bool, SetupKqpProxy, false);
7475
OPTION(bool, EnableStrictAclCheck, false);

ydb/core/tx/schemeshard/ut_replication/ut_replication.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,22 @@ Y_UNIT_TEST_SUITE(TReplicationTests) {
5252
});
5353
}
5454

55+
Y_UNIT_TEST(Disabled) {
56+
TTestBasicRuntime runtime;
57+
TTestEnv env(runtime, TTestEnvOptions().InitYdbDriver(true).EnableReplication(false));
58+
ui64 txId = 100;
59+
60+
SetupLogging(runtime);
61+
62+
TestCreateReplication(runtime, ++txId, "/MyRoot", DefaultScheme("Replication"),
63+
{NKikimrScheme::StatusPreconditionFailed});
64+
env.TestWaitNotification(runtime, txId);
65+
66+
TestDescribeResult(DescribePath(runtime, "/MyRoot/Replication"), {
67+
NLs::PathNotExist,
68+
});
69+
}
70+
5571
Y_UNIT_TEST(CreateSequential) {
5672
TTestBasicRuntime runtime;
5773
TTestEnv env(runtime, TTestEnvOptions().InitYdbDriver(true));

0 commit comments

Comments
 (0)