Skip to content

Commit

Permalink
HDFS-17724: Set recover.lease.on.close.exception as an instance membe…
Browse files Browse the repository at this point in the history
…r in the DfsClientConf.java

Closes #7348

Signed-off-by: Chris Nauroth <cnauroth@apache.org>
  • Loading branch information
Abhey Rana authored and cnauroth committed Feb 7, 2025
1 parent cfe76e4 commit 755fa74
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -745,6 +751,10 @@ public int getMaxPipelineRecoveryRetries() {
return maxPipelineRecoveryRetries;
}

public boolean getRecoverLeaseOnCloseException() {
return recoverLeaseOnCloseException;
}

/**
* Configuration for short-circuit reads.
*/
Expand Down

0 comments on commit 755fa74

Please sign in to comment.