-
Notifications
You must be signed in to change notification settings - Fork 744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GOBBLIN-2143] handle concurrent ReevaluateDagProc for cancelled dag nodes correctly #4038
Conversation
af4b9c6
to
8c40616
Compare
@@ -174,12 +171,6 @@ public static void cancelDagNode(Dag.DagNode<JobExecutionPlan> dagNodeToCancel, | |||
log.warn("No Job future when canceling DAG node - {}", dagNodeToCancel.getValue().getId()); | |||
} | |||
DagManagerUtils.getSpecProducer(dagNodeToCancel).cancelJob(dagNodeToCancel.getValue().getJobSpec().getUri(), cancelJobArgs).get(); | |||
// add back the dag node with updated states in the store |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addDag will happen only by LaunchDagProc once in the life cycle of Dag
and
updateDagNode will happen only after submitting the job to SpecProducer (to store the future) or in Reevaluate to update the status
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updating the status too soon (like here), may cause a dag to delete before ReevaluateDagProc is processed.
8c40616
to
844e6fc
Compare
844e6fc
to
3534cf8
Compare
...rc/main/java/org/apache/gobblin/service/modules/orchestration/DagStateStoreWithDagNodes.java
Outdated
Show resolved
Hide resolved
if (this.dagStateStore.cleanUp(dagId)) { | ||
log.info("Deleted dag {}", dagId); | ||
} else { | ||
log.info("Dag deletion was tried but did not happen {}", dagId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only .info
level, not warn
or even error
? alternatively this could arguably be an exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i mean, deletion not happening can really be just because the element was already absent...
if there is some mysql exception, it would be thrown, it will not return a boolean in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be try/catch in this case with logging?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i mean, i intend to not swallow exceptions.
and i am just fine if cleanup returns false. so did not do try/catch
...in/java/org/apache/gobblin/service/modules/orchestration/MysqlDagStateStoreWithDagNodes.java
Outdated
Show resolved
Hide resolved
...in/java/org/apache/gobblin/service/modules/orchestration/MysqlDagStateStoreWithDagNodes.java
Outdated
Show resolved
Hide resolved
...in/java/org/apache/gobblin/service/modules/orchestration/MysqlDagStateStoreWithDagNodes.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/gobblin/service/modules/orchestration/DagStateStoreWithDagNodes.java
Outdated
Show resolved
Hide resolved
...e/src/main/java/org/apache/gobblin/service/modules/orchestration/proc/ReevaluateDagProc.java
Outdated
Show resolved
Hide resolved
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4038 +/- ##
=========================================
Coverage 38.79% 38.79%
Complexity 1599 1599
=========================================
Files 388 388
Lines 15998 15998
Branches 1585 1585
=========================================
+ Hits 6206 6207 +1
Misses 9293 9293
+ Partials 499 498 -1 ☔ View full report in Codecov by Sentry. |
if (this.dagStateStore.cleanUp(dagId)) { | ||
log.info("Deleted dag {}", dagId); | ||
} else { | ||
log.info("Dag deletion was tried but did not happen {}", dagId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be try/catch in this case with logging?
Dear Gobblin maintainers,
Please accept this PR. I understand that it will not be reviewed until I have checked off all the steps below!
JIRA
Description
When a dag is cancelled and multiple ReevaluateDagProcs are being processed for kill dag nodes, all of them will try to delete the dag and insert the dag node state too. this "insert" and "delete" may create inconsistency in the dag state store.
To safe guard against this, let only ReevaluateDagProc update the status of a dag node; and it should only UPDATE the status, NOT try to INSERT the dag node.
Tests
updated tests
Commits