Jackie-Jiang commented on code in PR #10290:
URL: https://github.com/apache/pinot/pull/10290#discussion_r1109167277
##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java:
##########
@@ -3433,31 +3433,15 @@ public String startReplaceSegments(String
tableNameWithType, List<String> segmen
public void endReplaceSegments(String tableNameWithType, String
segmentLineageEntryId) {
try {
DEFAULT_RETRY_POLICY.attempt(() -> {
- // Fetch the segment lineage metadata
- ZNRecord segmentLineageZNRecord =
-
SegmentLineageAccessHelper.getSegmentLineageZNRecord(_propertyStore,
tableNameWithType);
- Preconditions.checkState(segmentLineageZNRecord != null, "Failed to
find segment lineage for table: %s",
- tableNameWithType);
- SegmentLineage segmentLineage =
SegmentLineage.fromZNRecord(segmentLineageZNRecord);
- int expectedVersion = segmentLineageZNRecord.getVersion();
-
- // Look up the lineage entry based on the segment lineage entry id
+ // Fetch the segment lineage and look up the lineage entry based on
the entry id.
+ SegmentLineage segmentLineage =
SegmentLineageAccessHelper.getSegmentLineage(_propertyStore, tableNameWithType);
LineageEntry lineageEntry =
segmentLineage.getLineageEntry(segmentLineageEntryId);
Preconditions.checkState(lineageEntry != null, "Failed to find entry
id: %s from segment lineage for table: %s",
segmentLineageEntryId, tableNameWithType);
- // NO-OPS if the entry is already 'COMPLETED', reject if the entry is
'REVERTED'
- if (lineageEntry.getState() == LineageEntryState.COMPLETED) {
- LOGGER.info("Found lineage entry is already in COMPLETED status.
(tableNameWithType = {}, "
- + "segmentLineageEntryId = {})", tableNameWithType,
segmentLineageEntryId);
+ // Check if we need to proceed with updating the lineage entry based
on the current state.
+ if (!shouldUpdateLineageEntry(tableNameWithType,
segmentLineageEntryId, lineageEntry)) {
Review Comment:
(minor) Suggest reverting this part since it is not reused. I feel the
existing way is more readable
--
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]