Repository navigation
Conversation
When gpbackup fails or is interrupted, DoCleanup opens a new session to cancel its queries that wait for locks, and only closes the connection pool afterwards. Until then the backup transactions keep their locks. The new session's queries can wait without limit. With resource groups, sessions queued behind the backup's locks hold the role's concurrency slots, so the cleanup session queues for a slot that is only freed once those locks are released: gpbackup never finishes cleanup, and the sessions waiting on its locks never run. The cancel step now runs under a 20 second deadline, including the connection setup queries, which take no context. On timeout or error it logs a warning and cleanup continues, so the history entry, helper cleanup and lock file are still handled, and exiting releases the locks. This also fixes the previous 20 second timeout, which never fired because time.After was re-created on every 500 ms tick, and would have skipped the rest of cleanup through gplog.FatalOnError if it had.
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.
Change logs
When gpbackup fails or is interrupted,
DoCleanupopens a new session incancelBlockedQueriesto cancel its lock-waiting queries, and only closes the connection pool afterwards. The backup transactions keep their locks until then.The new session's queries had no time limit. With resource groups enabled, sessions queued behind the backup's locks hold the role's concurrency slots, so the cleanup session queues for a slot that is only freed once those locks are released. gpbackup then never finishes cleanup, and every session waiting on its locks, plus any new query from that role, stays queued until someone terminates them by hand.
This change:
gplog.FatalOnError, which used to skip the history update, helper cleanup and lock file removal. Exiting then releases the backup's locks.time.Afterwas re-created on every 500 ms tick.Testing
LOCK TABLE, then the role's resource-group slots were filled with sessions waiting on the backup's locks, and gpbackup was interrupted with SIGINT.LOCK("Canceling 1 blocked queries") and exit within a second.