]> git.ipfire.org Git - thirdparty/postgresql.git/commit
pg_rewind: fsync target data directory.
authorAndres Freund <andres@anarazel.de>
Sun, 27 Mar 2016 21:46:25 +0000 (23:46 +0200)
committerAndres Freund <andres@anarazel.de>
Sun, 27 Mar 2016 21:47:36 +0000 (23:47 +0200)
commitc5b5168cfc5c7aa74ce95ef64b79c6633230f424
treefe89f4e4a7b321d7ddf910a7072d8f20de952f7a
parentfa5098da1ab11daaeba788a2f4106394218b6761
pg_rewind: fsync target data directory.

Previously pg_rewind did not fsync any files. That's problematic, given
that the target directory is modified. If the database was started
afterwards, 2ce439f33 luckily already caused the data directory to be
synced to disk at postmaster startup; reducing the scope of the problem.

To fix, use initdb -S, at the end of the pg_rewind run. It doesn't seem
worthwhile to duplicate the code into pg_rewind, and initdb -S is
already used that way by pg_upgrade.

Reported-By: Andres Freund
Author: Michael Paquier, somewhat edited by me
Discussion: 20160310034352.iuqgvpmg5qmnxtkz@alap3.anarazel.de
    CAB7nPqSytVG1o4S3S2pA1O=692ekurJ+fckW2PywEG3sNw54Ow@mail.gmail.com
Backpatch: 9.5, where pg_rewind was introduced
src/bin/pg_rewind/file_ops.c
src/bin/pg_rewind/pg_rewind.c