@@ -60,12 +60,12 @@ bool TLockableItem::IsLocked(TErrorInfo &error, TDuration defaultRetryTime,
6060 return true ;
6161 }
6262
63- if (!ScheduledLocks.empty () && ScheduledLocks.begin ()->Order < DeactivatedLocksOrder ) {
63+ if (!ScheduledLocks.empty () && ScheduledLocks.begin ()->Priority < DeactivatedLocksPriority ) {
6464 error.Code = TStatus::DISALLOW_TEMP;
65- error.Reason = Sprintf (" %s has scheduled action %s owned by %s (order %" PRIu64 " vs %" PRIu64 " )" ,
65+ error.Reason = Sprintf (" %s has scheduled action %s owned by %s (priority %" PRIi32 " vs %" PRIi32 " )" ,
6666 PrettyItemName ().data (), ScheduledLocks.begin ()->RequestId .data (),
67- ScheduledLocks.begin ()->Owner .data (), ScheduledLocks.begin ()->Order ,
68- DeactivatedLocksOrder );
67+ ScheduledLocks.begin ()->Owner .data (), ScheduledLocks.begin ()->Priority ,
68+ DeactivatedLocksPriority );
6969 error.Deadline = now + defaultRetryTime;
7070 return true ;
7171 }
@@ -113,12 +113,12 @@ void TLockableItem::RollbackLocks(ui64 point)
113113
114114void TLockableItem::ReactivateScheduledLocks ()
115115{
116- DeactivatedLocksOrder = Max<ui64 >();
116+ DeactivatedLocksPriority = Max<i32 >();
117117}
118118
119- void TLockableItem::DeactivateScheduledLocks (ui64 order )
119+ void TLockableItem::DeactivateScheduledLocks (i32 priority )
120120{
121- DeactivatedLocksOrder = order ;
121+ DeactivatedLocksPriority = priority ;
122122}
123123
124124void TLockableItem::RemoveScheduledLocks (const TString &requestId)
@@ -650,21 +650,30 @@ void TClusterInfo::ApplyActionWithoutLog(const NKikimrCms::TAction &action)
650650 case TAction::REBOOT_HOST:
651651 if (auto nodes = NodePtrs (action.GetHost (), MakeServices (action))) {
652652 for (const auto node : nodes) {
653- for (auto &nodeGroup: node->NodeGroups )
654- nodeGroup->LockNode (node->NodeId );
653+ for (auto &nodeGroup: node->NodeGroups ) {
654+ if (!nodeGroup->IsNodeLocked (node->NodeId )) {
655+ nodeGroup->LockNode (node->NodeId );
656+ }
657+ }
655658 }
656659 }
657660 break ;
658661 case TAction::REPLACE_DEVICES:
659662 for (const auto &device : action.GetDevices ()) {
660663 if (HasPDisk (device)) {
661664 auto pdisk = &PDiskRef (device);
662- for (auto &nodeGroup: NodeRef (pdisk->NodeId ).NodeGroups )
663- nodeGroup->LockNode (pdisk->NodeId );
665+ for (auto &nodeGroup: NodeRef (pdisk->NodeId ).NodeGroups ) {
666+ if (!nodeGroup->IsNodeLocked (pdisk->NodeId )) {
667+ nodeGroup->LockNode (pdisk->NodeId );
668+ }
669+ }
664670 } else if (HasVDisk (device)) {
665671 auto vdisk = &VDiskRef (device);
666- for (auto &nodeGroup: NodeRef (vdisk->NodeId ).NodeGroups )
667- nodeGroup->LockNode (vdisk->NodeId );
672+ for (auto &nodeGroup: NodeRef (vdisk->NodeId ).NodeGroups ) {
673+ if (!nodeGroup->IsNodeLocked (vdisk->NodeId )) {
674+ nodeGroup->LockNode (vdisk->NodeId );
675+ }
676+ }
668677 }
669678 }
670679 break ;
@@ -756,7 +765,7 @@ ui64 TClusterInfo::AddLocks(const TPermissionInfo &permission, const TActorConte
756765 || permission.Action .GetType () == TAction::REBOOT_HOST
757766 || permission.Action .GetType () == TAction::REPLACE_DEVICES)) {
758767 item->State = RESTART;
759- lock = true ;;
768+ lock = true ;
760769 }
761770
762771 if (lock) {
@@ -854,7 +863,7 @@ ui64 TClusterInfo::ScheduleActions(const TRequestInfo &request, const TActorCont
854863 auto items = FindLockedItems (action, ctx);
855864
856865 for (auto item : items)
857- item->ScheduleLock ({action, request.Owner , request.RequestId , request.Order });
866+ item->ScheduleLock ({action, request.Owner , request.RequestId , request.Priority });
858867
859868 locks += items.size ();
860869 }
@@ -868,10 +877,10 @@ void TClusterInfo::UnscheduleActions(const TString &requestId)
868877 entry.second ->RemoveScheduledLocks (requestId);
869878}
870879
871- void TClusterInfo::DeactivateScheduledLocks (ui64 order )
880+ void TClusterInfo::DeactivateScheduledLocks (i32 priority )
872881{
873882 for (auto &entry : LockableItems)
874- entry.second ->DeactivateScheduledLocks (order );
883+ entry.second ->DeactivateScheduledLocks (priority );
875884}
876885
877886void TClusterInfo::ReactivateScheduledLocks ()
@@ -1020,22 +1029,30 @@ void TOperationLogManager::ApplyAction(const NKikimrCms::TAction &action,
10201029 case NKikimrCms::TAction::REBOOT_HOST:
10211030 if (auto nodes = clusterState->NodePtrs (action.GetHost (), MakeServices (action))) {
10221031 for (const auto node : nodes) {
1023- for (auto &nodeGroup: node->NodeGroups )
1024- AddNodeLockOperation (node->NodeId , nodeGroup);
1032+ for (auto &nodeGroup: node->NodeGroups ) {
1033+ if (!nodeGroup->IsNodeLocked (node->NodeId )) {
1034+ AddNodeLockOperation (node->NodeId , nodeGroup);
1035+ }
1036+ }
10251037 }
10261038 }
10271039 break ;
10281040 case NKikimrCms::TAction::REPLACE_DEVICES:
10291041 for (const auto &device : action.GetDevices ()) {
10301042 if (clusterState->HasPDisk (device)) {
10311043 auto pdisk = &clusterState->PDisk (device);
1032- for (auto &nodeGroup: clusterState->NodeRef (pdisk->NodeId ).NodeGroups )
1033- AddNodeLockOperation (pdisk->NodeId , nodeGroup);
1034-
1044+ for (auto &nodeGroup: clusterState->NodeRef (pdisk->NodeId ).NodeGroups ) {
1045+ if (!nodeGroup->IsNodeLocked (pdisk->NodeId )) {
1046+ AddNodeLockOperation (pdisk->NodeId , nodeGroup);
1047+ }
1048+ }
10351049 } else if (clusterState->HasVDisk (device)) {
10361050 auto vdisk = &clusterState->VDisk (device);
1037- for (auto &nodeGroup: clusterState->NodeRef (vdisk->NodeId ).NodeGroups )
1038- AddNodeLockOperation (vdisk->NodeId , nodeGroup);
1051+ for (auto &nodeGroup: clusterState->NodeRef (vdisk->NodeId ).NodeGroups ) {
1052+ if (!nodeGroup->IsNodeLocked (vdisk->NodeId )) {
1053+ AddNodeLockOperation (vdisk->NodeId , nodeGroup);
1054+ }
1055+ }
10391056 }
10401057 }
10411058 break ;
0 commit comments