Skip to content

Commit

Permalink
Ignore repair_run_by_cluster_v2 rows with no corresponding repair (#1478
Browse files Browse the repository at this point in the history
)

* Ignore repair_run_by_cluster_v2 rows with no corresponding repair
When bad things (like Reaper filling the drive with logs) happen,
it's possible to end up with repair_run_by_cluster_v2 rows with no
corresponding repair row, which breaks Reaper.  So, just skip them.

* Cleaner version of omitting missing repair_run rows
Per comment, rewrite to stick a filter between instead
of shoving a ternary into the map.  Cleaner and easier to read.
  • Loading branch information
SesquipedalianDefenestrator committed Mar 19, 2024
1 parent f611445 commit 88a9981
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.SortedSet;
Expand Down Expand Up @@ -395,15 +396,14 @@ public List<RepairRun> getRepairRunsForClusterPrioritiseRunning(String clusterNa
)
)
);

// Defuture the repair_run rows and build the strongly typed RepairRun objects from the contents.
return repairRunFutures
.stream()
.map(
row -> {
Row extractedRow = row.getUninterruptibly().one();
return buildRepairRunFromRow(extractedRow, extractedRow.getUUID("id"));
}
).collect(Collectors.toList());
.map(row -> row.getUninterruptibly().one())
.filter(Objects::nonNull)
.map(extractedRow -> buildRepairRunFromRow(extractedRow, extractedRow.getUUID("id")))
.collect(Collectors.toList());
}

@Override
Expand Down

0 comments on commit 88a9981

Please sign in to comment.