@@ -1011,6 +1011,64 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
1011
1011
WaitAndAssertPartitionCount (setup, " /Root/origin/feed" , 3 );
1012
1012
}
1013
1013
1014
+ Y_UNIT_TEST (ControlPlane_CDC) {
1015
+ TTopicSdkTestSetup setup = CreateSetup ();
1016
+ auto tableClient = setup.MakeTableClient ();
1017
+ auto session = tableClient.CreateSession ().GetValueSync ().GetSession ();
1018
+ auto client = setup.MakeClient ();
1019
+
1020
+ ExecuteQuery (session, R"(
1021
+ --!syntax_v1
1022
+ CREATE TABLE `/Root/origin` (
1023
+ id Uint64,
1024
+ value Text,
1025
+ PRIMARY KEY (id)
1026
+ );
1027
+ )" );
1028
+
1029
+ ExecuteQuery (session, R"(
1030
+ --!syntax_v1
1031
+ ALTER TABLE `/Root/origin`
1032
+ ADD CHANGEFEED `feed` WITH (
1033
+ MODE = 'UPDATES',
1034
+ FORMAT = 'JSON',
1035
+ TOPIC_AUTO_PARTITIONING = 'ENABLED'
1036
+ );
1037
+ )" );
1038
+
1039
+ {
1040
+ TAlterTopicSettings alterSettings;
1041
+ alterSettings
1042
+ .BeginAlterPartitioningSettings ()
1043
+ .MinActivePartitions (3 )
1044
+ .MaxActivePartitions (107 )
1045
+ .BeginAlterAutoPartitioningSettings ()
1046
+ .Strategy (EAutoPartitioningStrategy::ScaleUp)
1047
+ .StabilizationWindow (TDuration::Seconds (3 ))
1048
+ .DownUtilizationPercent (5 )
1049
+ .UpUtilizationPercent (7 )
1050
+ .EndAlterAutoPartitioningSettings ()
1051
+ .EndAlterTopicPartitioningSettings ();
1052
+ auto f = client.AlterTopic (" /Root/origin/feed" , alterSettings);
1053
+ f.Wait ();
1054
+
1055
+ auto v = f.GetValueSync ();
1056
+ UNIT_ASSERT_C (v.IsSuccess (), " Error: " << v);
1057
+ }
1058
+
1059
+ {
1060
+ auto describeAfterAlter = client.DescribeTopic (" /Root/origin/feed" ).GetValueSync ();
1061
+
1062
+ auto & s = describeAfterAlter.GetTopicDescription ().GetPartitioningSettings ();
1063
+ UNIT_ASSERT_VALUES_EQUAL (s.GetMinActivePartitions (), 3 );
1064
+ UNIT_ASSERT_VALUES_EQUAL (s.GetMaxActivePartitions (), 107 );
1065
+ UNIT_ASSERT_VALUES_EQUAL (s.GetAutoPartitioningSettings ().GetStrategy (), EAutoPartitioningStrategy::ScaleUp);
1066
+ UNIT_ASSERT_VALUES_EQUAL (s.GetAutoPartitioningSettings ().GetStabilizationWindow (), TDuration::Seconds (3 ));
1067
+ UNIT_ASSERT_VALUES_EQUAL (s.GetAutoPartitioningSettings ().GetDownUtilizationPercent (), 5 );
1068
+ UNIT_ASSERT_VALUES_EQUAL (s.GetAutoPartitioningSettings ().GetUpUtilizationPercent (), 7 );
1069
+ }
1070
+ }
1071
+
1014
1072
Y_UNIT_TEST (BalancingAfterSplit_sessionsWithPartition) {
1015
1073
TTopicSdkTestSetup setup = CreateSetup ();
1016
1074
setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
0 commit comments