klsince commented on code in PR #8645:
URL: https://github.com/apache/pinot/pull/8645#discussion_r866349057


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/retention/RetentionManager.java:
##########
@@ -237,6 +237,21 @@ private void 
manageSegmentLineageCleanupForTable(TableConfig tableConfig) {
             // entry and its segments
             Set<String> destinationSegments = new 
HashSet<>(lineageEntry.getSegmentsTo());
             destinationSegments.retainAll(segmentsForTable);
+
+            // Retain zombie segments for the case of rerunning the replace 
protocol with overlapping segment names.
+            // For the following example, we should not try to delete s1 and 
s2, but remove entry1 directly.
+            // entry1: { segmentsFrom: [], segmentsTo: [s1, s2], status: 
REVERTED}
+            // entry2: { segmentsFrom: [], segmentsTo: [s1, s2], status: 
IN_PROGRESS/COMPLETED}
+            if (lineageEntry.getState() == LineageEntryState.REVERTED) {

Review Comment:
   could the reverted entry be deleted immediately when the new entry with 
overlapping segment names is created? 



##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/retention/RetentionManager.java:
##########
@@ -237,6 +237,21 @@ private void 
manageSegmentLineageCleanupForTable(TableConfig tableConfig) {
             // entry and its segments
             Set<String> destinationSegments = new 
HashSet<>(lineageEntry.getSegmentsTo());
             destinationSegments.retainAll(segmentsForTable);
+
+            // Retain zombie segments for the case of rerunning the replace 
protocol with overlapping segment names.
+            // For the following example, we should not try to delete s1 and 
s2, but remove entry1 directly.
+            // entry1: { segmentsFrom: [], segmentsTo: [s1, s2], status: 
REVERTED}
+            // entry2: { segmentsFrom: [], segmentsTo: [s1, s2], status: 
IN_PROGRESS/COMPLETED}
+            if (lineageEntry.getState() == LineageEntryState.REVERTED) {
+              for (String otherLineageEntryId : 
segmentLineage.getLineageEntryIds()) {
+                LineageEntry otherLineageEntry = 
segmentLineage.getLineageEntry(otherLineageEntryId);
+                if (otherLineageEntry.getState() == LineageEntryState.COMPLETED
+                    || otherLineageEntry.getState() == 
LineageEntryState.IN_PROGRESS) {
+                  
destinationSegments.removeAll(otherLineageEntry.getSegmentsTo());
+                }
+              }
+            }
+

Review Comment:
   maybe update the comment for the `if (destinationSegments.isEmpty()) {` 
below that empty destinationSegments might also come from entry reverted by a 
newer entry with overlapping segment names.
   



-- 
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]

Reply via email to