swaminathanmanish commented on code in PR #18518:
URL: https://github.com/apache/pinot/pull/18518#discussion_r3264962458
##########
pinot-common/src/main/java/org/apache/pinot/common/lineage/SegmentLineageUtils.java:
##########
@@ -53,4 +54,35 @@ public static void
filterSegmentsBasedOnLineageInPlace(Set<String> segments, Seg
}
}
}
+
+ /**
+ * Returns the set of segments that participate in a live lineage entry and
therefore must not be deleted by
+ * external callers.
+ * <ul>
+ * <li>{@code IN_PROGRESS} entries lock both {@code segmentsFrom} and
{@code segmentsTo}.</li>
+ * <li>{@code COMPLETED} entries lock {@code segmentsFrom}</li>
+ * <li>{@code REVERTED} entries lock nothing.</li>
+ * </ul>
+ */
+ public static Set<String> getDeleteBlockedSegments(SegmentLineage
segmentLineage) {
+ if (segmentLineage == null) {
+ return Set.of();
+ }
+ Set<String> blocked = new HashSet<>();
+ for (LineageEntry lineageEntry :
segmentLineage.getLineageEntries().values()) {
+ switch (lineageEntry.getState()) {
+ case IN_PROGRESS:
+ blocked.addAll(lineageEntry.getSegmentsFrom());
+ blocked.addAll(lineageEntry.getSegmentsTo());
+ break;
+ case COMPLETED:
Review Comment:
Why do we include COMPLETED here ? IN_PROGRESS is what we want to exclude
right
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]