belugabehr commented on a change in pull request #911: HBASE-23379: Clean Up
FSUtil getRegionLocalityMappingFromFS
URL: https://github.com/apache/hbase/pull/911#discussion_r355728658
##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java
##########
@@ -1708,44 +1701,36 @@ public boolean accept(Path path) {
FileStatus[] statusList = fs.globStatus(queryPath, pathFilter);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Query Path: {} ; # list of files: {}", queryPath,
Arrays.toString(statusList));
+ }
+
if (null == statusList) {
return;
- } else {
- LOG.debug("Query Path: " + queryPath + " ; # list of files: " +
- statusList.length);
}
// lower the number of threads in case we have very few expected regions
threadPoolSize = Math.min(threadPoolSize, statusList.length);
// run in multiple threads
- ThreadPoolExecutor tpe = new ThreadPoolExecutor(threadPoolSize,
- threadPoolSize, 60, TimeUnit.SECONDS,
- new ArrayBlockingQueue<>(statusList.length),
- Threads.newDaemonThreadFactory("FSRegionQuery"));
+ final ExecutorService tpe = Executors.newFixedThreadPool(threadPoolSize,
+ Threads.newDaemonThreadFactory("FSRegionQuery"));
try {
// ignore all file status items that are not of interest
for (FileStatus regionStatus : statusList) {
- if (null == regionStatus) {
+ if (null == regionStatus || !regionStatus.isDirectory()) {
continue;
}
- if (!regionStatus.isDirectory()) {
- continue;
+ final Path regionPath = regionStatus.getPath();
+ if (null != regionPath) {
+ tpe.execute(new FSRegionScanner(fs, regionPath, null,
regionDegreeLocalityMapping));
Review comment:
I removed `regionToBestLocalityRSMapping` from the method signature. This
is a private method and the one method that calls this method passes in a
hard-coded 'null' value. So, to simplify, I just cut out the middleman and
pass in 'null' directly.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services