aboutsummaryrefslogtreecommitdiff
path: root/weed/shell
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2020-05-25 18:39:53 -0700
committerChris Lu <chris.lu@gmail.com>2020-05-25 18:39:53 -0700
commitd4235afe4daabc1bd15957c6bcd6fd442bd2f2a6 (patch)
tree5f85762edd37321d665e4ebf3e03e49369b1f12f /weed/shell
parentbf86e38f9a148e20ac7ab8d178c643593dcf563f (diff)
downloadseaweedfs-d4235afe4daabc1bd15957c6bcd6fd442bd2f2a6.tar.xz
seaweedfs-d4235afe4daabc1bd15957c6bcd6fd442bd2f2a6.zip
support multiple locks
Diffstat (limited to 'weed/shell')
-rw-r--r--weed/shell/exclusive_locker.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/weed/shell/exclusive_locker.go b/weed/shell/exclusive_locker.go
index ab037efb7..fa1f9ab5d 100644
--- a/weed/shell/exclusive_locker.go
+++ b/weed/shell/exclusive_locker.go
@@ -14,6 +14,7 @@ const (
RenewInteval = 4 * time.Second
SafeRenewInteval = 3 * time.Second
InitLockInteval = 1 * time.Second
+ AdminLockName = "admin"
)
type ExclusiveLocker struct {
@@ -44,6 +45,7 @@ func (l *ExclusiveLocker) RequestLock() {
resp, err := client.LeaseAdminToken(context.Background(), &master_pb.LeaseAdminTokenRequest{
PreviousToken: atomic.LoadInt64(&l.token),
PreviousLockTime: atomic.LoadInt64(&l.lockTsNs),
+ LockName: AdminLockName,
})
if err == nil {
atomic.StoreInt64(&l.token, resp.Token)
@@ -67,6 +69,7 @@ func (l *ExclusiveLocker) RequestLock() {
resp, err := client.LeaseAdminToken(context.Background(), &master_pb.LeaseAdminTokenRequest{
PreviousToken: atomic.LoadInt64(&l.token),
PreviousLockTime: atomic.LoadInt64(&l.lockTsNs),
+ LockName: AdminLockName,
})
if err == nil {
atomic.StoreInt64(&l.token, resp.Token)
@@ -92,6 +95,7 @@ func (l *ExclusiveLocker) ReleaseLock() {
client.ReleaseAdminToken(context.Background(), &master_pb.ReleaseAdminTokenRequest{
PreviousToken: atomic.LoadInt64(&l.token),
PreviousLockTime: atomic.LoadInt64(&l.lockTsNs),
+ LockName: AdminLockName,
})
return nil
})