[ 
https://issues.apache.org/jira/browse/GOBBLIN-1875?focusedWorklogId=876235&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-876235
 ]

ASF GitHub Bot logged work on GOBBLIN-1875:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 15/Aug/23 00:24
            Start Date: 15/Aug/23 00:24
    Worklog Time Spent: 10m 
      Work Description: umustafi commented on code in PR #3737:
URL: https://github.com/apache/gobblin/pull/3737#discussion_r1294080873


##########
gobblin-runtime/src/main/java/org/apache/gobblin/scheduler/JobScheduler.java:
##########
@@ -586,9 +587,13 @@ public void close() throws IOException {
    * Get a {@link org.quartz.Trigger} from the given job configuration 
properties.
    */
   public static Trigger createTriggerForJob(JobKey jobKey, Properties 
jobProps) {
-    // Build a trigger for the job with the given cron-style schedule
+    Random random = new Random();
+    /*
+    Build a trigger for the job with the given cron-style schedule
+    Append a random integer to job name to be able to add multiple triggers 
associated with the same job.
+    */
     return TriggerBuilder.newTrigger()
-        .withIdentity(jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY),
+        .withIdentity(jobProps.getProperty(ConfigurationKeys.JOB_NAME_KEY) + 
random.nextInt(1000),

Review Comment:
   updated with this!





Issue Time Tracking
-------------------

    Worklog Id:     (was: 876235)
    Time Spent: 50m  (was: 40m)

> Create Unique Trigger identifiers 
> ----------------------------------
>
>                 Key: GOBBLIN-1875
>                 URL: https://issues.apache.org/jira/browse/GOBBLIN-1875
>             Project: Apache Gobblin
>          Issue Type: Bug
>          Components: gobblin-service
>            Reporter: Urmi Mustafi
>            Assignee: Abhishek Tiwari
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to