Skip to content

Commit

Permalink
OAK-11299: Missing Segments With Oak Run Segment Copy
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Weitzendorf committed Dec 10, 2024
1 parent 3fb2678 commit 40d04aa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public int run() {

} catch (Exception e) {
watch.stop();
printMessage(errWriter, "A problem occured while copying archives from {0} to {1} ", source,
printMessage(errWriter, "A problem occurred while copying archives from {0} to {1} ", source,
destination);
e.printStackTrace(errWriter);
return 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,13 @@ private void migrateArchives() throws IOException, ExecutionException, Interrupt
List<String> targetArchives = targetManager.listArchives();

if (appendMode && !targetArchives.isEmpty()) {
//last archive can be updated since last copy and needs to be recopied
String lastArchive = targetArchives.get(targetArchives.size() - 1);
targetArchives.remove(lastArchive);
// last archive could have been updated since last copy and needs to be recopied
try {
targetArchives.sort(String::compareTo);
targetArchives.remove(targetArchives.size() - 1);
} catch (UnsupportedOperationException e) {
targetArchives = targetArchives.subList(0, targetArchives.size() - 1);
}
}

for (String archiveName : sourceManager.listArchives()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,11 @@ SegmentArchiveEntry[] getEntries() {
*/
@NotNull
private static List<UUID> getReferences(UUID id, Map<UUID, List<UUID>> graph) {
List<UUID> references = graph.get(id);
if (graph == null) {
return Collections.emptyList();
}

List<UUID> references = graph.get(id);
if (references == null) {
return Collections.emptyList();
}
Expand Down Expand Up @@ -550,8 +553,9 @@ TarReader sweep(@NotNull Set<UUID> reclaim, @NotNull Set<UUID> reclaimed) throws
// Reconstruct the graph index for non-cleaned segments.

Map<UUID, List<UUID>> graph = getGraph();
Set<Entry<UUID, List<UUID>>> entrySet = (graph == null) ? Collections.emptySet() : graph.entrySet();

for (Entry<UUID, List<UUID>> e : graph.entrySet()) {
for (Entry<UUID, List<UUID>> e : entrySet) {
if (cleaned.contains(e.getKey())) {
continue;
}
Expand Down

0 comments on commit 40d04aa

Please sign in to comment.