From 528fc9220bec909a1d0867039f3e6382020bf0b0 Mon Sep 17 00:00:00 2001 From: Hongbing Wang <284734261@qq.com> Date: Thu, 1 Feb 2024 15:34:47 +0800 Subject: [PATCH] HDDS-10246. Remove KeyValueHandler.checkContainerIsHealthy to improve read performance (#6127) --- .../container/keyvalue/KeyValueHandler.java | 24 ------------------- 1 file changed, 24 deletions(-) diff --git a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java index 362c08c6a94..1501f862cf7 100644 --- a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java +++ b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/keyvalue/KeyValueHandler.java @@ -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(); @@ -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) { @@ -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(); @@ -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. */ @@ -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;