jackjlli commented on a change in pull request #7744:
URL: https://github.com/apache/pinot/pull/7744#discussion_r747226615



##########
File path: 
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
##########
@@ -2858,10 +2883,11 @@ public void endReplaceSegments(String 
tableNameWithType, String segmentLineageEn
             .format("Invalid segment lineage entry id (tableName='%s', 
segmentLineageEntryId='%s')", tableNameWithType,
                 segmentLineageEntryId));
 
-        // NO-OPS if the entry is already completed
-        if (lineageEntry.getState() == LineageEntryState.COMPLETED) {
-          LOGGER.warn("Lineage entry state is already COMPLETED. Nothing to 
update. (tableNameWithType={}, "
-              + "segmentLineageEntryId={})", tableNameWithType, 
segmentLineageEntryId);
+        // NO-OPS if the entry is already 'COMPLETED' or 'REVERTED'
+        if (lineageEntry.getState() != LineageEntryState.IN_PROGRESS) {
+          LOGGER.warn("Lineage entry state is not IN_PROGRESS. Nothing to 
update. (tableNameWithType={}, "

Review comment:
       I suggest rephrasing this sentence a bit, or add a message at the very 
beginning of the method in order to show that we are trying to mark the lineage 
entry to `COMPLETED`. Otherwise, it's a bit hard to track what happened when 
seeing this message.
   
   Same for start and revert APIs.

##########
File path: 
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
##########
@@ -2945,10 +2971,11 @@ public void revertReplaceSegments(String 
tableNameWithType, String segmentLineag
           // We do not allow to revert the lineage entry with 'REVERTED' 
state. For 'IN_PROGRESS", we only allow to
           // revert when 'forceRevert' is set to true.
           if (lineageEntry.getState() != LineageEntryState.IN_PROGRESS || 
!forceRevert) {
-            LOGGER.warn("Lineage state is not valid. Cannot revert the lineage 
entry. (tableNameWithType={}, "
-                    + "segmentLineageEntryId={}, segmentLineageEntrySate={}, 
forceRevert={})", tableNameWithType,
+            String errorMsg = String.format(
+                "Lineage state is not valid. Cannot revert the lineage entry. 
(tableNameWithType=%s, "
+                    + "segmentLineageEntryId=%s, segmentLineageEntrySate=%s, 
forceRevert=%s)", tableNameWithType,
                 segmentLineageEntryId, lineageEntry.getState(), forceRevert);
-            return false;
+            throw new RuntimeException(errorMsg);

Review comment:
       it'd be good to switch to `RetriableOperationException`?




-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to