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

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


The following commit(s) were added to refs/heads/2.1 by this push:
     new 5cab67bb3b Removes cached file status on error (#6620)
5cab67bb3b is described below

commit 5cab67bb3b941548eb738fe5679582c85d67151c
Author: Keith Turner <[email protected]>
AuthorDate: Thu Oct 29 11:43:37 2026 -0400

    Removes cached file status on error (#6620)
    
    The bulk import code uses cached file status objects to open files. When any
    error occurs reading a file this change removes the cached file status in 
case
    stale information in the file status was causing a problem. This change
    may fix #6617.
---
 .../java/org/apache/accumulo/server/client/BulkImporter.java   | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java 
b/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
index 61457d907e..d1c186b856 100644
--- 
a/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
+++ 
b/server/base/src/main/java/org/apache/accumulo/server/client/BulkImporter.java
@@ -33,6 +33,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 import java.util.TreeMap;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
@@ -127,7 +128,7 @@ public class BulkImporter {
     final Map<Path,List<KeyExtent>> completeFailures =
         Collections.synchronizedSortedMap(new TreeMap<>());
 
-    final Map<Path,FileStatus> fileStatuses = new HashMap<>();
+    final Map<Path,FileStatus> fileStatuses = new ConcurrentHashMap<>();
 
     ClientService.Client client = null;
     final TabletLocator locator = TabletLocator.getLocator(context, tableId);
@@ -147,9 +148,11 @@ public class BulkImporter {
           List<TabletLocation> tabletsToAssignMapFileTo = 
Collections.emptyList();
           try {
             FileStatus status = fs.getFileStatus(mapFile);
-            fileStatuses.put(mapFile, status);
             tabletsToAssignMapFileTo = findOverlappingTablets(context, fs, 
locator, mapFile,
                 tableConf.getCryptoService(), status);
+            // Only add to map if there was no exception, just in case stale 
informatoin in
+            // filestatus caused the error.
+            fileStatuses.put(mapFile, status);
           } catch (Exception ex) {
             log.warn("Unable to find tablets that overlap file " + mapFile, 
ex);
           }
@@ -223,6 +226,9 @@ public class BulkImporter {
               keListIter.remove();
             } catch (Exception ex) {
               log.warn("Exception finding overlapping tablets, will retry 
tablet " + ke, ex);
+              // Maybe information in the file status like block locations is 
stale and caused the
+              // error. Remove the file status to force reading file metadata 
from namenode.
+              fileStatuses.remove(entry.getKey());
             }
             timer.stop(Timers.QUERY_METADATA);
           }

Reply via email to