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

cnauroth pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 755fa7482bf HDFS-17724: Set recover.lease.on.close.exception as an 
instance member in the DfsClientConf.java
755fa7482bf is described below

commit 755fa7482bf69f3e66187e13b61f5a22cf41be64
Author: Abhey Rana <a.r...@salesforce.com>
AuthorDate: Fri Feb 7 23:39:58 2025 +0000

    HDFS-17724: Set recover.lease.on.close.exception as an instance member in 
the DfsClientConf.java
    
    Closes #7348
    
    Signed-off-by: Chris Nauroth <cnaur...@apache.org>
---
 .../java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java    |  7 +------
 .../java/org/apache/hadoop/hdfs/client/impl/DfsClientConf.java | 10 ++++++++++
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java
index 8320cc9a408..a6f703fcd43 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/DFSStripedOutputStream.java
@@ -73,9 +73,6 @@
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
 
-import static 
org.apache.hadoop.hdfs.client.HdfsClientConfigKeys.Write.RECOVER_LEASE_ON_CLOSE_EXCEPTION_DEFAULT;
-import static 
org.apache.hadoop.hdfs.client.HdfsClientConfigKeys.Write.RECOVER_LEASE_ON_CLOSE_EXCEPTION_KEY;
-
 /**
  * This class supports writing files in striped layout and erasure coded 
format.
  * Each stripe contains a sequence of cells.
@@ -1200,9 +1197,7 @@ void setClosed() {
 
   @Override
   protected synchronized void closeImpl() throws IOException {
-    boolean recoverLeaseOnCloseException = dfsClient.getConfiguration()
-        .getBoolean(RECOVER_LEASE_ON_CLOSE_EXCEPTION_KEY,
-            RECOVER_LEASE_ON_CLOSE_EXCEPTION_DEFAULT);
+    boolean recoverLeaseOnCloseException = 
dfsClient.getConf().getRecoverLeaseOnCloseException();
     try {
       if (isClosed()) {
         exceptionLastSeen.check(true);
diff --git 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/DfsClientConf.java
 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/DfsClientConf.java
index 445612f2f83..dfc89adeab3 100644
--- 
a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/DfsClientConf.java
+++ 
b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/client/impl/DfsClientConf.java
@@ -166,6 +166,7 @@ public class DfsClientConf {
 
   private final boolean deadNodeDetectionEnabled;
   private final long leaseHardLimitPeriod;
+  private final boolean recoverLeaseOnCloseException;
 
   public DfsClientConf(Configuration conf) {
     // The hdfsTimeout is currently the same as the ipc timeout
@@ -315,6 +316,11 @@ public DfsClientConf(Configuration conf) {
         HdfsClientConfigKeys.DFS_CLIENT_PIPELINE_RECOVERY_MAX_RETRIES,
         HdfsClientConfigKeys.DFS_CLIENT_PIPELINE_RECOVERY_MAX_RETRIES_DEFAULT
     );
+
+    recoverLeaseOnCloseException = conf.getBoolean(
+        Write.RECOVER_LEASE_ON_CLOSE_EXCEPTION_KEY,
+        Write.RECOVER_LEASE_ON_CLOSE_EXCEPTION_DEFAULT
+    );
   }
 
   private ByteArrayManager.Conf loadWriteByteArrayManagerConf(
@@ -745,6 +751,10 @@ public int getMaxPipelineRecoveryRetries() {
     return maxPipelineRecoveryRetries;
   }
 
+  public boolean getRecoverLeaseOnCloseException() {
+    return recoverLeaseOnCloseException;
+  }
+
   /**
    * Configuration for short-circuit reads.
    */


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-commits-h...@hadoop.apache.org

Reply via email to