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

keith-turner 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 26a225424c fixes NPE in bulkv1 code after failure (#6622)
26a225424c is described below

commit 26a225424c80f5108509750e91795258d40cd80a
Author: Keith Turner <[email protected]>
AuthorDate: Fri Oct 30 14:56:32 2026 -0400

    fixes NPE in bulkv1 code after failure (#6622)
    
    Changes in #6620 introduced a potential NPE when status is removed from map.
---
 .../java/org/apache/accumulo/core/clientImpl/bulk/BulkImport.java   | 6 ++----
 .../main/java/org/apache/accumulo/server/client/BulkImporter.java   | 6 +++---
 test/src/main/java/org/apache/accumulo/test/functional/BulkIT.java  | 3 +++
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git 
a/core/src/main/java/org/apache/accumulo/core/clientImpl/bulk/BulkImport.java 
b/core/src/main/java/org/apache/accumulo/core/clientImpl/bulk/BulkImport.java
index f9749ab434..fc993bbe64 100644
--- 
a/core/src/main/java/org/apache/accumulo/core/clientImpl/bulk/BulkImport.java
+++ 
b/core/src/main/java/org/apache/accumulo/core/clientImpl/bulk/BulkImport.java
@@ -266,11 +266,9 @@ public class BulkImport implements 
ImportDestinationArguments, ImportMappingOpti
   }
 
   public static Map<KeyExtent,Long> estimateSizes(AccumuloConfiguration 
acuConf, Path mapFile,
-      FileStatus status, Collection<KeyExtent> extents, FileSystem ns,
+      long fileSize, FileStatus status, Collection<KeyExtent> extents, 
FileSystem ns,
       Cache<String,Long> fileLenCache, CryptoService cs) throws IOException {
 
-    final long fileSize = status.getLen();
-
     if (extents.size() == 1) {
       return Collections.singletonMap(extents.iterator().next(), fileSize);
     }
@@ -584,7 +582,7 @@ public class BulkImport implements 
ImportDestinationArguments, ImportMappingOpti
           // make sure file isn't going to too many tablets
           checkTabletCount(maxTablets, extents.size(), filePath.toString());
           Map<KeyExtent,Long> estSizes = 
estimateSizes(context.getConfiguration(), filePath,
-              fileStatus, extents, fs, fileLensCache, cs);
+              fileStatus.getLen(), fileStatus, extents, fs, fileLensCache, cs);
           Map<KeyExtent,Bulk.FileInfo> pathLocations = new HashMap<>();
           for (KeyExtent ke : extents) {
             pathLocations.put(ke, new Bulk.FileInfo(filePath, 
estSizes.getOrDefault(ke, 0L)));
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 d1c186b856..f2feb7156c 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
@@ -404,9 +404,9 @@ public class BulkImporter {
           Path mapFile = entry.getKey();
           FileSystem ns = 
context.getVolumeManager().getFileSystemByPath(mapFile);
 
-          estimatedSizes =
-              BulkImport.estimateSizes(context.getConfiguration(), mapFile, 
statuses.get(mapFile),
-                  extentsOf(entry.getValue()), ns, null, 
tableConf.getCryptoService());
+          estimatedSizes = 
BulkImport.estimateSizes(context.getConfiguration(), mapFile,
+              mapFileSizes.get(mapFile), statuses.get(mapFile), 
extentsOf(entry.getValue()), ns,
+              null, tableConf.getCryptoService());
         } catch (IOException e) {
           log.warn("Failed to estimate map file sizes {}", e.getMessage());
         }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BulkIT.java 
b/test/src/main/java/org/apache/accumulo/test/functional/BulkIT.java
index ae67f35d48..91caa7b7b6 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BulkIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BulkIT.java
@@ -19,6 +19,7 @@
 package org.apache.accumulo.test.functional;
 
 import static org.apache.accumulo.harness.AccumuloITBase.SUNNY_DAY;
+import static org.junit.jupiter.api.Assertions.assertFalse;
 
 import java.io.IOException;
 import java.time.Duration;
@@ -99,6 +100,8 @@ public class BulkIT extends AccumuloClusterHarness {
     TestIngest.ingest(c, fs, params);
 
     bulkLoad(c, tableName, bulkFailures, files, useOld);
+    assertFalse(fs.listFiles(bulkFailures, false).hasNext());
+
     VerifyParams verifyParams = new VerifyParams(c.properties(), tableName, N);
     verifyParams.random = 56;
     for (int i = 0; i < COUNT; i++) {

Reply via email to