This is an automated email from the ASF dual-hosted git repository. cshannon pushed a commit to branch 2.1 in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push: new 930a841885 Backport fix to make Import tablet idempotent (#4676) 930a841885 is described below commit 930a84188566f771d65ad36924cdada8dd5ad868 Author: Christopher L. Shannon <cshan...@apache.org> 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) {