Skip to content

Commit e3d6f61

Browse files
authored
Disable autopartitioning of topics for CDC (#11448)
1 parent 46fa15c commit e3d6f61

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

ydb/core/persqueue/ut/ut_with_sdk/autoscaling_ut.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -948,6 +948,42 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
948948
}
949949
}
950950

951+
Y_UNIT_TEST(DisableCDC) {
952+
TTopicSdkTestSetup setup = CreateSetup();
953+
auto client = setup.MakeClient();
954+
auto tableClient = setup.MakeTableClient();
955+
auto session = tableClient.CreateSession().GetValueSync().GetSession();
956+
957+
ExecuteQuery(session, R"(
958+
--!syntax_v1
959+
CREATE TABLE `/Root/tbl` (
960+
`Id` UInt64,
961+
`Value` Utf8,
962+
PRIMARY KEY (`Id`)
963+
);
964+
)");
965+
966+
ExecuteQuery(session, R"(
967+
--!syntax_v1
968+
ALTER TABLE `/Root/tbl`
969+
ADD CHANGEFEED `Feed`
970+
WITH (
971+
MODE = 'KEYS_ONLY', FORMAT = 'JSON'
972+
);
973+
)");
974+
975+
TAlterTopicSettings alterSettings;
976+
alterSettings
977+
.BeginAlterPartitioningSettings()
978+
.BeginAlterAutoPartitioningSettings()
979+
.Strategy(EAutoPartitioningStrategy::ScaleUp)
980+
.EndAlterAutoPartitioningSettings()
981+
.EndAlterTopicPartitioningSettings();
982+
983+
auto result = client.AlterTopic("/Root/tbl/Feed", alterSettings).GetValueSync();
984+
UNIT_ASSERT_VALUES_EQUAL(result.GetStatus(), NYdb::EStatus::BAD_REQUEST);
985+
}
986+
951987
Y_UNIT_TEST(MidOfRange) {
952988
auto AsString = [](std::vector<ui16> vs) {
953989
TStringBuilder a;

ydb/services/lib/actors/pq_schema_actor.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,10 @@ namespace NKikimr::NGRpcProxy::V1 {
13351335
if (needHandleAutoPartitioning) {
13361336
auto code = ValidatePartitionStrategy(*pqTabletConfig, error);
13371337
if (code) return code->YdbCode;
1338+
1339+
if (pqTabletConfig->GetPartitionStrategy().GetPartitionStrategyType() != ::NKikimrPQ::TPQTabletConfig_TPartitionStrategyType::TPQTabletConfig_TPartitionStrategyType_DISABLED) {
1340+
CHECK_CDC;
1341+
}
13381342
}
13391343

13401344
if (request.alter_attributes().size()) {

0 commit comments

Comments
 (0)