aboutsummaryrefslogtreecommitdiff
path: root/weed/util/lock_table.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2023-09-21 11:04:12 -0700
committerchrislu <chris.lu@gmail.com>2023-09-21 11:04:12 -0700
commit76698522419902303117d3f736a619b8c01c60f4 (patch)
treecfdfc56ba4d5ed4247134a2d4421edfc70c78d5b /weed/util/lock_table.go
parente3b1bacf3fa0467d836ccd5ed0096146f2afbb07 (diff)
downloadseaweedfs-76698522419902303117d3f736a619b8c01c60f4.tar.xz
seaweedfs-76698522419902303117d3f736a619b8c01c60f4.zip
adjust logs
Diffstat (limited to 'weed/util/lock_table.go')
-rw-r--r--weed/util/lock_table.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/weed/util/lock_table.go b/weed/util/lock_table.go
index 32d98bea3..015e424f9 100644
--- a/weed/util/lock_table.go
+++ b/weed/util/lock_table.go
@@ -2,6 +2,7 @@ package util
import (
"fmt"
+ "github.com/seaweedfs/seaweedfs/weed/glog"
"sync"
"sync/atomic"
)
@@ -63,7 +64,7 @@ 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 {
- 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)
+ 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 len(entry.waiters) > 0 {
for _, waiter := range entry.waiters {
fmt.Printf(" %d", waiter.ID)
@@ -90,7 +91,7 @@ func (lt *LockTable[T]) AcquireLock(intention string, key T, lockType LockType)
// Otherwise, grant the lock
entry.lockType = lockType
- 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)
+ 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 len(entry.waiters) > 0 {
for _, waiter := range entry.waiters {
fmt.Printf(" %d", waiter.ID)
@@ -128,7 +129,7 @@ func (lt *LockTable[T]) ReleaseLock(key T, lock *ActiveLock) {
delete(lt.locks, key)
}
- 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)
+ 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)