From d4235afe4daabc1bd15957c6bcd6fd442bd2f2a6 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Mon, 25 May 2020 18:39:53 -0700 Subject: [PATCH 1/3] support multiple locks --- weed/pb/master.proto | 2 + weed/pb/master_pb/master.pb.go | 315 +++++++++++++----------- weed/server/master_grpc_server_admin.go | 75 ++++-- weed/server/master_server.go | 4 +- weed/shell/exclusive_locker.go | 4 + 5 files changed, 234 insertions(+), 166 deletions(-) diff --git a/weed/pb/master.proto b/weed/pb/master.proto index 3b5636791..71a9c08b8 100644 --- a/weed/pb/master.proto +++ b/weed/pb/master.proto @@ -283,6 +283,7 @@ message ListMasterClientsResponse { message LeaseAdminTokenRequest { int64 previous_token = 1; int64 previous_lock_time = 2; + string lock_name = 3; } message LeaseAdminTokenResponse { int64 token = 1; @@ -292,6 +293,7 @@ message LeaseAdminTokenResponse { message ReleaseAdminTokenRequest { int64 previous_token = 1; int64 previous_lock_time = 2; + string lock_name = 3; } message ReleaseAdminTokenResponse { } diff --git a/weed/pb/master_pb/master.pb.go b/weed/pb/master_pb/master.pb.go index 80fc9fe49..4710b3d4c 100644 --- a/weed/pb/master_pb/master.pb.go +++ b/weed/pb/master_pb/master.pb.go @@ -1478,8 +1478,9 @@ func (m *ListMasterClientsResponse) GetGrpcAddresses() []string { } type LeaseAdminTokenRequest struct { - PreviousToken int64 `protobuf:"varint,1,opt,name=previous_token,json=previousToken" json:"previous_token,omitempty"` - PreviousLockTime int64 `protobuf:"varint,2,opt,name=previous_lock_time,json=previousLockTime" json:"previous_lock_time,omitempty"` + PreviousToken int64 `protobuf:"varint,1,opt,name=previous_token,json=previousToken" json:"previous_token,omitempty"` + PreviousLockTime int64 `protobuf:"varint,2,opt,name=previous_lock_time,json=previousLockTime" json:"previous_lock_time,omitempty"` + LockName string `protobuf:"bytes,3,opt,name=lock_name,json=lockName" json:"lock_name,omitempty"` } func (m *LeaseAdminTokenRequest) Reset() { *m = LeaseAdminTokenRequest{} } @@ -1501,6 +1502,13 @@ func (m *LeaseAdminTokenRequest) GetPreviousLockTime() int64 { return 0 } +func (m *LeaseAdminTokenRequest) GetLockName() string { + if m != nil { + return m.LockName + } + return "" +} + type LeaseAdminTokenResponse struct { Token int64 `protobuf:"varint,1,opt,name=token" json:"token,omitempty"` LockTsNs int64 `protobuf:"varint,2,opt,name=lock_ts_ns,json=lockTsNs" json:"lock_ts_ns,omitempty"` @@ -1526,8 +1534,9 @@ func (m *LeaseAdminTokenResponse) GetLockTsNs() int64 { } type ReleaseAdminTokenRequest struct { - PreviousToken int64 `protobuf:"varint,1,opt,name=previous_token,json=previousToken" json:"previous_token,omitempty"` - PreviousLockTime int64 `protobuf:"varint,2,opt,name=previous_lock_time,json=previousLockTime" json:"previous_lock_time,omitempty"` + PreviousToken int64 `protobuf:"varint,1,opt,name=previous_token,json=previousToken" json:"previous_token,omitempty"` + PreviousLockTime int64 `protobuf:"varint,2,opt,name=previous_lock_time,json=previousLockTime" json:"previous_lock_time,omitempty"` + LockName string `protobuf:"bytes,3,opt,name=lock_name,json=lockName" json:"lock_name,omitempty"` } func (m *ReleaseAdminTokenRequest) Reset() { *m = ReleaseAdminTokenRequest{} } @@ -1549,6 +1558,13 @@ func (m *ReleaseAdminTokenRequest) GetPreviousLockTime() int64 { return 0 } +func (m *ReleaseAdminTokenRequest) GetLockName() string { + if m != nil { + return m.LockName + } + return "" +} + type ReleaseAdminTokenResponse struct { } @@ -2138,150 +2154,151 @@ var _Seaweed_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("master.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 2320 bytes of a gzipped FileDescriptorProto + // 2334 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xd4, 0x59, 0x4b, 0x6f, 0x1c, 0xc7, - 0xf1, 0xd7, 0xee, 0xf2, 0xb1, 0x5b, 0xcb, 0x7d, 0x35, 0x29, 0x6a, 0xb9, 0x7a, 0x90, 0x1a, 0xdb, - 0x30, 0xa5, 0xbf, 0xff, 0x8c, 0x43, 0x1b, 0x88, 0x11, 0xc7, 0x30, 0x28, 0x8a, 0x56, 0x08, 0x91, - 0xb4, 0x34, 0x64, 0x64, 0xc0, 0x40, 0x30, 0xee, 0x9d, 0x69, 0x52, 0x03, 0xce, 0x2b, 0xd3, 0xbd, - 0x14, 0xd7, 0xb9, 0x04, 0xc8, 0x31, 0xa7, 0x20, 0x87, 0x7c, 0x85, 0x5c, 0x72, 0x4a, 0xce, 0xbe, - 0xe4, 0x1b, 0xe5, 0x92, 0x83, 0x2f, 0x41, 0xbf, 0x66, 0x7a, 0x66, 0x77, 0x49, 0xd3, 0x80, 0x03, - 0xe8, 0x36, 0x5d, 0x55, 0x5d, 0x5d, 0xf3, 0xab, 0xee, 0xaa, 0x5f, 0xcf, 0xc0, 0x52, 0x88, 0x29, - 0x23, 0xe9, 0x56, 0x92, 0xc6, 0x2c, 0x46, 0x0d, 0x39, 0x72, 0x92, 0xa1, 0xf5, 0xa7, 0x05, 0x68, - 0xfc, 0x9a, 0xe0, 0x94, 0x0d, 0x09, 0x66, 0xa8, 0x0d, 0x55, 0x3f, 0xe9, 0x57, 0x36, 0x2a, 0x9b, - 0x0d, 0xbb, 0xea, 0x27, 0x08, 0xc1, 0x5c, 0x12, 0xa7, 0xac, 0x5f, 0xdd, 0xa8, 0x6c, 0xb6, 0x6c, - 0xf1, 0x8c, 0xee, 0x03, 0x24, 0xa3, 0x61, 0xe0, 0xbb, 0xce, 0x28, 0x0d, 0xfa, 0x35, 0x61, 0xdb, - 0x90, 0x92, 0xdf, 0xa4, 0x01, 0xda, 0x84, 0x6e, 0x88, 0x2f, 0x9d, 0x8b, 0x38, 0x18, 0x85, 0xc4, - 0x71, 0xe3, 0x51, 0xc4, 0xfa, 0x73, 0x62, 0x7a, 0x3b, 0xc4, 0x97, 0xaf, 0x84, 0x78, 0x97, 0x4b, - 0xd1, 0x06, 0x8f, 0xea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 0xd7, 0xa0, 0x3f, 0xeb, 0x18, 0x88, 0xfa, 0xe0, 0x89, 0x57, 0x6f, 0xd9, 0x55, 0xdf, 0xe3, 0xe7, - 0x8f, 0x43, 0x22, 0xde, 0x75, 0xce, 0x16, 0xcf, 0xe8, 0x01, 0x80, 0x1b, 0x07, 0x01, 0x71, 0xf9, - 0x44, 0xf5, 0x92, 0x86, 0x84, 0x9f, 0x4f, 0x71, 0xe4, 0xf3, 0xd2, 0x30, 0x67, 0x37, 0xb8, 0x44, - 0x56, 0x85, 0x87, 0xb0, 0x24, 0xd3, 0xa7, 0x0c, 0x64, 0x55, 0x68, 0x4a, 0x99, 0x34, 0xf9, 0x00, - 0x90, 0xde, 0x26, 0xc3, 0x71, 0x66, 0xb8, 0x20, 0x0c, 0xbb, 0x4a, 0xf3, 0x64, 0xac, 0xad, 0xef, - 0x42, 0x23, 0x25, 0xd8, 0x73, 0xe2, 0x28, 0x18, 0x8b, 0x42, 0x51, 0xb7, 0xeb, 0x5c, 0xf0, 0x65, - 0x14, 0x8c, 0xd1, 0xff, 0x41, 0x2f, 0x25, 0x49, 0xe0, 0xbb, 0xd8, 0x49, 0x02, 0xec, 0x92, 0x90, - 0x44, 0xba, 0x66, 0x74, 0x95, 0xe2, 0x85, 0x96, 0xa3, 0x3e, 0x2c, 0x5e, 0x90, 0x94, 0xf2, 0xd7, - 0x6a, 0x08, 0x13, 0x3d, 0x44, 0x5d, 0xa8, 0x31, 0x16, 0xf4, 0x41, 0x48, 0xf9, 0x23, 0x7a, 0x04, - 0x5d, 0x37, 0x0e, 0x13, 0xec, 0x32, 0x27, 0x25, 0x17, 0xbe, 0x98, 0xd4, 0x14, 0xea, 0x8e, 0x92, - 0xdb, 0x4a, 0xcc, 0x5f, 0x27, 0x8c, 0x3d, 0xff, 0xd4, 0x27, 0x9e, 0x83, 0x99, 0x4a, 0xb6, 0x38, - 0xb8, 0x35, 0xbb, 0xab, 0x35, 0x3b, 0x4c, 0xa6, 0x19, 0x6d,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 0xc5, 0xd4, 0x02, 0xd4, 0xb7, 0x2f, 0x33, 0x31, 0xa3, 0x9f, 0x28, 0x1a, 0xa5, 0xe8, + 0x67, 0x15, 0xb8, 0x52, 0xf4, 0x33, 0xeb, 0x8e, 0x7d, 0x63, 0xb0, 0x20, 0x7e, 0xf4, 0x7e, 0xf0, + 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0x6d, 0x11, 0x8c, 0x9d, 0xf8, 0x1d, 0x00, 0x00, } diff --git a/weed/server/master_grpc_server_admin.go b/weed/server/master_grpc_server_admin.go index b986a93a2..7e7dcb36b 100644 --- a/weed/server/master_grpc_server_admin.go +++ b/weed/server/master_grpc_server_admin.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "math/rand" + "sync" "time" "github.com/chrislusf/seaweedfs/weed/pb/master_pb" @@ -56,13 +57,66 @@ const ( LockDuration = 10 * time.Second ) +type AdminLock struct { + accessSecret int64 + accessLockTime time.Time +} + +type AdminLocks struct { + locks map[string]*AdminLock + sync.RWMutex +} + +func NewAdminLocks() *AdminLocks { + return &AdminLocks{ + locks: make(map[string]*AdminLock), + } +} + +func (locks *AdminLocks) isLocked(lockName string) bool { + locks.RLock() + defer locks.RUnlock() + adminLock, found := locks.locks[lockName] + if !found { + return false + } + return adminLock.accessLockTime.Add(LockDuration).After(time.Now()) +} + +func (locks *AdminLocks) isValidToken(lockName string, ts time.Time, token int64) bool { + locks.RLock() + defer locks.RUnlock() + adminLock, found := locks.locks[lockName] + if !found { + return false + } + return adminLock.accessLockTime.Equal(ts) && adminLock.accessSecret == token +} + +func (locks *AdminLocks) generateToken(lockName string) (ts time.Time, token int64) { + locks.Lock() + defer locks.Unlock() + lock := &AdminLock{ + accessSecret: rand.Int63(), + accessLockTime: time.Now(), + } + locks.locks[lockName] = lock + return lock.accessLockTime, lock.accessSecret +} + +func (locks *AdminLocks) deleteLock(lockName string) { + locks.Lock() + defer locks.Unlock() + delete(locks.locks, lockName) +} + func (ms *MasterServer) LeaseAdminToken(ctx context.Context, req *master_pb.LeaseAdminTokenRequest) (*master_pb.LeaseAdminTokenResponse, error) { resp := &master_pb.LeaseAdminTokenResponse{} - if ms.adminAccessSecret != 0 && ms.adminAccessLockTime.Add(LockDuration).After(time.Now()) { - if req.PreviousToken != 0 && ms.isValidToken(time.Unix(0, req.PreviousLockTime), req.PreviousToken) { + if ms.adminLocks.isLocked(req.LockName) { + if req.PreviousToken != 0 && ms.adminLocks.isValidToken(req.LockName, time.Unix(0, req.PreviousLockTime), req.PreviousToken) { // for renew - ts, token := ms.generateToken() + ts, token := ms.adminLocks.generateToken(req.LockName) resp.Token, resp.LockTsNs = token, ts.UnixNano() return resp, nil } @@ -70,24 +124,15 @@ func (ms *MasterServer) LeaseAdminToken(ctx context.Context, req *master_pb.Leas return resp, fmt.Errorf("already locked") } // for fresh lease request - ts, token := ms.generateToken() + ts, token := ms.adminLocks.generateToken(req.LockName) resp.Token, resp.LockTsNs = token, ts.UnixNano() return resp, nil } -func (ms *MasterServer) isValidToken(ts time.Time, token int64) bool { - return ms.adminAccessLockTime.Equal(ts) && ms.adminAccessSecret == token -} -func (ms *MasterServer) generateToken() (ts time.Time, token int64) { - ms.adminAccessLockTime = time.Now() - ms.adminAccessSecret = rand.Int63() - return ms.adminAccessLockTime, ms.adminAccessSecret -} - func (ms *MasterServer) ReleaseAdminToken(ctx context.Context, req *master_pb.ReleaseAdminTokenRequest) (*master_pb.ReleaseAdminTokenResponse, error) { resp := &master_pb.ReleaseAdminTokenResponse{} - if ms.isValidToken(time.Unix(0, req.PreviousLockTime), req.PreviousToken) { - ms.adminAccessSecret = 0 + if ms.adminLocks.isValidToken(req.LockName, time.Unix(0, req.PreviousLockTime), req.PreviousToken) { + ms.adminLocks.deleteLock(req.LockName) } return resp, nil } diff --git a/weed/server/master_server.go b/weed/server/master_server.go index 53ac7b2e2..dc3ef9cfc 100644 --- a/weed/server/master_server.go +++ b/weed/server/master_server.go @@ -66,8 +66,7 @@ type MasterServer struct { MasterClient *wdclient.MasterClient - adminAccessSecret int64 - adminAccessLockTime time.Time + adminLocks *AdminLocks } func NewMasterServer(r *mux.Router, option *MasterOption, peers []string) *MasterServer { @@ -96,6 +95,7 @@ func NewMasterServer(r *mux.Router, option *MasterOption, peers []string) *Maste clientChans: make(map[string]chan *master_pb.VolumeLocation), grpcDialOption: grpcDialOption, MasterClient: wdclient.NewMasterClient(grpcDialOption, "master", option.Host, 0, peers), + adminLocks: NewAdminLocks(), } ms.bounedLeaderChan = make(chan int, 16) 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 }) From 5d3ec22975637b0620acf26702efe45888c74e77 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 26 May 2020 00:03:31 -0700 Subject: [PATCH 2/3] refactoring --- weed/shell/commands.go | 7 ++++--- .../exclusive_locks}/exclusive_locker.go | 9 ++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) rename weed/{shell => wdclient/exclusive_locks}/exclusive_locker.go (95%) diff --git a/weed/shell/commands.go b/weed/shell/commands.go index b7ca5d268..f61ed9f82 100644 --- a/weed/shell/commands.go +++ b/weed/shell/commands.go @@ -13,6 +13,7 @@ import ( "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" "github.com/chrislusf/seaweedfs/weed/util" "github.com/chrislusf/seaweedfs/weed/wdclient" + "github.com/chrislusf/seaweedfs/weed/wdclient/exclusive_locks" ) type ShellOptions struct { @@ -28,7 +29,7 @@ type CommandEnv struct { env map[string]string MasterClient *wdclient.MasterClient option ShellOptions - locker *ExclusiveLocker + locker *exclusive_locks.ExclusiveLocker } type command interface { @@ -47,7 +48,7 @@ func NewCommandEnv(options ShellOptions) *CommandEnv { MasterClient: wdclient.NewMasterClient(options.GrpcDialOption, pb.AdminShellClient, "", 0, strings.Split(*options.Masters, ",")), option: options, } - ce.locker = NewExclusiveLocker(ce.MasterClient) + ce.locker = exclusive_locks.NewExclusiveLocker(ce.MasterClient) return ce } @@ -70,7 +71,7 @@ func (ce *CommandEnv) isDirectory(path string) bool { func (ce *CommandEnv) confirmIsLocked() error { - if ce.locker.isLocking { + if ce.locker.IsLocking() { return nil } diff --git a/weed/shell/exclusive_locker.go b/weed/wdclient/exclusive_locks/exclusive_locker.go similarity index 95% rename from weed/shell/exclusive_locker.go rename to weed/wdclient/exclusive_locks/exclusive_locker.go index fa1f9ab5d..67823e7f4 100644 --- a/weed/shell/exclusive_locker.go +++ b/weed/wdclient/exclusive_locks/exclusive_locker.go @@ -1,4 +1,4 @@ -package shell +package exclusive_locks import ( "context" @@ -29,6 +29,9 @@ func NewExclusiveLocker(masterClient *wdclient.MasterClient) *ExclusiveLocker { masterClient: masterClient, } } +func (l *ExclusiveLocker) IsLocking() bool { + return l.isLocking +} func (l *ExclusiveLocker) GetToken() (token int64, lockTsNs int64) { for time.Unix(0, atomic.LoadInt64(&l.lockTsNs)).Add(SafeRenewInteval).Before(time.Now()) { @@ -39,6 +42,10 @@ func (l *ExclusiveLocker) GetToken() (token int64, lockTsNs int64) { } func (l *ExclusiveLocker) RequestLock() { + if l.isLocking { + return + } + // retry to get the lease for { if err := l.masterClient.WithClient(func(client master_pb.SeaweedClient) error { From ef2b3a0801ba1a56f97460a591957942c194942d Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 26 May 2020 00:03:44 -0700 Subject: [PATCH 3/3] leveldb recover error handling --- weed/filer2/leveldb/leveldb_store.go | 6 ++++-- weed/storage/needle_map_leveldb.go | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/weed/filer2/leveldb/leveldb_store.go b/weed/filer2/leveldb/leveldb_store.go index 675b6e19d..31919ca49 100644 --- a/weed/filer2/leveldb/leveldb_store.go +++ b/weed/filer2/leveldb/leveldb_store.go @@ -53,8 +53,10 @@ func (store *LevelDBStore) initialize(dir string) (err error) { if errors.IsCorrupted(err) { store.db, err = leveldb.RecoverFile(dir, opts) } - glog.Infof("filer store open dir %s: %v", dir, err) - return + if err != nil { + glog.Infof("filer store open dir %s: %v", dir, err) + return + } } return } diff --git a/weed/storage/needle_map_leveldb.go b/weed/storage/needle_map_leveldb.go index ee223425e..63485522d 100644 --- a/weed/storage/needle_map_leveldb.go +++ b/weed/storage/needle_map_leveldb.go @@ -38,7 +38,9 @@ func NewLevelDbNeedleMap(dbFileName string, indexFile *os.File, opts *opt.Option if errors.IsCorrupted(err) { m.db, err = leveldb.RecoverFile(dbFileName, opts) } - return + if err != nil { + return + } } glog.V(1).Infof("Loading %s...", indexFile.Name()) mm, indexLoadError := newNeedleMapMetricFromIndexFile(indexFile)