@@ -9216,7 +9216,16 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
9216
9216
"PartitionCount: 40 ");
9217
9217
env.TestWaitNotification(runtime, txId);
9218
9218
TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
9219
- {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(40)});
9219
+ {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(40),
9220
+ [](const NKikimrScheme::TEvDescribeSchemeResult& result){
9221
+ const auto& desc = result.GetPathDescription().GetSolomonDescription();
9222
+ const auto& boundChannels = desc.GetBoundChannels();
9223
+ UNIT_ASSERT_VALUES_EQUAL(boundChannels.size(), 4);
9224
+ UNIT_ASSERT_VALUES_EQUAL(boundChannels[0].GetStoragePoolName(), "pool-1");
9225
+ UNIT_ASSERT_VALUES_EQUAL(boundChannels[1].GetStoragePoolName(), "pool-1");
9226
+ UNIT_ASSERT_VALUES_EQUAL(boundChannels[2].GetStoragePoolName(), "pool-1");
9227
+ UNIT_ASSERT_VALUES_EQUAL(boundChannels[3].GetStoragePoolName(), "pool-1");
9228
+ }});
9220
9229
9221
9230
// Already exists
9222
9231
TestCreateSolomon(runtime, ++txId, "/MyRoot", "Name: \"Solomon\" "
@@ -9317,7 +9326,16 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
9317
9326
env.TestWaitNotification(runtime, txId);
9318
9327
9319
9328
TestDescribeResult(DescribePath(runtime, "/MyRoot/Solomon"),
9320
- {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(4)});
9329
+ {NLs::Finished, NLs::PathsInsideDomain(1), NLs::ShardsInsideDomain(4),
9330
+ [](const NKikimrScheme::TEvDescribeSchemeResult& result){
9331
+ const auto& desc = result.GetPathDescription().GetSolomonDescription();
9332
+ const auto& boundChannels = desc.GetBoundChannels();
9333
+ UNIT_ASSERT_VALUES_EQUAL(boundChannels.size(), 4);
9334
+ UNIT_ASSERT_VALUES_EQUAL(boundChannels[0].GetStoragePoolName(), "pool-1");
9335
+ UNIT_ASSERT_VALUES_EQUAL(boundChannels[1].GetStoragePoolName(), "pool-1");
9336
+ UNIT_ASSERT_VALUES_EQUAL(boundChannels[2].GetStoragePoolName(), "pool-1");
9337
+ UNIT_ASSERT_VALUES_EQUAL(boundChannels[3].GetStoragePoolName(), "pool-1");
9338
+ }});
9321
9339
9322
9340
TestDropSolomon(runtime, ++txId, "/MyRoot", "Solomon");
9323
9341
env.TestWaitNotification(runtime, txId);
@@ -9430,6 +9448,135 @@ Y_UNIT_TEST_SUITE(TSchemeShardTest) {
9430
9448
UpdateChannelsBindingSolomon(true);
9431
9449
}
9432
9450
9451
+ void UpdateChannelsBindingSolomonStorageConfig() {
9452
+ TTestBasicRuntime runtime;
9453
+ TTestEnv env(runtime, TTestEnvOptions().AllowUpdateChannelsBindingOfSolomonPartitions(true));
9454
+ ui64 txId = 100;
9455
+
9456
+ auto check = [&](const TString& path, ui64 shards, const THashMap<TString, ui32>& expectedChannels) {
9457
+ NKikimrSchemeOp::TDescribeOptions opts;
9458
+ opts.SetReturnChannelsBinding(true);
9459
+
9460
+ auto makeChannels = [](const auto& boundsChannels) {
9461
+ THashMap<TString, ui32> channels;
9462
+ for (const auto& channel : boundsChannels) {
9463
+ channels[channel.GetStoragePoolName()]++;
9464
+ }
9465
+ return channels;
9466
+ };
9467
+
9468
+ TestDescribeResult(DescribePath(runtime, path, opts), {
9469
+ NLs::Finished,
9470
+ NLs::ShardsInsideDomain(shards),
9471
+ [&expectedChannels, &makeChannels, &shards] (const NKikimrScheme::TEvDescribeSchemeResult& record) {
9472
+ const auto& desc = record.GetPathDescription().GetSolomonDescription();
9473
+
9474
+ UNIT_ASSERT_VALUES_EQUAL(shards, desc.PartitionsSize());
9475
+
9476
+ for (size_t i = 0; i < desc.PartitionsSize(); ++i) {
9477
+ const auto& partition = desc.GetPartitions(i);
9478
+
9479
+ THashMap<TString, ui32> channels = makeChannels(partition.GetBoundChannels());
9480
+ UNIT_ASSERT_VALUES_EQUAL(expectedChannels.size(), channels.size());
9481
+
9482
+ for (const auto& [name, count] : expectedChannels) {
9483
+ UNIT_ASSERT_C(channels.contains(name), "Cannot find channel: " << name);
9484
+ UNIT_ASSERT_VALUES_EQUAL(channels.at(name), count);
9485
+ }
9486
+ }
9487
+
9488
+ THashMap<TString, ui32> volumeChannels = makeChannels(desc.GetBoundChannels());
9489
+ UNIT_ASSERT_VALUES_EQUAL(expectedChannels.size(), volumeChannels.size());
9490
+
9491
+ for (const auto& [name, count] : expectedChannels) {
9492
+ UNIT_ASSERT_C(volumeChannels.contains(name), "Cannot find channel: " << name);
9493
+ UNIT_ASSERT_VALUES_EQUAL(volumeChannels.at(name), count);
9494
+ }
9495
+ }
9496
+ });
9497
+ };
9498
+
9499
+ TestCreateSolomon(runtime, ++txId, "/MyRoot", R"(
9500
+ Name: "Solomon"
9501
+ PartitionCount: 1
9502
+ StorageConfig {
9503
+ Channel {
9504
+ PreferredPoolKind: "pool-kind-1"
9505
+ }
9506
+ Channel {
9507
+ PreferredPoolKind: "pool-kind-1"
9508
+ }
9509
+ Channel {
9510
+ PreferredPoolKind: "pool-kind-1"
9511
+ }
9512
+ }
9513
+ )");
9514
+
9515
+ env.TestWaitNotification(runtime, txId);
9516
+ check("/MyRoot/Solomon", 1, {{{"pool-1", 3}}});
9517
+ // case 1: empty alter
9518
+ TestAlterSolomon(runtime, ++txId, "/MyRoot", R"(
9519
+ Name: "Solomon"
9520
+ StorageConfig {
9521
+ Channel {
9522
+ PreferredPoolKind: "pool-kind-2"
9523
+ }
9524
+ Channel {
9525
+ PreferredPoolKind: "pool-kind-2"
9526
+ }
9527
+ Channel {
9528
+ PreferredPoolKind: "pool-kind-2"
9529
+ }
9530
+ }
9531
+ )", {NKikimrScheme::StatusInvalidParameter});
9532
+
9533
+ // case 2: add partition, with update channels binding
9534
+ TestAlterSolomon(runtime, ++txId, "/MyRoot", R"(
9535
+ Name: "Solomon"
9536
+ PartitionCount: 2
9537
+ UpdateChannelsBinding: true
9538
+ StorageConfig {
9539
+ Channel {
9540
+ PreferredPoolKind: "pool-kind-2"
9541
+ }
9542
+ Channel {
9543
+ PreferredPoolKind: "pool-kind-2"
9544
+ }
9545
+ Channel {
9546
+ PreferredPoolKind: "pool-kind-2"
9547
+ }
9548
+ }
9549
+ )");
9550
+
9551
+ env.TestWaitNotification(runtime, txId);
9552
+ check("/MyRoot/Solomon", 2, {{"pool-2", 3}});
9553
+
9554
+ // case 4: add partition & update channels binding
9555
+ TestAlterSolomon(runtime, ++txId, "/MyRoot", R"(
9556
+ Name: "Solomon"
9557
+ PartitionCount: 3
9558
+ UpdateChannelsBinding: true
9559
+ StorageConfig {
9560
+ Channel {
9561
+ PreferredPoolKind: "pool-kind-1"
9562
+ }
9563
+ Channel {
9564
+ PreferredPoolKind: "pool-kind-1"
9565
+ }
9566
+ Channel {
9567
+ PreferredPoolKind: "pool-kind-1"
9568
+ }
9569
+ }
9570
+ )");
9571
+
9572
+ env.TestWaitNotification(runtime, txId);
9573
+ check("/MyRoot/Solomon", 3, {{"pool-1", 3}});
9574
+ }
9575
+
9576
+ Y_UNIT_TEST(UpdateChannelsBindingSolomonStorageConfig) {
9577
+ UpdateChannelsBindingSolomonStorageConfig();
9578
+ }
9579
+
9433
9580
Y_UNIT_TEST(RejectAlterSolomon) { //+
9434
9581
TTestBasicRuntime runtime;
9435
9582
TTestEnv env(runtime);
0 commit comments