This repository has been archived by the owner on Apr 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Stop all background workers for the duration of the upgrade
This commit stops bgws while upgrading the Promscale extension. This prevents lock contention between jobs and upgrades and thus seems safer.
- Loading branch information
Showing
2 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- stop all background workers in the current db so they don't interfere | ||
-- with the upgrade (by e.g. holding locks). | ||
-- | ||
-- Note: this stops the scheduler (and thus all jobs) | ||
-- and waits for the current txn (the one doing the upgrade) to finish | ||
-- before starting it up again. Thus, no jobs will be running during | ||
-- the upgrade. | ||
|
||
-- TimescaleDB itself does the same thing: | ||
-- https://github.com/timescale/timescaledb/blob/72d03e6f7d30cc4794c9263445f14199241e2eb5/sql/updates/pre-update.sql#L34 | ||
SELECT _timescaledb_internal.restart_background_workers(); | ||
|