Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New option PGBK_PAUSE_TIMEOUT #33

Merged
merged 11 commits into from
Mar 24, 2020
Merged

New option PGBK_PAUSE_TIMEOUT #33

merged 11 commits into from
Mar 24, 2020

Conversation

fljdin
Copy link

@fljdin fljdin commented Feb 13, 2020

Add timeout behaviour when dumping standby in case of AccessExclusiveLocks #32

orgrim and others added 3 commits January 23, 2020 09:47
A long query with AccessShareLock on master will be replicated,
and will cause an internal loop when invoking pg_back on standby.
To prevent multiple executions of pg_back on daily routine, this
introduces a new option PGBK_PAUSE_TIMEOUT (-T) that waits an amount
of time in seconds before dying.

The pause/resume replay logic has been simplified.
@fljdin fljdin requested a review from orgrim February 13, 2020 16:15
Save to output of SHOW ALL to pg_settings_DATETIME.out
@orgrim
Copy link
Owner

orgrim commented Feb 25, 2020

Hello, thanks for the patch.

I would prefer to have a name like PGBK_STANDBY_PAUSE_TIMEOUT, which says this timeout relates to standby clusters.

Other than that, it looks good.

Regards

@fljdin
Copy link
Author

fljdin commented Feb 26, 2020

Hi,

Okay for renaming variable.

The blocking behavior is relevant on primary cluster too, but internal loop isn't implemented for this case. For users who haven't replication, a long blocking session could cause multiple execution of pg_back, day after day.

Regards

Copy link
Owner

@orgrim orgrim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase your branch on the tip of orgrim:master, merging right now would revert #31

Thank you

pg_back Outdated Show resolved Hide resolved
@orgrim
Copy link
Owner

orgrim commented Mar 18, 2020

Concerning the fact that a long run could conflict with the backup schedule, with pg_back processes stacking up, I guess a locking mecanism could be implemented using the flock command, see #34

Florent Jardin added 5 commits March 19, 2020 11:13
A long query with AccessShareLock on master will be replicated,
and will cause an internal loop when invoking pg_back on standby.
To prevent multiple executions of pg_back on daily routine, this
introduces a new option PGBK_PAUSE_TIMEOUT (-T) that waits an amount
of time in seconds before dying.

The pause/resume replay logic has been simplified.
pg_back Outdated
fi

echo "The standby database has exclusive locks (vacuum full, truncate or other locking command) running on primary"
echo "Resuming replication for ${PGBK_PAUSE}s"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could use warn() and info() here to print messages correctly. Could you please make to change?

Thank you

@orgrim orgrim merged commit 9637871 into orgrim:master Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants