This is an automated email from the ASF dual-hosted git repository.
cshannon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/main by this push:
new 1867db49e7 Backport fix to make Import tablet idempotent (#4676)
1867db49e7 is described below
commit 1867db49e7478041cdc0edc6f47c130dbb853c68
Author: Christopher L. Shannon <[email protected]>
AuthorDate: Fri Jun 14 13:48:30 2024 -0400
Backport fix to make Import tablet idempotent (#4676)
This backports the fix from #4646 to make MoveExportedFiles fate step
idempotent.
This closes #4655
---
.../tableOps/tableImport/MoveExportedFiles.java | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git
a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/tableImport/MoveExportedFiles.java
b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/tableImport/MoveExportedFiles.java
index 87b4a62ef9..c717527619 100644
---
a/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/tableImport/MoveExportedFiles.java
+++
b/server/manager/src/main/java/org/apache/accumulo/manager/tableOps/tableImport/MoveExportedFiles.java
@@ -23,6 +23,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
+import java.util.Objects;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
@@ -71,24 +72,27 @@ class MoveExportedFiles extends ManagerRepo {
Function<FileStatus,String> fileStatusName = fstat ->
fstat.getPath().getName();
- Set<String> importing = Arrays.stream(exportedFiles).map(fileStatusName)
- .map(fileNameMappings::get).collect(Collectors.toSet());
+ Set<Path> importing =
+
Arrays.stream(exportedFiles).map(fileStatusName).map(fileNameMappings::get)
+
.filter(Objects::nonNull).map(Path::new).collect(Collectors.toSet());
- Set<String> imported =
-
Arrays.stream(importedFiles).map(fileStatusName).collect(Collectors.toSet());
+ Set<Path> imported =
+
Arrays.stream(importedFiles).map(FileStatus::getPath).collect(Collectors.toSet());
if (log.isDebugEnabled()) {
log.debug("{} files already present in imported (target) directory:
{}", fmtTid,
- String.join(",", imported));
+
imported.stream().map(Path::getName).collect(Collectors.joining(",")));
}
- Set<String> missingFiles = Sets.difference(new
HashSet<>(fileNameMappings.values()),
+ Set<Path> missingFiles = Sets.difference(
+
fileNameMappings.values().stream().map(Path::new).collect(Collectors.toSet()),
new HashSet<>(Sets.union(importing, imported)));
if (!missingFiles.isEmpty()) {
throw new
AcceptableThriftTableOperationException(tableInfo.tableId.canonical(),
tableInfo.tableName, TableOperation.IMPORT,
TableOperationExceptionType.OTHER,
- "Missing source files corresponding to files " + String.join(",",
missingFiles));
+ "Missing source files corresponding to files "
+ +
missingFiles.stream().map(Path::getName).collect(Collectors.joining(",")));
}
for (FileStatus fileStatus : exportedFiles) {