Skip to content

Commit c4feccf

Browse files
Yiran WuYiran Wu
authored andcommitted
HBASE-22939 SpaceQuotas - Bulkload from different hdfs failed when space quotas are turned on.
1 parent 1ea5d8b commit c4feccf

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import java.util.concurrent.atomic.LongAdder;
4646
import org.apache.commons.lang3.mutable.MutableObject;
4747
import org.apache.hadoop.conf.Configuration;
48+
import org.apache.hadoop.fs.FileSystem;
4849
import org.apache.hadoop.fs.Path;
4950
import org.apache.hadoop.hbase.ByteBufferExtendedCell;
5051
import org.apache.hadoop.hbase.CacheEvictionStats;
@@ -2404,7 +2405,7 @@ public BulkLoadHFileResponse bulkLoadHFile(final RpcController controller,
24042405
filePaths.add(familyPath.getPath());
24052406
}
24062407
// Check if the batch of files exceeds the current quota
2407-
sizeToBeLoaded = enforcement.computeBulkLoadSize(regionServer.getFileSystem(), filePaths);
2408+
sizeToBeLoaded = enforcement.computeBulkLoadSize(getFileSystem(filePaths), filePaths);
24082409
}
24092410
}
24102411
// secure bulk load
@@ -2492,6 +2493,15 @@ public CoprocessorServiceResponse execService(final RpcController controller,
24922493
}
24932494
}
24942495

2496+
private FileSystem getFileSystem(List<String> filePaths) throws IOException {
2497+
if (filePaths.isEmpty()) {
2498+
// local hdfs
2499+
return regionServer.getFileSystem();
2500+
}
2501+
// source hdfs
2502+
return new Path(filePaths.get(0)).getFileSystem(regionServer.getConfiguration());
2503+
}
2504+
24952505
private com.google.protobuf.Message execServiceOnRegion(HRegion region,
24962506
final ClientProtos.CoprocessorServiceCall serviceCall) throws IOException {
24972507
// ignore the passed in controller (from the serialized call)

0 commit comments

Comments
 (0)