mqliang commented on a change in pull request #7086:
URL: https://github.com/apache/incubator-pinot/pull/7086#discussion_r658327196



##########
File path: 
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/BaseSingleSegmentConversionExecutor.java
##########
@@ -70,6 +70,14 @@ public SegmentConversionResult executeTask(PinotTaskConfig 
pinotTaskConfig)
     String originalSegmentCrc = 
configs.get(MinionConstants.ORIGINAL_SEGMENT_CRC_KEY);
     String authToken = configs.get(MinionConstants.AUTH_TOKEN);
 
+    long currentSegmentCrc = getSegmentCrc(tableNameWithType, segmentName);
+    if (Long.parseLong(originalSegmentCrc) != currentSegmentCrc) {
+      LOGGER.info("Segment CRC does not match, skip the task. Original CRC: 
{}, current CRC: {}", originalSegmentCrc,
+          currentSegmentCrc);
+      return new 
SegmentConversionResult.Builder().setTableNameWithType(tableNameWithType).setSegmentName(segmentName)
+          .build();

Review comment:
       Helix expose following result status for external usage:
   ```
   public class TaskResult {
     /**
      * An enumeration of status codes.
      */
     public enum Status {
       /** The task completed normally. */
       COMPLETED,
       /**
        * The task was cancelled externally, i.e. {@link 
org.apache.helix.task.Task#cancel()} was
        * called.
        */
       CANCELED,
       /** The task encountered an error from which it can not recover.
        * This is equivalent to {@link 
org.apache.helix.task.TaskResult.Status#FAILED}.*/
       @Deprecated
       ERROR,
       /** The task encountered an error which can not be recovered from this 
run, but it may still succeed by retrying the task. */
       FAILED,
       /** The task encountered an error, which will not be recoverable even 
with retrying the task */
       FATAL_FAILED
     }
   ```
   
   Helix does have an `TASK_ABORTED ` in it's state model, but it does not 
exposed in TaskResult:
   ```
   public enum TaskPartitionState {
     /** The initial state of the state model. */
     INIT,
     /** Indicates that the task is currently running. */
     RUNNING,
     /** Indicates that the task was stopped by the controller. */
     STOPPED,
     /** Indicates that the task completed normally. */
     COMPLETED,
     /** Indicates that the task timed out. */
     TIMED_OUT,
     /** Indicates an error occurred during task execution, but the task can be 
retried. */
     TASK_ERROR,
     /** Indicates an error occurred during task execution, and the task should 
not be retried. */
     TASK_ABORTED,
     /** Helix's own internal error state. */
     ERROR,
     /** A Helix internal state. */
     DROPPED
   }
   ```
   We need change Helix code if we want mark the task as `Aborted `
   




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

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