diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-04-22 23:56:35 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-04-22 23:56:35 -0700 |
| commit | f0ad172e80e00222bb0ea9a31cb83fdd7e7844a8 (patch) | |
| tree | cbc78fc1509863e8ea93f27306bc58f4e8faedde /weed/wdclient | |
| parent | 89eb9f6e7073460838699b9c3a42f2cb830f8224 (diff) | |
| download | seaweedfs-f0ad172e80e00222bb0ea9a31cb83fdd7e7844a8.tar.xz seaweedfs-f0ad172e80e00222bb0ea9a31cb83fdd7e7844a8.zip | |
shell: show which server holds the lock
fix https://github.com/chrislusf/seaweedfs/issues/1983
Diffstat (limited to 'weed/wdclient')
| -rw-r--r-- | weed/wdclient/exclusive_locks/exclusive_locker.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/weed/wdclient/exclusive_locks/exclusive_locker.go b/weed/wdclient/exclusive_locks/exclusive_locker.go index d477a6b2d..5b5fa2704 100644 --- a/weed/wdclient/exclusive_locks/exclusive_locker.go +++ b/weed/wdclient/exclusive_locks/exclusive_locker.go @@ -41,7 +41,7 @@ func (l *ExclusiveLocker) GetToken() (token int64, lockTsNs int64) { return atomic.LoadInt64(&l.token), atomic.LoadInt64(&l.lockTsNs) } -func (l *ExclusiveLocker) RequestLock() { +func (l *ExclusiveLocker) RequestLock(clientName string) { if l.isLocking { return } @@ -56,6 +56,7 @@ func (l *ExclusiveLocker) RequestLock() { PreviousToken: atomic.LoadInt64(&l.token), PreviousLockTime: atomic.LoadInt64(&l.lockTsNs), LockName: AdminLockName, + ClientName: clientName, }) if err == nil { atomic.StoreInt64(&l.token, resp.Token) @@ -63,7 +64,7 @@ func (l *ExclusiveLocker) RequestLock() { } return err }); err != nil { - // println("leasing problem", err.Error()) + println("lock:", err.Error()) time.Sleep(InitLockInteval) } else { break @@ -83,6 +84,7 @@ func (l *ExclusiveLocker) RequestLock() { PreviousToken: atomic.LoadInt64(&l.token), PreviousLockTime: atomic.LoadInt64(&l.lockTsNs), LockName: AdminLockName, + ClientName: clientName, }) if err == nil { atomic.StoreInt64(&l.token, resp.Token) |
