You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by GitBox <gi...@apache.org> on 2020/07/02 15:26:48 UTC
[GitHub] [accumulo] milleruntime commented on a change in pull request #1635: Create bulkRename method in VolumeManager
milleruntime commented on a change in pull request #1635:
URL: https://github.com/apache/accumulo/pull/1635#discussion_r449082986
##########
File path: server/base/src/main/java/org/apache/accumulo/server/fs/VolumeManagerImpl.java
##########
@@ -289,6 +294,39 @@ public boolean rename(Path path, Path newPath) throws IOException {
return source.rename(path, newPath);
}
+ @Override
+ public List<Future<Boolean>> bulkRename(Map<Path,Path> oldToNewPathMap, int poolSize,
+ String poolName, String transactionId) throws InterruptedException {
+ List<Future<Boolean>> results = new ArrayList<>();
+ SimpleThreadPool workerPool = new SimpleThreadPool(poolSize, poolName);
+ oldToNewPathMap.forEach((oldPath, newPath) -> results.add(workerPool.submit(() -> {
+ boolean success;
+ try {
+ success = rename(oldPath, newPath);
+ } catch (IOException e) {
+ // The rename could have failed because this is the second time its running (failures
+ // could cause this to run multiple times).
+ if (!exists(newPath) || exists(oldPath)) {
Review comment:
I decided since we are already logging an error per file when rename returns false, we should not also throw a new error, failing the transation. It seems like this is just to rethrow any errors we may care about.
----------------------------------------------------------------
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:
users@infra.apache.org