diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java index 61354fda58..fe1c43a334 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java @@ -45,6 +45,7 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.LongAdder; import org.apache.commons.lang3.mutable.MutableObject; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.ByteBufferExtendedCell; import org.apache.hadoop.hbase.CacheEvictionStats; @@ -2404,7 +2405,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler, filePaths.add(familyPath.getPath()); } // Check if the batch of files exceeds the current quota - sizeToBeLoaded = enforcement.computeBulkLoadSize(regionServer.getFileSystem(), filePaths); + sizeToBeLoaded = enforcement.computeBulkLoadSize(getFileSystem(filePaths), filePaths); } } // secure bulk load @@ -2492,6 +2493,15 @@ public class RSRpcServices implements HBaseRPCErrorHandler, } } + private FileSystem getFileSystem(List filePaths) throws IOException { + if (filePaths.isEmpty()) { + // local hdfs + return regionServer.getFileSystem(); + } + // source hdfs + return new Path(filePaths.get(0)).getFileSystem(regionServer.getConfiguration()); + } + private com.google.protobuf.Message execServiceOnRegion(HRegion region, final ClientProtos.CoprocessorServiceCall serviceCall) throws IOException { // ignore the passed in controller (from the serialized call)