From aa5c6c172df308b4aff7dad1054e6f352c006cbe Mon Sep 17 00:00:00 2001 From: Dave Marion Date: Tue, 17 Mar 2026 19:50:38 +0000 Subject: [PATCH] Close block readers in DFSStripedInputStream on EC read exception Replaced calls to dfsStripedInputStream.close() with calls to dfsStripedInputStream.closeCurrentBlockReaders() in StripeReader. Closing the input stream from the StripeReader causes issues with the retry functionality added in HDFS-17811. Closing the block readers may still help the issue identified in HDFS-17080. --- .../main/java/org/apache/hadoop/hdfs/StripeReader.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/StripeReader.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/StripeReader.java index bc39bace79588..9705a9c45b3d6 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/StripeReader.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/StripeReader.java @@ -198,7 +198,7 @@ private void readDataForDecoding() throws IOException { checkMissingBlocks(); } - void readParityChunks(int num) throws IOException { + private void readParityChunks(int num) throws IOException { for (int i = dataBlkNum, j = 0; i < dataBlkNum + parityBlkNum && j < num; i++) { if (alignedStripe.chunks[i] == null) { @@ -298,7 +298,7 @@ private Callable readCells(final BlockReader reader, }; } - boolean readChunk(final LocatedBlock block, int chunkIndex) + private boolean readChunk(final LocatedBlock block, int chunkIndex) throws IOException { final StripingChunk chunk = alignedStripe.chunks[chunkIndex]; if (block == null) { @@ -353,7 +353,7 @@ void readStripe() throws IOException { readParityChunks(alignedStripe.missingChunksNum); } } catch (IOException e) { - dfsStripedInputStream.close(); + dfsStripedInputStream.closeCurrentBlockReaders(); throw e; } // TODO: for a full stripe we can start reading (dataBlkNum + 1) chunks @@ -397,7 +397,7 @@ void readStripe() throws IOException { } catch (InterruptedException ie) { String err = "Read request interrupted"; DFSClient.LOG.error(err, ie); - dfsStripedInputStream.close(); + dfsStripedInputStream.closeCurrentBlockReaders(); clearFutures(); // Don't decode if read interrupted throw new InterruptedIOException(err);