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

dlmarion pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new 6152686cfe Use new LeaseRecoverable interface added in HADOOP-18671 
(#5241)
6152686cfe is described below

commit 6152686cfe3f71c042be5433d639226208a03501
Author: Dave Marion <[email protected]>
AuthorDate: Mon Jul 20 12:38:11 2026 -0400

    Use new LeaseRecoverable interface added in HADOOP-18671 (#5241)
    
    This change uses FileSystem.hasPathCapability to determine if the
    FileSystem implementation has the ability to recover leases.
    
    Closes #3494
---
 .../accumulo/server/manager/recovery/HadoopLogCloser.java     | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git 
a/server/base/src/main/java/org/apache/accumulo/server/manager/recovery/HadoopLogCloser.java
 
b/server/base/src/main/java/org/apache/accumulo/server/manager/recovery/HadoopLogCloser.java
index 1f9f101f3c..2c0409b80c 100644
--- 
a/server/base/src/main/java/org/apache/accumulo/server/manager/recovery/HadoopLogCloser.java
+++ 
b/server/base/src/main/java/org/apache/accumulo/server/manager/recovery/HadoopLogCloser.java
@@ -25,12 +25,13 @@ import org.apache.accumulo.core.conf.AccumuloConfiguration;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.server.fs.VolumeManager;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.CommonPathCapabilities;
 import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.LeaseRecoverable;
 import org.apache.hadoop.fs.LocalFileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.RawLocalFileSystem;
 import org.apache.hadoop.fs.viewfs.ViewFileSystem;
-import org.apache.hadoop.hdfs.DistributedFileSystem;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -41,6 +42,7 @@ public class HadoopLogCloser implements LogCloser {
   @Override
   public long close(AccumuloConfiguration conf, Configuration hadoopConf, 
VolumeManager fs,
       Path source) throws IOException {
+
     FileSystem ns = fs.getFileSystemByPath(source);
 
     // if path points to a viewfs path, then resolve to underlying filesystem
@@ -52,9 +54,10 @@ public class HadoopLogCloser implements LogCloser {
       }
     }
 
-    if (ns instanceof DistributedFileSystem dfs) {
+    if (ns.hasPathCapability(source, 
CommonPathCapabilities.LEASE_RECOVERABLE)) {
       try {
-        if (!dfs.recoverLease(source)) {
+        LeaseRecoverable lr = (LeaseRecoverable) ns;
+        if (!lr.recoverLease(source)) {
           log.info("Waiting for file to be closed {}", source);
           return 
conf.getTimeInMillis(Property.MANAGER_LEASE_RECOVERY_WAITING_PERIOD);
         }
@@ -67,7 +70,7 @@ public class HadoopLogCloser implements LogCloser {
         log.info("Recovered lease on {} using append", source);
       }
     } else if (ns instanceof LocalFileSystem || ns instanceof 
RawLocalFileSystem) {
-      // ignore
+      // ignore, don't throw an exception
     } else {
       throw new IllegalStateException(
           "Don't know how to recover a lease for " + ns.getClass().getName());

Reply via email to