Ensure cleanup in case of early errors in streaming base backups
authorMagnus Hagander <magnus@hagander.net>
Wed, 28 May 2014 10:40:45 +0000 (12:40 +0200)
committerMagnus Hagander <magnus@hagander.net>
Wed, 28 May 2014 10:43:29 +0000 (12:43 +0200)
commit8232d6df4c943a30c08e65d7ea893cb762bc5612
treebd6db015a83e5437522adb9dc19369b1f52fdf5f
parentc676315658973390c5550d73d3bb1fb7b92720b5
Ensure cleanup in case of early errors in streaming base backups

Move the code that sends the initial status information as well as the
calculation of paths inside the ENSURE_ERROR_CLEANUP block. If this code
failed, we would "leak" a counter of number of concurrent backups, thereby
making the system always believe it was in backup mode. This could happen
if the sending failed (which it probably never did given that the small
amount of data to send would never cause a flush) or if the psprintf calls
ran out of memory. Both are very low risk, but all operations after
do_pg_start_backup should be protected.
src/backend/replication/basebackup.c