Repository: helix
Updated Branches:
  refs/heads/master 0af6e8c19 -> ae23842d2


[HELIX-746] Fix removeJob so its behavior is more consistent with removeWorkflow

Change the behavior of removeJob() so that it's more consistent with 
removeWorkflow(). This RB addresses the scenario: suppose config deletion 
failed (so config still exists) and context deletion succeeded. Then the 
Controller has no way of knowing whether this job has ever been scheduled or it 
was meant to be deleted (although failed due to partial deletion). Returning as 
soon as config deletion fails can prevent this scenario.

Changelist:
1. Make removeJob() return early as soon as a ZNode write failure is detected


Project: http://git-wip-us.apache.org/repos/asf/helix/repo
Commit: http://git-wip-us.apache.org/repos/asf/helix/commit/ae23842d
Tree: http://git-wip-us.apache.org/repos/asf/helix/tree/ae23842d
Diff: http://git-wip-us.apache.org/repos/asf/helix/diff/ae23842d

Branch: refs/heads/master
Commit: ae23842d24409e26c67f5c99113762bd0eb714b0
Parents: 0af6e8c
Author: Hunter Lee <[email protected]>
Authored: Tue Jul 24 14:11:50 2018 -0700
Committer: Hunter Lee <[email protected]>
Committed: Tue Jul 24 17:48:32 2018 -0700

----------------------------------------------------------------------
 .../java/org/apache/helix/task/TaskUtil.java     | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/helix/blob/ae23842d/helix-core/src/main/java/org/apache/helix/task/TaskUtil.java
----------------------------------------------------------------------
diff --git a/helix-core/src/main/java/org/apache/helix/task/TaskUtil.java 
b/helix-core/src/main/java/org/apache/helix/task/TaskUtil.java
index 9ca0062..496b351 100644
--- a/helix-core/src/main/java/org/apache/helix/task/TaskUtil.java
+++ b/helix-core/src/main/java/org/apache/helix/task/TaskUtil.java
@@ -662,26 +662,29 @@ public class TaskUtil {
     return expiredJobs;
   }
 
-  /* remove IS/EV, config and context of a job */
-  // Jobname is here should be NamespacedJobName.
+  /**
+   * Remove Job Config, IS/EV, and Context in order. Job name here must be a 
namespaced job name.
+   * @param accessor
+   * @param propertyStore
+   * @param job namespaced job name
+   * @return
+   */
   protected static boolean removeJob(HelixDataAccessor accessor, 
HelixPropertyStore propertyStore,
       String job) {
-    boolean success = true;
     if (!removeJobConfig(accessor, job)) {
       LOG.warn(String.format("Error occurred while trying to remove job config 
for %s.", job));
-      success = false;
+      return false;
     }
     if (!cleanupJobIdealStateExtView(accessor, job)) {
       LOG.warn(String.format(
           "Error occurred while trying to remove job idealstate/externalview 
for %s.", job));
-      success = false;
+      return false;
     }
     if (!removeJobContext(propertyStore, job)) {
       LOG.warn(String.format("Error occurred while trying to remove job 
context for %s.", job));
-      success = false;
+      return false;
     }
-
-    return success;
+    return true;
   }
 
   /** Remove the job name from the DAG from the queue configuration */

Reply via email to