diff options
author | Nikolay Shestakov <tesseract@ydb.tech> | 2024-09-10 14:45:45 +0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-10 09:45:45 +0000 |
commit | 17a9a618a506cac75f5f7f64ed6df7850e1a664f (patch) | |
tree | 6a0bed6c933993c343ca6c3fac7e69e464c300e5 | |
parent | f3a1a6271b5375688cb0608efd644334cc28bbc9 (diff) | |
download | ydb-17a9a618a506cac75f5f7f64ed6df7850e1a664f.tar.gz |
Disallow disabling of topic autopartitioning (#8871) (#8949)
5 files changed, 4 insertions, 70 deletions
diff --git a/ydb/core/persqueue/ut/ut_with_sdk/autoscaling_ut.cpp b/ydb/core/persqueue/ut/ut_with_sdk/autoscaling_ut.cpp index 1d660d18a7..d363acca85 100644 --- a/ydb/core/persqueue/ut/ut_with_sdk/autoscaling_ut.cpp +++ b/ydb/core/persqueue/ut/ut_with_sdk/autoscaling_ut.cpp @@ -753,29 +753,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) { f.Wait(); auto v = f.GetValueSync(); - UNIT_ASSERT_C(!v.IsSuccess(), "Must receve error becuse max-partition is not 0"); - } - - { - TAlterTopicSettings alterSettings; - alterSettings - .BeginAlterPartitioningSettings() - .MaxActivePartitions(0) - .BeginAlterAutoPartitioningSettings() - .Strategy(EAutoPartitioningStrategy::Disabled) - .EndAlterAutoPartitioningSettings() - .EndAlterTopicPartitioningSettings(); - auto f = client.AlterTopic(topicName, alterSettings); - f.Wait(); - - auto v = f.GetValueSync(); - UNIT_ASSERT_C(v.IsSuccess(), "Error: " << v); - } - - { - auto describeAfterAlter = client.DescribeTopic(topicName).GetValueSync(); - - UNIT_ASSERT_VALUES_EQUAL(describeAfterAlter.GetTopicDescription().GetPartitioningSettings().GetAutoPartitioningSettings().GetStrategy(), EAutoPartitioningStrategy::Disabled); + UNIT_ASSERT_C(!v.IsSuccess(), "Must receve error becuse disabling is not supported"); } } diff --git a/ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp b/ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp index 490ac539a1..7e07965f5d 100644 --- a/ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp +++ b/ydb/core/tx/schemeshard/schemeshard__operation_alter_pq.cpp @@ -181,12 +181,8 @@ public: if (alterConfig.HasPartitionStrategy() && !NPQ::SplitMergeEnabled(alterConfig) && tabletConfig->HasPartitionStrategy() && NPQ::SplitMergeEnabled(*tabletConfig)) { - if (!alterConfig.GetPartitionStrategy().HasMaxPartitionCount() || 0 != alterConfig.GetPartitionStrategy().GetMaxPartitionCount()) { - errStr = TStringBuilder() << "Can`t disable auto partitioning. Disabling auto partitioning is a destructive operation, " - << "after which all partitions will become active and the message order guarantee will be violated. " - << "If you are sure of this, then set max_active_partitions to 0."; - return nullptr; - } + errStr = TStringBuilder() << "Can`t disable auto partitioning."; + return nullptr; } if (!alterConfig.HasPartitionStrategy() && tabletConfig->HasPartitionStrategy()) { diff --git a/ydb/core/tx/schemeshard/ut_topic_splitmerge/ut_topic_splitmerge.cpp b/ydb/core/tx/schemeshard/ut_topic_splitmerge/ut_topic_splitmerge.cpp index 793eeeb398..5d6732e635 100644 --- a/ydb/core/tx/schemeshard/ut_topic_splitmerge/ut_topic_splitmerge.cpp +++ b/ydb/core/tx/schemeshard/ut_topic_splitmerge/ut_topic_splitmerge.cpp @@ -667,29 +667,6 @@ Y_UNIT_TEST_SUITE(TSchemeShardTopicSplitMergeTest) { partitionStrategy->SetPartitionStrategyType(::NKikimrPQ::TPQTabletConfig_TPartitionStrategyType::TPQTabletConfig_TPartitionStrategyType_DISABLED); } }, {{TEvSchemeShard::EStatus::StatusInvalidParameter}}); - - ModifyTopic(runtime, env, txId, [&](auto& scheme) { - { - auto* partitionStrategy = scheme.MutablePQTabletConfig()->MutablePartitionStrategy(); - partitionStrategy->SetPartitionStrategyType(::NKikimrPQ::TPQTabletConfig_TPartitionStrategyType::TPQTabletConfig_TPartitionStrategyType_DISABLED); - partitionStrategy->SetMaxPartitionCount(0); - } - }); - - topic = DescribeTopic(runtime); - - UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(::NKikimrPQ::TPQTabletConfig_TPartitionStrategyType::TPQTabletConfig_TPartitionStrategyType_DISABLED), - static_cast<int>(topic.GetPQTabletConfig().GetPartitionStrategy().GetPartitionStrategyType())); - - UNIT_ASSERT_VALUES_EQUAL(3, topic.GetPartitions().size()); - for (const auto& p : topic.GetPartitions()) { - Cerr << ">>>>> Verify partition " << p.GetPartitionId() << Endl << Flush; - UNIT_ASSERT_VALUES_EQUAL(static_cast<int>(::NKikimrPQ::ETopicPartitionStatus::Active), static_cast<int>(p.GetStatus())); - UNIT_ASSERT(p.GetChildPartitionIds().empty()); - UNIT_ASSERT(p.GetParentPartitionIds().empty()); - UNIT_ASSERT(!p.HasKeyRange()); - } - } // Y_UNIT_TEST(DisableSplitMerge) Y_UNIT_TEST(EnableSplitMerge) { diff --git a/ydb/services/datastreams/datastreams_proxy.cpp b/ydb/services/datastreams/datastreams_proxy.cpp index e86b54068c..98d670a033 100644 --- a/ydb/services/datastreams/datastreams_proxy.cpp +++ b/ydb/services/datastreams/datastreams_proxy.cpp @@ -522,8 +522,6 @@ namespace NKikimr::NDataStreams::V1 { t->SetScaleThresholdSeconds(ws.stabilization_window().seconds() ? ws.stabilization_window().seconds() : 300); t->SetScaleUpPartitionWriteSpeedThresholdPercent(ws.up_utilization_percent() ? ws.up_utilization_percent() : 90); t->SetScaleDownPartitionWriteSpeedThresholdPercent(ws.down_utilization_percent() ? ws.down_utilization_percent() : 30); - } else if (0 == s.max_active_partitions()) { - t->SetMaxPartitionCount(0); } } diff --git a/ydb/services/datastreams/datastreams_ut.cpp b/ydb/services/datastreams/datastreams_ut.cpp index 1c34c36099..46e8581ee6 100644 --- a/ydb/services/datastreams/datastreams_ut.cpp +++ b/ydb/services/datastreams/datastreams_ut.cpp @@ -2909,23 +2909,8 @@ Y_UNIT_TEST_SUITE(DataStreams) { ).ExtractValueSync(); UNIT_ASSERT_VALUES_EQUAL(result.IsTransportError(), false); - if (result.GetStatus() != EStatus::SUCCESS) { - result.GetIssues().PrintTo(Cerr); - } - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - } - - { - auto result = testServer.DataStreamsClient->DescribeStream(streamName2).ExtractValueSync(); - UNIT_ASSERT_VALUES_EQUAL(result.IsTransportError(), false); - Cerr << result.GetIssues().ToString() << "\n"; - UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::SUCCESS, result.GetIssues().ToString()); - - auto& d = result.GetResult().stream_description(); - UNIT_ASSERT_VALUES_EQUAL(d.stream_status(), YDS_V1::StreamDescription::ACTIVE); - UNIT_ASSERT_VALUES_EQUAL(d.partitioning_settings().auto_partitioning_settings().strategy(), ::Ydb::DataStreams::V1::AutoPartitioningStrategy::AUTO_PARTITIONING_STRATEGY_DISABLED); + UNIT_ASSERT_VALUES_EQUAL_C(result.GetStatus(), EStatus::BAD_REQUEST, result.GetIssues().ToString()); } - } Y_UNIT_TEST(Test_Crreate_AutoPartitioning_Disabled) { |