You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ad...@apache.org on 2022/10/15 07:05:22 UTC

[ozone] branch master updated: HDDS-7303. EC: ECBlockReconstructedStripeInputStream should set initialized only at the end of init() (#3816)

This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 35eedb6b36 HDDS-7303. EC: ECBlockReconstructedStripeInputStream should set initialized only at the end of init() (#3816)
35eedb6b36 is described below

commit 35eedb6b3639c7cfed4b3b8db86b922719be5c2d
Author: Stephen O'Donnell <st...@gmail.com>
AuthorDate: Sat Oct 15 08:05:16 2022 +0100

    HDDS-7303. EC: ECBlockReconstructedStripeInputStream should set initialized only at the end of init() (#3816)
---
 .../client/io/ECBlockReconstructedStripeInputStream.java     | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/hadoop-hdds/client/src/main/java/org/apache/hadoop/ozone/client/io/ECBlockReconstructedStripeInputStream.java b/hadoop-hdds/client/src/main/java/org/apache/hadoop/ozone/client/io/ECBlockReconstructedStripeInputStream.java
index cfe612cc2f..537f40d306 100644
--- a/hadoop-hdds/client/src/main/java/org/apache/hadoop/ozone/client/io/ECBlockReconstructedStripeInputStream.java
+++ b/hadoop-hdds/client/src/main/java/org/apache/hadoop/ozone/client/io/ECBlockReconstructedStripeInputStream.java
@@ -212,12 +212,14 @@ public class ECBlockReconstructedStripeInputStream extends ECBlockInputStream {
   }
 
   private void init() throws InsufficientLocationsException {
+    initialized = false;
     if (decoder == null) {
       decoder = CodecUtil.createRawDecoderWithFallback(getRepConfig());
     }
     if (!hasSufficientLocations()) {
-      throw new InsufficientLocationsException("There are insufficient " +
-          "datanodes to read the EC block");
+      String msg = "There are insufficient datanodes to read the EC block";
+      LOG.debug(msg);
+      throw new InsufficientLocationsException(msg);
     }
     allocateInternalBuffers();
     if (!isOfflineRecovery()) {
@@ -365,9 +367,6 @@ public class ECBlockReconstructedStripeInputStream extends ECBlockInputStream {
         loadDataBuffersFromStream();
         break;
       } catch (IOException e) {
-        // Re-init now the bad block has been excluded. If we have ran out of
-        // locations, init will throw an InsufficientLocations exception.
-        init();
         // seek to the current position so it rewinds any blocks we read
         // already.
         seek(getPos());
@@ -375,6 +374,9 @@ public class ECBlockReconstructedStripeInputStream extends ECBlockInputStream {
         for (ByteBuffer b : bufs) {
           b.position(0);
         }
+        // Re-init now the bad block has been excluded. If we have run out of
+        // locations, init will throw an InsufficientLocations exception.
+        init();
       } catch (InterruptedException ie) {
         Thread.currentThread().interrupt();
         throw new IOException("Interrupted waiting for reads to complete", ie);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org