@@ -432,22 +432,37 @@ namespace NKikimr::NStorage {
432432 FanOutReversePush ();
433433 }
434434
435+ std::unique_ptr<TEvNodeConfigPush> pendingPush;
436+ auto getPendingPushRecord = [&] {
437+ if (!pendingPush) {
438+ pendingPush.reset (new TEvNodeConfigPush);
439+ }
440+ return &pendingPush->Record ;
441+ };
442+
435443 // process cache updates, if needed
436444 if (record.HasCacheUpdate ()) {
437445 auto *cacheUpdate = record.MutableCacheUpdate ();
438446 ApplyCacheUpdates (cacheUpdate, senderNodeId);
439447
440448 if (cacheUpdate->RequestedKeysSize ()) {
441- auto ev = std::make_unique<TEvNodeConfigPush>();
442449 for (const TString& key : cacheUpdate->GetRequestedKeys ()) {
443450 if (const auto it = Cache.find (key); it != Cache.end ()) {
444- AddCacheUpdate (ev-> Record . MutableCacheUpdate (), it, true );
451+ AddCacheUpdate (getPendingPushRecord ()-> MutableCacheUpdate (), it, true );
445452 }
446453 }
447- SendEvent (*Binding, std::move (ev));
448454 }
449455 }
450456
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+
451466 // if we have a root node id that is not ours, then we drop all inbound pile connections; also execute any
452467 // pending commands
453468 if (Binding && Binding->RootNodeId ) {
@@ -537,11 +552,14 @@ namespace NKikimr::NStorage {
537552
538553 // check if we have to send our current config to the peer
539554 const NKikimrBlobStorage::TStorageConfig *configToPeer = nullptr ;
540- if (record.GetInitial ()) {
555+ std::optional<ui64> requestStorageConfigGeneration;
556+ if (StorageConfig) {
541557 for (const auto & item : record.GetBoundNodes ()) {
542558 if (item.GetNodeId ().GetNodeId () == senderNodeId) {
543- if (StorageConfig && item.GetMeta ().GetGeneration () < StorageConfig->GetGeneration ()) {
559+ if (item.GetMeta ().GetGeneration () < StorageConfig->GetGeneration ()) {
544560 configToPeer = StorageConfig.get ();
561+ } else if (StorageConfig->GetGeneration () < item.GetMeta ().GetGeneration ()) {
562+ requestStorageConfigGeneration.emplace (item.GetMeta ().GetGeneration ());
545563 }
546564 break ;
547565 }
@@ -606,7 +624,8 @@ namespace NKikimr::NStorage {
606624 GetRootNodeId ());
607625 TBoundNode& info = it->second ;
608626 if (inserted) {
609- auto response = std::make_unique<TEvNodeConfigReversePush>(GetRootNodeId (), configToPeer);
627+ auto response = std::make_unique<TEvNodeConfigReversePush>(GetRootNodeId (), configToPeer,
628+ requestStorageConfigGeneration);
610629 if (record.GetInitial ()) {
611630 auto *cache = record.MutableCacheUpdate ();
612631
@@ -675,6 +694,10 @@ namespace NKikimr::NStorage {
675694 ApplyCacheUpdates (record.MutableCacheUpdate (), senderNodeId);
676695 }
677696
697+ if (record.HasStorageConfig ()) {
698+ ApplyStorageConfig (record.GetStorageConfig (), /* fromBinding=*/ false );
699+ }
700+
678701 if (pushEv && pushEv->IsUseful ()) {
679702 SendEvent (*Binding, std::move (pushEv));
680703 }
0 commit comments