Skip to content

Commit

Permalink
HDFS-17705. Improve datasetlock related log output.
Browse files Browse the repository at this point in the history
  • Loading branch information
huangzhaobo99 committed Jan 4, 2025
1 parent 94d6a77 commit f307f49
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public AutoCloseDataSetLock readLock(LockLevel level, String... resources) {
AutoCloseDataSetLock dirLock = getReadLock(level, resources);
dirLock.setParentLock(volLock);
if (openLockTrace) {
LOG.debug("Sub lock " + resources[0] + resources[1] + resources[2] + " parent lock " +
LOG.info("Sub lock " + resources[0] + resources[1] + resources[2] + " parent lock " +
resources[0] + resources[1]);
}
return dirLock;
Expand All @@ -203,7 +203,7 @@ public AutoCloseDataSetLock writeLock(LockLevel level, String... resources) {
AutoCloseDataSetLock dirLock = getWriteLock(level, resources);
dirLock.setParentLock(volLock);
if (openLockTrace) {
LOG.debug("Sub lock " + resources[0] + resources[1] + resources[2] + " parent lock " +
LOG.info("Sub lock " + resources[0] + resources[1] + resources[2] + " parent lock " +
resources[0] + resources[1]);
}
return dirLock;
Expand Down Expand Up @@ -262,6 +262,9 @@ public void addLock(LockLevel level, String... resources) {
new ReentrantReadWriteLock(isFair));
lockMap.addLock(lockName, new ReentrantReadWriteLock(isFair));
}
if (openLockTrace) {
LOG.info("Added {} lock, lock name: {}", level.name(), lockName);
}
}

@Override
Expand All @@ -270,6 +273,9 @@ public void removeLock(LockLevel level, String... resources) {
try (AutoCloseDataSetLock lock = writeLock(level, resources)) {
lockMap.removeLock(lockName);
}
if (openLockTrace) {
LOG.info("Removed {} lock, lock name: {}", level.name(), lockName);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,6 @@ private synchronized void activateVolume(
List<String> allSubDirNameForDataSetLock = datasetSubLockStrategy.getAllSubLockName();
for (String dir : allSubDirNameForDataSetLock) {
lockManager.addLock(LockLevel.DIR, bp, ref.getVolume().getStorageID(), dir);
LOG.info("Added DIR lock for bpid:{}, volume storageid:{}, dir:{}",
bp, ref.getVolume().getStorageID(), dir);
}
}
DatanodeStorage dnStorage = storageMap.get(sd.getStorageUuid());
Expand Down Expand Up @@ -647,8 +645,6 @@ public void removeVolumes(
List<String> allSubDirNameForDataSetLock = datasetSubLockStrategy.getAllSubLockName();
for (String dir : allSubDirNameForDataSetLock) {
lockManager.removeLock(LockLevel.DIR, bp, storageUuid, dir);
LOG.info("Removed DIR lock for bpid:{}, volume storageid:{}, dir:{}",
bp, storageUuid, dir);
}
lockManager.removeLock(LockLevel.VOLUME, bp, storageUuid);
}
Expand Down Expand Up @@ -3300,8 +3296,6 @@ public void addBlockPool(String bpid, Configuration conf)
List<String> allSubDirNameForDataSetLock = datasetSubLockStrategy.getAllSubLockName();
for (String dir : allSubDirNameForDataSetLock) {
lockManager.addLock(LockLevel.DIR, bpid, v, dir);
LOG.info("Added DIR lock for bpid:{}, volume storageid:{}, dir:{}",
bpid, v, dir);
}
}
}
Expand Down

0 comments on commit f307f49

Please sign in to comment.