Skip to content

Commit

Permalink
HDDS-10246. Remove readLock from KeyValueHandler.checkContainerIsHealthy
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghongbing committed Jan 30, 2024
1 parent 1e6e6d1 commit bd1cf68
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -749,14 +749,10 @@ ContainerCommandResponseProto handleReadChunk(
@VisibleForTesting
void checkContainerIsHealthy(KeyValueContainer kvContainer, BlockID blockID,
Type cmd) {
kvContainer.readLock();
try {
if (kvContainer.getContainerData().getState() == State.UNHEALTHY) {
LOG.warn("{} request {} for UNHEALTHY container {} replica", cmd,
blockID, kvContainer.getContainerData().getContainerID());
}
} finally {
kvContainer.readUnlock();
// No kvContainer.readLock() for performance optimization
if (kvContainer.getContainerData().getState() == State.UNHEALTHY) {
LOG.warn("{} request {} for UNHEALTHY container {} replica", cmd,
blockID, kvContainer.getContainerData().getContainerID());
}
}

Expand Down

0 comments on commit bd1cf68

Please sign in to comment.