@@ -432,22 +432,37 @@ namespace NKikimr::NStorage {
432
432
FanOutReversePush ();
433
433
}
434
434
435
+ std::unique_ptr<TEvNodeConfigPush> pendingPush;
436
+ auto getPendingPushRecord = [&] {
437
+ if (!pendingPush) {
438
+ pendingPush.reset (new TEvNodeConfigPush);
439
+ }
440
+ return &pendingPush->Record ;
441
+ };
442
+
435
443
// process cache updates, if needed
436
444
if (record.HasCacheUpdate ()) {
437
445
auto *cacheUpdate = record.MutableCacheUpdate ();
438
446
ApplyCacheUpdates (cacheUpdate, senderNodeId);
439
447
440
448
if (cacheUpdate->RequestedKeysSize ()) {
441
- auto ev = std::make_unique<TEvNodeConfigPush>();
442
449
for (const TString& key : cacheUpdate->GetRequestedKeys ()) {
443
450
if (const auto it = Cache.find (key); it != Cache.end ()) {
444
- AddCacheUpdate (ev-> Record . MutableCacheUpdate (), it, true );
451
+ AddCacheUpdate (getPendingPushRecord ()-> MutableCacheUpdate (), it, true );
445
452
}
446
453
}
447
- SendEvent (*Binding, std::move (ev));
448
454
}
449
455
}
450
456
457
+ if (StorageConfig && record.HasRequestStorageConfigGeneration () &&
458
+ record.GetRequestStorageConfigGeneration () <= StorageConfig->GetGeneration ()) {
459
+ getPendingPushRecord ()->MutableStorageConfig ()->CopyFrom (*StorageConfig);
460
+ }
461
+
462
+ if (pendingPush) {
463
+ SendEvent (*Binding, std::move (pendingPush));
464
+ }
465
+
451
466
// if we have a root node id that is not ours, then we drop all inbound pile connections; also execute any
452
467
// pending commands
453
468
if (Binding && Binding->RootNodeId ) {
@@ -537,11 +552,14 @@ namespace NKikimr::NStorage {
537
552
538
553
// check if we have to send our current config to the peer
539
554
const NKikimrBlobStorage::TStorageConfig *configToPeer = nullptr ;
540
- if (record.GetInitial ()) {
555
+ std::optional<ui64> requestStorageConfigGeneration;
556
+ if (StorageConfig) {
541
557
for (const auto & item : record.GetBoundNodes ()) {
542
558
if (item.GetNodeId ().GetNodeId () == senderNodeId) {
543
- if (StorageConfig && item.GetMeta ().GetGeneration () < StorageConfig->GetGeneration ()) {
559
+ if (item.GetMeta ().GetGeneration () < StorageConfig->GetGeneration ()) {
544
560
configToPeer = StorageConfig.get ();
561
+ } else if (StorageConfig->GetGeneration () < item.GetMeta ().GetGeneration ()) {
562
+ requestStorageConfigGeneration.emplace (item.GetMeta ().GetGeneration ());
545
563
}
546
564
break ;
547
565
}
@@ -606,7 +624,8 @@ namespace NKikimr::NStorage {
606
624
GetRootNodeId ());
607
625
TBoundNode& info = it->second ;
608
626
if (inserted) {
609
- auto response = std::make_unique<TEvNodeConfigReversePush>(GetRootNodeId (), configToPeer);
627
+ auto response = std::make_unique<TEvNodeConfigReversePush>(GetRootNodeId (), configToPeer,
628
+ requestStorageConfigGeneration);
610
629
if (record.GetInitial ()) {
611
630
auto *cache = record.MutableCacheUpdate ();
612
631
@@ -675,6 +694,10 @@ namespace NKikimr::NStorage {
675
694
ApplyCacheUpdates (record.MutableCacheUpdate (), senderNodeId);
676
695
}
677
696
697
+ if (record.HasStorageConfig ()) {
698
+ ApplyStorageConfig (record.GetStorageConfig (), /* fromBinding=*/ false );
699
+ }
700
+
678
701
if (pushEv && pushEv->IsUseful ()) {
679
702
SendEvent (*Binding, std::move (pushEv));
680
703
}
0 commit comments