-
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-1875] Create Unique Trigger Keys #3737
Conversation
return TriggerBuilder.newTrigger() | ||
.withIdentity(jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY), | ||
.withIdentity(jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY) + random.nextInt(1000), |
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.
Random number will make it super hard to debug if something went wrong.. does it make sense to change the trigger name to be normal flow name -> normal trigger that tigger the execution; {flowName + “reminder job” + executionid/timestamp} -> reminder job for a specific execution?
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.
updated with this!
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.
very close!
gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java
Outdated
Show resolved
Hide resolved
gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java
Outdated
Show resolved
Hide resolved
* @return | ||
*/ | ||
public static String createSuffixForJobTrigger(long eventToRevisitMillis) { | ||
return "reminder_for_" + (eventToRevisitMillis); |
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.
nit: why the parens?
*/ | ||
public static Trigger createTriggerForJob(JobKey jobKey, Properties jobProps) { |
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.
Did you verify that this method is not called anywhere else? Asking because this is a backward incompatible change. You can leave this method and make it by default a call to createTriggerForJob(jobKey, jobProps, Optional.absent())
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.
Yea I checked everywhere and added. It would not compile otherwise also.
Codecov Report
@@ Coverage Diff @@
## master #3737 +/- ##
============================================
- Coverage 47.08% 45.31% -1.77%
+ Complexity 10864 2139 -8725
============================================
Files 2147 413 -1734
Lines 84825 17956 -66869
Branches 9412 2184 -7228
============================================
- Hits 39936 8137 -31799
+ Misses 41264 8952 -32312
+ Partials 3625 867 -2758 see 1735 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
+1
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
We are seeing the following errors when trying to schedule reminders for Multi-active scheduler after losing lease acquisition:
Unable to store Trigger with name: '...' and group: '...' because one already exists with this identification
The Quartz scheduler allows multiple unique triggers mapping to one job in a N:1 relation, but this requires the trigger having a unique identifier associated with it. When we create triggers, we were previously using only the job name and group to identify the trigger so we're unable to add additional triggers for the same job. The trigger key is only used internally by the Quartz scheduler, so it is safe to manipulate by adding a random number to identify the trigger. We also don't expect more than a handful of triggers associated with a job, so an int 0 to 1000 will be sufficient to uniquely identify the trigger.
Tests
testCreateUniqueTriggersForJob
creates two triggers with the same job key and verifies the trigger key's are uniqueCommits