@@ -37,7 +37,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
37
37
38
38
void SimpleTest (bool autoscaleAwareSDK) {
39
39
TTopicSdkTestSetup setup = CreateSetup ();
40
- setup.CreateTopic ();
40
+ setup.CreateTopicWithAutoscale ();
41
41
42
42
TTopicClient client = setup.MakeClient ();
43
43
@@ -79,7 +79,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
79
79
80
80
void ReadingAfterSplitTest (bool autoscaleAwareSDK, bool autoCommit) {
81
81
TTopicSdkTestSetup setup = CreateSetup ();
82
- setup.CreateTopic ();
82
+ setup.CreateTopicWithAutoscale ();
83
83
84
84
TTopicClient client = setup.MakeClient ();
85
85
@@ -133,7 +133,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
133
133
134
134
void ReadingAfterSplitTest_PreferedPartition (bool autoscaleAwareSDK) {
135
135
TTopicSdkTestSetup setup = CreateSetup ();
136
- setup.CreateTopic ();
136
+ setup.CreateTopicWithAutoscale ();
137
137
138
138
TTopicClient client = setup.MakeClient ();
139
139
@@ -179,7 +179,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
179
179
180
180
Y_UNIT_TEST (PartitionSplit_BeforeAutoscaleAwareSDK) {
181
181
TTopicSdkTestSetup setup = CreateSetup ();
182
- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
182
+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
183
183
184
184
TTopicClient client = setup.MakeClient ();
185
185
@@ -226,7 +226,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
226
226
227
227
Y_UNIT_TEST (PartitionSplit_AutoscaleAwareSDK) {
228
228
TTopicSdkTestSetup setup = CreateSetup ();
229
- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
229
+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
230
230
231
231
TTopicClient client = setup.MakeClient ();
232
232
@@ -271,7 +271,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
271
271
272
272
void PartitionSplit_PreferedPartition (bool autoscaleAwareSDK) {
273
273
TTopicSdkTestSetup setup = CreateSetup ();
274
- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
274
+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
275
275
276
276
TTopicClient client = setup.MakeClient ();
277
277
@@ -348,7 +348,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
348
348
349
349
void PartitionMerge_PreferedPartition (bool autoscaleAwareSDK) {
350
350
TTopicSdkTestSetup setup = CreateSetup ();
351
- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 2 , 100 );
351
+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 2 , 100 );
352
352
353
353
TTopicClient client = setup.MakeClient ();
354
354
@@ -416,7 +416,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
416
416
417
417
void PartitionSplit_ReadEmptyPartitions (bool autoscaleAwareSDK) {
418
418
TTopicSdkTestSetup setup = CreateSetup ();
419
- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
419
+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
420
420
421
421
TTopicClient client = setup.MakeClient ();
422
422
TTestReadSession readSession (" session-0" , client, Max<size_t >(), false , {}, autoscaleAwareSDK);
@@ -441,7 +441,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
441
441
442
442
Y_UNIT_TEST (PartitionSplit_ReadNotEmptyPartitions_BeforeAutoscaleAwareSDK) {
443
443
TTopicSdkTestSetup setup = CreateSetup ();
444
- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
444
+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
445
445
446
446
TTopicClient client = setup.MakeClient ();
447
447
TTestReadSession readSession (" Session-0" , client, Max<size_t >(), false , {}, false );
@@ -468,7 +468,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
468
468
469
469
Y_UNIT_TEST (PartitionSplit_ReadNotEmptyPartitions_AutoscaleAwareSDK) {
470
470
TTopicSdkTestSetup setup = CreateSetup ();
471
- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
471
+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
472
472
473
473
TTopicClient client = setup.MakeClient ();
474
474
TTestReadSession readSession (" Session-0" , client, Max<size_t >(), false , {}, true );
@@ -489,7 +489,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
489
489
490
490
Y_UNIT_TEST (PartitionSplit_ManySession_BeforeAutoscaleAwareSDK) {
491
491
TTopicSdkTestSetup setup = CreateSetup ();
492
- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
492
+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
493
493
494
494
TTopicClient client = setup.MakeClient ();
495
495
@@ -521,7 +521,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
521
521
522
522
Y_UNIT_TEST (PartitionSplit_ManySession_AutoscaleAwareSDK) {
523
523
TTopicSdkTestSetup setup = CreateSetup ();
524
- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
524
+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
525
525
526
526
TTopicClient client = setup.MakeClient ();
527
527
@@ -566,7 +566,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
566
566
567
567
Y_UNIT_TEST (PartitionSplit_ManySession_existed_AutoscaleAwareSDK) {
568
568
TTopicSdkTestSetup setup = CreateSetup ();
569
- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
569
+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
570
570
571
571
TTopicClient client = setup.MakeClient ();
572
572
@@ -594,7 +594,7 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
594
594
595
595
Y_UNIT_TEST (CommitTopPast_BeforeAutoscaleAwareSDK) {
596
596
TTopicSdkTestSetup setup = CreateSetup ();
597
- setup.CreateTopic (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
597
+ setup.CreateTopicWithAutoscale (TEST_TOPIC, TEST_CONSUMER, 1 , 100 );
598
598
599
599
TTopicClient client = setup.MakeClient ();
600
600
@@ -692,6 +692,57 @@ Y_UNIT_TEST_SUITE(TopicAutoscaling) {
692
692
UNIT_ASSERT_VALUES_EQUAL (describeAfterAlter.GetTopicDescription ().GetPartitioningSettings ().GetAutoscalingSettings ().GetThresholdTime ().Seconds (), alterThreshold);
693
693
}
694
694
695
+ Y_UNIT_TEST (ControlPlane_DisableAutoPartitioning) {
696
+ auto topicName = " autoscalit-topic" ;
697
+
698
+ TTopicSdkTestSetup setup = CreateSetup ();
699
+ TTopicClient client = setup.MakeClient ();
700
+
701
+ {
702
+ TCreateTopicSettings createSettings;
703
+ createSettings
704
+ .BeginConfigurePartitioningSettings ()
705
+ .MinActivePartitions (1 )
706
+ .MaxActivePartitions (100 )
707
+ .BeginConfigureAutoscalingSettings ()
708
+ .Strategy (EAutoscalingStrategy::ScaleUp)
709
+ .EndConfigureAutoscalingSettings ()
710
+ .EndConfigurePartitioningSettings ();
711
+ client.CreateTopic (topicName, createSettings).Wait ();
712
+ }
713
+
714
+ {
715
+ TAlterTopicSettings alterSettings;
716
+ alterSettings
717
+ .BeginAlterPartitioningSettings ()
718
+ .BeginAlterAutoscalingSettings ()
719
+ .Strategy (EAutoscalingStrategy::Disabled)
720
+ .EndAlterAutoscalingSettings ()
721
+ .EndAlterTopicPartitioningSettings ();
722
+ auto f = client.AlterTopic (topicName, alterSettings);
723
+ f.Wait ();
724
+
725
+ auto v = f.GetValueSync ();
726
+ UNIT_ASSERT_C (!v.IsSuccess (), " Must receve error becuse max-partition is not 0" );
727
+ }
728
+
729
+ {
730
+ TAlterTopicSettings alterSettings;
731
+ alterSettings
732
+ .BeginAlterPartitioningSettings ()
733
+ .MaxActivePartitions (0 )
734
+ .BeginAlterAutoscalingSettings ()
735
+ .Strategy (EAutoscalingStrategy::Disabled)
736
+ .EndAlterAutoscalingSettings ()
737
+ .EndAlterTopicPartitioningSettings ();
738
+ auto f = client.AlterTopic (topicName, alterSettings);
739
+ f.Wait ();
740
+
741
+ auto v = f.GetValueSync ();
742
+ UNIT_ASSERT_C (v.IsSuccess (), " Error: " << v);
743
+ }
744
+ }
745
+
695
746
Y_UNIT_TEST (ControlPlane_AutoscalingWithStorageSizeRetention) {
696
747
auto autoscalingTestTopic = " autoscalit-topic" ;
697
748
TTopicSdkTestSetup setup = CreateSetup ();
0 commit comments