keith-turner commented on a change in pull request #1555: Fix idempotency bug
in importtable
URL: https://github.com/apache/accumulo/pull/1555#discussion_r389808195
##########
File path:
server/master/src/main/java/org/apache/accumulo/master/tableOps/MoveExportedFiles.java
##########
@@ -48,17 +49,22 @@
Map<String,String> fileNameMappings =
PopulateMetadataTable.readMappingFile(fs, tableInfo);
+ FileStatus[] exportedFiles = fs.listStatus(new
Path(tableInfo.exportDir));
+ FileStatus[] importedFiles = fs.listStatus(new
Path(tableInfo.importDir));
+
Review comment:
Could possibly avoid the linear search in each loop iteration with something
like the following before the loop.
```java
Set<String> exporting = Arrays.stream(exportedFiles).map(fstat ->
fstat.getPath().getName()).map(fileNameMapping::get).collect(Collectors.toSet());
Set<String> exported = Arrays.stream(importedFiles).map(fstat ->
fstat.getPath().getName()).collect(Collectors.toSet());
//ensure Sets.union(exporting, exported) equals new
HashSet<>(fileNameMappings.values)
```
----------------------------------------------------------------
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