Interrupting and re-running recurring reports can cause duplicated schedule entries

Bug #1893463 reported by Jason Boyer
20
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Medium
Unassigned
3.5
Fix Released
Medium
Unassigned

Bug Description

All supported versions of Evergreen affected

If a problem occurs that interrupts a recurring report but doesn't close the state database connection out from under the reporter it will still go ahead and schedule the next iteration of the report. If you then reset the initial schedule entry to re-run the interrupted report a second entry will be created for the next run when it finishes. This is easily avoided with a unique constraint on a few fields on reporter.schedule.

Revision history for this message
Jason Boyer (jboyer) wrote :

Here's a branch that addresses this by adding a unique index on the report, folder, runner, run_time, and email fields of reporter.schedule: https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/jboyer/lp1893463_uniq_recurrence / working/user/jboyer/lp1893463_uniq_recurrence

Clark is also taught that the specific error caused by this constraint is not a problem.

Jason Boyer (jboyer)
tags: added: pullrequest reports
Revision history for this message
Anna Goben (agoben) wrote :

Dupe? #1892535

Revision history for this message
Chris Sharp (chrissharp123) wrote :

Works well for us! Pushed to master, rel_3_5 and rel_3_6. Could easily be backported to rel_3_4.

Revision history for this message
Chris Sharp (chrissharp123) wrote :

Follow-up commit, addressing the need for de-duplicating the reporter.schedule table before adding the index, also adding release notes, available for review at the tip of https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/csharp/lp1893463_upgrade_script_improvements

Revision history for this message
Jason Stephenson (jstephenson) wrote :

I have added a signoff to Chris Sharp's improved upgrade script in user/dyrcona/lp1893462_upgrade_script_improvements_signoff on the working repo:

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/dyrcona/lp1893462_upgrade_script_improvements_signoff

Galen Charlton (gmc)
Changed in evergreen:
milestone: none → 3.6.0
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Chris Sharp (chrissharp123) wrote :

I went ahead and pushed the signed-off follow-up to rel_3_5, rel_3_6, and master. Thanks, Jason!

Changed in evergreen:
status: Confirmed → Fix Committed
Revision history for this message
Mike Rylander (mrylander) wrote :

I've pushed a branch to address an issue with the index and upgrade script. From the commit message:

Unique indexes on nullable columns will allow multiple conceptually unique rows if the nullable columns are, in fact, NULL because NULL does not equal itself. This commit uses COALESCE to make sure that the nullable email column in the reporter.schedule table gets a value of the empty string for the purposes of the unique index. The upgrade script now also takes this into account and ignores the email column.

Branch at:

https://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/user/miker/lp1893462_upgrade_script_improvements_signoff

Changed in evergreen:
status: Fix Committed → Incomplete
Revision history for this message
Galen Charlton (gmc) wrote :

Given the recent update to the update script and the fact that the point of this is to delete data, I've elected to bump this to 3.6.1, with this excluded from 3.6.0.

Changed in evergreen:
milestone: 3.6.0 → 3.6.1
Revision history for this message
Chris Sharp (chrissharp123) wrote :

Thanks, Mike - I pushed your commit to master.

Changed in evergreen:
status: Incomplete → Fix Committed
Revision history for this message
Jeff Davis (jdavis-sitka) wrote :

Mike's follow-up needs to be committed to 3.5.

Revision history for this message
Jeff Davis (jdavis-sitka) wrote :

OK, follow-up is in rel_3_5 now.

Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.