Repository navigation
fix(jobs): judge refresh cleanup against the unrestricted key_source - #1595
Open
dimitri-yatsenko wants to merge 1 commit into
Open
dimitri-yatsenko wants to merge 1 commit into
dimitri-yatsenko wants to merge 1 commit into
Conversation
`Job.refresh(*restrictions)` narrowed key_source to add jobs and then reused the narrowed key_source in its cleanup step. Every job older than stale_timeout whose key fell outside the restriction therefore looked vanished and was deleted, including jobs reserved by other workers and error records. `populate(*restrictions, reserve_jobs=True)` calls refresh this way. Cleanup now checks keys against the unrestricted key_source; the restrictions still limit which jobs are added and re-pended. Success and error records whose key has left both key_source and the target (because the upstream row was deleted) are now removed on every refresh, whatever their age, instead of lingering until stale_timeout. Records of rows that still exist are kept. The age-based check for the other statuses, and stale_timeout=0 skipping it, are unchanged. Cleanup now issues one DELETE per step instead of an existence query and a DELETE for each key. Closes #1594. Part of #1577.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1594. Part of #1577.
Job.refresh(*restrictions)narrowedkey_sourceto add jobs, then reused the narrowedkey_sourcein its cleanup step. Every job older thanstale_timeoutwhose key fell outside the restriction therefore looked vanished and was deleted, including jobs reserved by other workers and error records.populate(*restrictions, reserve_jobs=True)calls refresh this way.key_source. The restrictions still limit which jobs are added and re-pended.key_sourceand the target (because the upstream row was deleted) are removed on every refresh, whatever their age, instead of lingering untilstale_timeout. Records of rows that still exist are kept.stale_timeout=0skipping it. That is the rest of Jobs: with keep_completed, success and error records outlive the rows they describe #1577, which waits for 2.4.Tests:
tests/integration/test_jobs_refresh.py, on MySQL and PostgreSQL. It covers a restricted refresh, a restrictedpopulate, records of vanished keys, records of rows that still exist,stale_timeout=0, and the statement count. The jobs and autopopulate suites pass locally.The same commit goes onto
maint/2.3for the v2.3.5 patch release.