]> granicus.if.org Git - postgresql/commit
Fix bug in cancellation of non-exclusive backup to avoid assertion failure.
authorFujii Masao <fujii@postgresql.org>
Mon, 18 Dec 2017 18:46:14 +0000 (03:46 +0900)
committerFujii Masao <fujii@postgresql.org>
Mon, 18 Dec 2017 18:49:25 +0000 (03:49 +0900)
commit0668c84e28578921f46ad276f9cd24bb773841f2
treeec2a68f479e280855757f981c4210364bd4267fd
parent986a9153b9708071adf6ce2c9131266f3431f4ec
Fix bug in cancellation of non-exclusive backup to avoid assertion failure.

Previously an assertion failure occurred when pg_stop_backup() for
non-exclusive backup was aborted while it's waiting for WAL files to
be archived. This assertion failure happened in do_pg_abort_backup()
which was called when a non-exclusive backup was canceled.
do_pg_abort_backup() assumes that there is at least one non-exclusive
backup running when it's called. But pg_stop_backup() can be canceled
even after it marks the end of non-exclusive backup (e.g.,
during waiting for WAL archiving). This broke the assumption that
do_pg_abort_backup() relies on, and which caused an assertion failure.

This commit changes do_pg_abort_backup() so that it does nothing
when non-exclusive backup has been already marked as completed.
That is, the asssumption is also changed, and do_pg_abort_backup()
now can handle even the case where it's called when there is
no running backup.

Backpatch to 9.6 where SQL-callable non-exclusive backup was added.

Author: Masahiko Sawada and Michael Paquier
Reviewed-By: Robert Haas and Fujii Masao
Discussion: https://www.postgresql.org/message-id/CAD21AoD2L1Fu2c==gnVASMyFAAaq3y-AQ2uEVj-zTCGFFjvmDg@mail.gmail.com
src/backend/access/transam/xlog.c
src/backend/replication/basebackup.c