Skip to content

Commit

Permalink
HDDS-10246. Remove KeyValueHandler.checkContainerIsHealthy to improve…
Browse files Browse the repository at this point in the history
… read performance (#6127)
  • Loading branch information
whbing authored Feb 1, 2024
1 parent baae750 commit 528fc92
Showing 1 changed file with 0 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,6 @@ ContainerCommandResponseProto handleGetBlock(
try {
BlockID blockID = BlockID.getFromProtobuf(
request.getGetBlock().getBlockID());
checkContainerIsHealthy(kvContainer, blockID, Type.GetBlock);
responseData = blockManager.getBlock(kvContainer, blockID)
.getProtoBufMessage();
final long numBytes = responseData.getSerializedSize();
Expand Down Expand Up @@ -615,8 +614,6 @@ ContainerCommandResponseProto handleGetCommittedBlockLength(
try {
BlockID blockID = BlockID
.getFromProtobuf(request.getGetCommittedBlockLength().getBlockID());
checkContainerIsHealthy(kvContainer, blockID,
Type.GetCommittedBlockLength);
BlockUtils.verifyBCSId(kvContainer, blockID);
blockLength = blockManager.getCommittedBlockLength(kvContainer, blockID);
} catch (StorageContainerException ex) {
Expand Down Expand Up @@ -703,7 +700,6 @@ ContainerCommandResponseProto handleReadChunk(
.getChunkData());
Preconditions.checkNotNull(chunkInfo);

checkContainerIsHealthy(kvContainer, blockID, Type.ReadChunk);
BlockUtils.verifyBCSId(kvContainer, blockID);
if (dispatcherContext == null) {
dispatcherContext = DispatcherContext.getHandleReadChunk();
Expand Down Expand Up @@ -741,25 +737,6 @@ ContainerCommandResponseProto handleReadChunk(
return getReadChunkResponse(request, data, byteBufferToByteString);
}

/**
* Throw an exception if the container is unhealthy.
*
* @throws StorageContainerException if the container is unhealthy.
*/
@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();
}
}

/**
* Handle Delete Chunk operation. Calls ChunkManager to process the request.
*/
Expand Down Expand Up @@ -923,7 +900,6 @@ ContainerCommandResponseProto handleGetSmallFile(
try {
BlockID blockID = BlockID.getFromProtobuf(getSmallFileReq.getBlock()
.getBlockID());
checkContainerIsHealthy(kvContainer, blockID, Type.GetSmallFile);
BlockData responseData = blockManager.getBlock(kvContainer, blockID);

ContainerProtos.ChunkInfo chunkInfoProto = null;
Expand Down

0 comments on commit 528fc92

Please sign in to comment.