Skip to content

Commit

Permalink
follow-up
Browse files Browse the repository at this point in the history
* reb-marked; prev. commit: baa11bf

Signed-off-by: Alex Aizman <[email protected]>
  • Loading branch information
alex-aizman committed Dec 3, 2024
1 parent 2aec518 commit faf733c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ais/htcommon.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ func (t *target) fillNsti(nsti *cos.NodeStateInfo) {
marked := xreg.GetRebMarked()

// (running | interrupted | ok)
if xreb := marked.Xact; xreb != nil && !xreb.IsAborted() && !xreb.Finished() {
if xreb := marked.Xact; xreb != nil {
nsti.Flags = nsti.Flags.Set(cos.Rebalancing)
} else if marked.Interrupted {
nsti.Flags = nsti.Flags.Set(cos.RebalanceInterrupted)
Expand Down
2 changes: 1 addition & 1 deletion reb/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func (reb *Reb) RebStatus(status *Status) {
marked = xreg.GetRebMarked()
)
status.Aborted = marked.Interrupted
status.Running = marked.Xact != nil && marked.Xact.Running()
status.Running = marked.Xact != nil

// rlock
reb.mu.Lock()
Expand Down
19 changes: 10 additions & 9 deletions xact/xreg/marker.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Package xreg provides registry and (renew, find) functions for AIS eXtended Actions (xactions).
/*
* Copyright (c) 2018-2023, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved.
*/
package xreg

Expand All @@ -15,23 +15,24 @@ func GetRebMarked() (out xact.Marked) {
dreg.entries.mtx.RLock()
entry := dreg.entries.findRunningKind(apc.ActRebalance)
dreg.entries.mtx.RUnlock()
if entry != nil {
out.Xact = entry.Get()
} else {

if entry == nil {
out.Interrupted = fs.MarkerExists(fname.RebalanceMarker)
out.Restarted = fs.MarkerExists(fname.NodeRestartedPrev)
} else if xreb := entry.Get(); xreb != nil && xreb.Running() {
out.Xact = xreb
}
return
return out
}

func GetResilverMarked() (out xact.Marked) {
dreg.entries.mtx.RLock()
entry := dreg.entries.findRunningKind(apc.ActResilver)
dreg.entries.mtx.RUnlock()
if entry != nil {
out.Xact = entry.Get()
} else {
if entry == nil {
out.Interrupted = fs.MarkerExists(fname.ResilverMarker)
} else if xres := entry.Get(); xres != nil && xres.Running() {
out.Xact = xres
}
return
return out
}

0 comments on commit faf733c

Please sign in to comment.