diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-04-23 03:35:52 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-04-23 03:35:52 -0700 |
| commit | eab9701823145043fc3fd107caec9fb76c57d651 (patch) | |
| tree | caaaa3a96af20b0e2a045d6061f0f3c3526e50c7 | |
| parent | 842e3301ee3bb72ba513454c8a68df4b6ed72849 (diff) | |
| download | seaweedfs-eab9701823145043fc3fd107caec9fb76c57d651.tar.xz seaweedfs-eab9701823145043fc3fd107caec9fb76c57d651.zip | |
allow lock with an existing lock
| -rw-r--r-- | weed/shell/exclusive_locker.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/weed/shell/exclusive_locker.go b/weed/shell/exclusive_locker.go index f4938d3e6..33307785f 100644 --- a/weed/shell/exclusive_locker.go +++ b/weed/shell/exclusive_locker.go @@ -41,7 +41,10 @@ func (l *ExclusiveLocker) RequestLock() { // retry to get the lease for { if err := l.masterClient.WithClient(func(client master_pb.SeaweedClient) error { - resp, err := client.LeaseAdminToken(context.Background(), &master_pb.LeaseAdminTokenRequest{}) + resp, err := client.LeaseAdminToken(context.Background(), &master_pb.LeaseAdminTokenRequest{ + PreviousToken: atomic.LoadInt64(&l.token), + PreviousLockTime: atomic.LoadInt64(&l.lockTsNs), + }) if err == nil { atomic.StoreInt64(&l.token, resp.Token) atomic.StoreInt64(&l.lockTsNs, resp.LockTsNs) |
