@@ -717,6 +717,10 @@ namespace NKikimr::NGRpcProxy::V1 {
717
717
error = TStringBuilder () << " Partition scale threshold time must be greater then 1 second, provided " << strategy.GetScaleThresholdSeconds () << " seconds" ;
718
718
return TYdbPqCodes (Ydb::StatusIds::BAD_REQUEST, Ydb::PersQueue::ErrorCode::VALIDATION_ERROR);
719
719
}
720
+ if (strategy.GetPartitionStrategyType () != ::NKikimrPQ::TPQTabletConfig_TPartitionStrategyType::TPQTabletConfig_TPartitionStrategyType_DISABLED && config.GetPartitionConfig ().HasStorageLimitBytes ()) {
721
+ error = TStringBuilder () << " Partitions autoscaling is incompatible with retention storage bytes option" ;
722
+ return TYdbPqCodes (Ydb::StatusIds::BAD_REQUEST, Ydb::PersQueue::ErrorCode::VALIDATION_ERROR);
723
+ }
720
724
721
725
return std::nullopt;
722
726
}
@@ -736,6 +740,29 @@ namespace NKikimr::NGRpcProxy::V1 {
736
740
auto minParts = 1 ;
737
741
auto * pqTabletConfig = pqDescr->MutablePQTabletConfig ();
738
742
auto partConfig = pqTabletConfig->MutablePartitionConfig ();
743
+
744
+ switch (settings.retention_case ()) {
745
+ case Ydb::PersQueue::V1::TopicSettings::kRetentionPeriodMs : {
746
+ partConfig->SetLifetimeSeconds (Max (settings.retention_period_ms () / 1000ll , 1ll ));
747
+ }
748
+ break ;
749
+
750
+ case Ydb::PersQueue::V1::TopicSettings::kRetentionStorageBytes : {
751
+ if (settings.retention_storage_bytes () <= 0 ) {
752
+ error = TStringBuilder () << " retention_storage_bytes must be positive, provided " <<
753
+ settings.retention_storage_bytes ();
754
+ return Ydb::StatusIds::BAD_REQUEST;
755
+ }
756
+ partConfig->SetStorageLimitBytes (settings.retention_storage_bytes ());
757
+ }
758
+ break ;
759
+
760
+ default : {
761
+ error = TStringBuilder () << " retention_storage_bytes or retention_period_ms should be set" ;
762
+ return Ydb::StatusIds::BAD_REQUEST;
763
+ }
764
+ }
765
+
739
766
if (settings.has_partitions_count ()) {
740
767
if (settings.partitions_count () > 0 ) {
741
768
minParts = settings.partitions_count ();
@@ -816,28 +843,6 @@ namespace NKikimr::NGRpcProxy::V1 {
816
843
partConfig->SetMaxSizeInPartition (settings.max_partition_storage_size () ? settings.max_partition_storage_size () : Max<i64>());
817
844
partConfig->SetMaxCountInPartition (Max<i32>());
818
845
819
- switch (settings.retention_case ()) {
820
- case Ydb::PersQueue::V1::TopicSettings::kRetentionPeriodMs : {
821
- partConfig->SetLifetimeSeconds (Max (settings.retention_period_ms () / 1000ll , 1ll ));
822
- }
823
- break ;
824
-
825
- case Ydb::PersQueue::V1::TopicSettings::kRetentionStorageBytes : {
826
- if (settings.retention_storage_bytes () <= 0 ) {
827
- error = TStringBuilder () << " retention_storage_bytes must be positive, provided " <<
828
- settings.retention_storage_bytes ();
829
- return Ydb::StatusIds::BAD_REQUEST;
830
- }
831
- partConfig->SetStorageLimitBytes (settings.retention_storage_bytes ());
832
- }
833
- break ;
834
-
835
- default : {
836
- error = TStringBuilder () << " retention_storage_bytes or retention_period_ms should be set" ;
837
- return Ydb::StatusIds::BAD_REQUEST;
838
- }
839
- }
840
-
841
846
if (settings.message_group_seqno_retention_period_ms () > 0 && settings.message_group_seqno_retention_period_ms () < settings.retention_period_ms ()) {
842
847
error = TStringBuilder () << " message_group_seqno_retention_period_ms (provided " << settings.message_group_seqno_retention_period_ms () << " ) must be more then retention_period_ms (provided " << settings.retention_period_ms () << " )" ;
843
848
return Ydb::StatusIds::BAD_REQUEST;
@@ -1077,6 +1082,10 @@ namespace NKikimr::NGRpcProxy::V1 {
1077
1082
1078
1083
auto pqTabletConfig = pqDescr->MutablePQTabletConfig ();
1079
1084
auto partConfig = pqTabletConfig->MutablePartitionConfig ();
1085
+
1086
+ if (request.retention_storage_mb ())
1087
+ partConfig->SetStorageLimitBytes (request.retention_storage_mb () * 1024 * 1024 );
1088
+
1080
1089
if (request.has_partitioning_settings ()) {
1081
1090
const auto & settings = request.partitioning_settings ();
1082
1091
if (settings.min_active_partitions () > 0 ) {
@@ -1162,9 +1171,6 @@ namespace NKikimr::NGRpcProxy::V1 {
1162
1171
partConfig->SetLifetimeSeconds (TDuration::Days (1 ).Seconds ());
1163
1172
}
1164
1173
1165
- if (request.retention_storage_mb ())
1166
- partConfig->SetStorageLimitBytes (request.retention_storage_mb () * 1024 * 1024 );
1167
-
1168
1174
if (local) {
1169
1175
auto partSpeed = request.partition_write_speed_bytes_per_second ();
1170
1176
if (partSpeed == 0 ) {
@@ -1237,9 +1243,16 @@ namespace NKikimr::NGRpcProxy::V1 {
1237
1243
auto pqTabletConfig = pqDescr.MutablePQTabletConfig ();
1238
1244
NPQ::Migrate (*pqTabletConfig);
1239
1245
auto partConfig = pqTabletConfig->MutablePartitionConfig ();
1240
- if (request.has_alter_partitioning_settings ()) {
1241
- auto splitMergeFeatureEnabled = AppData (ctx)->FeatureFlags .GetEnableTopicSplitMerge ();
1246
+ auto splitMergeFeatureEnabled = AppData (ctx)->FeatureFlags .GetEnableTopicSplitMerge ();
1242
1247
1248
+ if (request.has_set_retention_storage_mb ()) {
1249
+ CHECK_CDC;
1250
+ partConfig->ClearStorageLimitBytes ();
1251
+ if (request.set_retention_storage_mb ())
1252
+ partConfig->SetStorageLimitBytes (request.set_retention_storage_mb () * 1024 * 1024 );
1253
+ }
1254
+
1255
+ if (request.has_alter_partitioning_settings ()) {
1243
1256
const auto & settings = request.alter_partitioning_settings ();
1244
1257
if (settings.has_set_min_active_partitions ()) {
1245
1258
auto minParts = IfEqualThenDefault (settings.set_min_active_partitions (), 0L , 1L );
@@ -1248,6 +1261,7 @@ namespace NKikimr::NGRpcProxy::V1 {
1248
1261
pqTabletConfig->MutablePartitionStrategy ()->SetMinPartitionCount (minParts);
1249
1262
}
1250
1263
}
1264
+
1251
1265
if (splitMergeFeatureEnabled) {
1252
1266
if (settings.has_set_max_active_partitions ()) {
1253
1267
pqTabletConfig->MutablePartitionStrategy ()->SetMaxPartitionCount (settings.set_max_active_partitions ());
@@ -1278,11 +1292,12 @@ namespace NKikimr::NGRpcProxy::V1 {
1278
1292
}
1279
1293
}
1280
1294
}
1281
- if (auto code = ValidatePartitionStrategy (*pqTabletConfig, error); code) {
1282
- return code->YdbCode ;
1283
- }
1284
1295
}
1296
+ }
1285
1297
1298
+ if (splitMergeFeatureEnabled) {
1299
+ auto code = ValidatePartitionStrategy (*pqTabletConfig, error);
1300
+ if (code) return code->YdbCode ;
1286
1301
}
1287
1302
1288
1303
if (request.alter_attributes ().size ()) {
@@ -1299,14 +1314,6 @@ namespace NKikimr::NGRpcProxy::V1 {
1299
1314
partConfig->SetLifetimeSeconds (request.set_retention_period ().seconds ());
1300
1315
}
1301
1316
1302
-
1303
- if (request.has_set_retention_storage_mb ()) {
1304
- CHECK_CDC;
1305
- partConfig->ClearStorageLimitBytes ();
1306
- if (request.set_retention_storage_mb ())
1307
- partConfig->SetStorageLimitBytes (request.set_retention_storage_mb () * 1024 * 1024 );
1308
- }
1309
-
1310
1317
bool local = true ; // todo: check locality
1311
1318
if (local || pqConfig.GetTopicsAreFirstClassCitizen ()) {
1312
1319
if (request.has_set_partition_write_speed_bytes_per_second ()) {
@@ -1434,7 +1441,4 @@ namespace NKikimr::NGRpcProxy::V1 {
1434
1441
1435
1442
return CheckConfig (*pqTabletConfig, supportedClientServiceTypes, error, ctx, Ydb::StatusIds::ALREADY_EXISTS);
1436
1443
}
1437
-
1438
-
1439
-
1440
1444
}
0 commit comments