jtao15 commented on a change in pull request #8166:
URL: https://github.com/apache/pinot/pull/8166#discussion_r803163854
##########
File path:
pinot-controller/src/test/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManagerTest.java
##########
@@ -755,6 +755,13 @@ public void testSegmentReplacementForRefresh()
Assert.assertEquals(new
HashSet<>(ControllerTestUtils.getHelixResourceManager()
.getSegmentsFor(OFFLINE_SEGMENTS_REPLACE_TEST_REFRESH_TABLE_NAME,
true)),
new HashSet<>(Arrays.asList("s3", "s4", "s5")));
+ // Try to revert the first entry should fail
+ try {
+ ControllerTestUtils.getHelixResourceManager()
+
.revertReplaceSegments(OFFLINE_SEGMENTS_REPLACE_TEST_REFRESH_TABLE_NAME,
lineageEntryId, false);
+ } catch (Exception e) {
+ // expected
Review comment:
Added
##########
File path:
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
##########
@@ -3074,6 +3074,24 @@ public void revertReplaceSegments(String
tableNameWithType, String segmentLineag
throw new RuntimeException(errorMsg);
}
+ // We do not allow to revert the lineage entry which segments in
'segmentsTo' appear in 'segmentsFrom' of other
+ // 'IN_PROGRESS' or 'COMPLETED' entries. E.g. we do not allow
reverting entry1 because it will block reverting
+ // entry2.
+ // entry1: {(Seg_0, Seg_1, Seg_2) -> (Seg_3, Seg_4, Seg_5), COMPLETED}
+ // entry2: {(Seg_3, Seg_4, Seg_5) -> (Seg_6, Seg_7, Seg_8),
IN_PROGRESS/COMPLETED}
+ for (String currentEntryId : segmentLineage.getLineageEntryIds()) {
+ LineageEntry currentLineageEntry =
segmentLineage.getLineageEntry(currentEntryId);
+ if (currentLineageEntry.getState() == LineageEntryState.IN_PROGRESS
||
+ currentLineageEntry.getState() == LineageEntryState.COMPLETED) {
+
Preconditions.checkArgument(Collections.disjoint(lineageEntry.getSegmentsTo(),
currentLineageEntry
+ .getSegmentsFrom()), String.format("Cannot revert lineage
entry, found segments from 'segmentsTo' "
+ + "appear in 'segmentsFrom' of another lineage entry.
(tableNameWithType='%s', "
+ + "segmentLineageEntryIdToRevert='%s', segmentsTo = '%s',
segmentLineageEntryId='%s' "
+ + "segmentsFrom = '%s')", tableNameWithType,
segmentLineageEntryId, lineageEntry.getSegmentsTo(),
+ currentEntryId, currentLineageEntry,
currentLineageEntry.getSegmentsFrom()));
Review comment:
Removed.
--
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]