diff options
| author | chrislu <chris.lu@gmail.com> | 2023-09-21 23:51:32 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2023-09-21 23:51:32 -0700 |
| commit | 2df70ce95f2a6840b7a70fde38c25c72132924e1 (patch) | |
| tree | 07f025e1b17159a30cb864af8f62a57e7e0202b1 /weed/util/lock_table.go | |
| parent | 3e234216081c09185f3dfc652140d47956ae912a (diff) | |
| download | seaweedfs-2df70ce95f2a6840b7a70fde38c25c72132924e1.tar.xz seaweedfs-2df70ce95f2a6840b7a70fde38c25c72132924e1.zip | |
adjust logs
Diffstat (limited to 'weed/util/lock_table.go')
| -rw-r--r-- | weed/util/lock_table.go | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/weed/util/lock_table.go b/weed/util/lock_table.go index 1a4f029f8..d10b51334 100644 --- a/weed/util/lock_table.go +++ b/weed/util/lock_table.go @@ -64,12 +64,14 @@ func (lt *LockTable[T]) AcquireLock(intention string, key T, lockType LockType) // If the lock is held exclusively, wait entry.mu.Lock() if len(entry.waiters) > 0 || lockType == ExclusiveLock { - glog.V(4).Infof("ActiveLock %d %s wait for %+v type=%v with waiters %d active %d.\n", lock.ID, lock.intention, key, lockType, len(entry.waiters), entry.activeLockOwnerCount) - if glog.V(4) && len(entry.waiters) > 0 { - for _, waiter := range entry.waiters { - fmt.Printf(" %d", waiter.ID) + if glog.V(4) { + fmt.Printf("ActiveLock %d %s wait for %+v type=%v with waiters %d active %d.\n", lock.ID, lock.intention, key, lockType, len(entry.waiters), entry.activeLockOwnerCount) + if len(entry.waiters) > 0 { + for _, waiter := range entry.waiters { + fmt.Printf(" %d", waiter.ID) + } + fmt.Printf("\n") } - fmt.Printf("\n") } entry.waiters = append(entry.waiters, lock) if lockType == ExclusiveLock { @@ -91,12 +93,14 @@ func (lt *LockTable[T]) AcquireLock(intention string, key T, lockType LockType) // Otherwise, grant the lock entry.lockType = lockType - glog.V(4).Infof("ActiveLock %d %s locked %+v type=%v with waiters %d active %d.\n", lock.ID, lock.intention, key, lockType, len(entry.waiters), entry.activeLockOwnerCount) - if glog.V(4) && len(entry.waiters) > 0 { - for _, waiter := range entry.waiters { - fmt.Printf(" %d", waiter.ID) + if glog.V(4) { + fmt.Printf("ActiveLock %d %s locked %+v type=%v with waiters %d active %d.\n", lock.ID, lock.intention, key, lockType, len(entry.waiters), entry.activeLockOwnerCount) + if len(entry.waiters) > 0 { + for _, waiter := range entry.waiters { + fmt.Printf(" %d", waiter.ID) + } + fmt.Printf("\n") } - fmt.Printf("\n") } entry.mu.Unlock() @@ -129,12 +133,14 @@ func (lt *LockTable[T]) ReleaseLock(key T, lock *ActiveLock) { delete(lt.locks, key) } - glog.V(4).Infof("ActiveLock %d %s unlocked %+v type=%v with waiters %d active %d.\n", lock.ID, lock.intention, key, entry.lockType, len(entry.waiters), entry.activeLockOwnerCount) - if len(entry.waiters) > 0 { - for _, waiter := range entry.waiters { - fmt.Printf(" %d", waiter.ID) + if glog.V(4) { + fmt.Printf("ActiveLock %d %s unlocked %+v type=%v with waiters %d active %d.\n", lock.ID, lock.intention, key, entry.lockType, len(entry.waiters), entry.activeLockOwnerCount) + if len(entry.waiters) > 0 { + for _, waiter := range entry.waiters { + fmt.Printf(" %d", waiter.ID) + } + fmt.Printf("\n") } - fmt.Printf("\n") } entry.activeLockOwnerCount-- |
