Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

allow lock with an existing lock

Chris Lueab970182314
diff --git a/weed/shell/exclusive_locker.go b/weed/shell/exclusive_locker.go
index f4938d3e63..33307785fa 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)