[shell] add admin noLock for balance (#6209)

add admin noLock for balance
This commit is contained in:
Konstantin Lebedev
2024-11-06 08:09:22 +05:00
committed by GitHub
parent 15fc58bfd9
commit 9a5d3e7b31
2 changed files with 12 additions and 2 deletions

View File

@@ -35,6 +35,7 @@ type CommandEnv struct {
MasterClient *wdclient.MasterClient
option *ShellOptions
locker *exclusive_locks.ExclusiveLocker
noLock bool
}
func NewCommandEnv(options *ShellOptions) *CommandEnv {
@@ -42,6 +43,7 @@ func NewCommandEnv(options *ShellOptions) *CommandEnv {
env: make(map[string]string),
MasterClient: wdclient.NewMasterClient(options.GrpcDialOption, *options.FilerGroup, pb.AdminShellClient, "", "", "", *pb.ServerAddresses(*options.Masters).ToServiceDiscovery()),
option: options,
noLock: false,
}
ce.locker = exclusive_locks.NewExclusiveLocker(ce.MasterClient, "shell")
return ce
@@ -79,6 +81,9 @@ func (ce *CommandEnv) isLocked() bool {
if ce == nil {
return true
}
if ce.noLock {
return false
}
return ce.locker.IsLocked()
}