pg_rewind : feature to rewind promoted standby is broken!
Mithun Cy <mithun.cy@gmail.com>
From: Mithun Cy <mithun.cy@gmail.com>
To: pgsql-bugs@lists.postgresql.org, pgsql-hackers@lists.postgresql.org, michael.paquier@gmail.com, fujii@postgresql.org
Cc: kuntalghosh.2007@gmail.com, Robert Haas <robertmhaas@gmail.com>
Date: 2019-03-12T07:53:51Z
Lists: pgsql-bugs, pgsql-hackers
Attachments
- standby-server-setup.sh (application/x-sh)
I think pg_rewind's feature to rewind the promoted standby as a new standby is broken in 11 STEPS: 1. create master standby setup. Use below script for same. 2. Promote the standby [mithuncy@localhost pgrewmasterbin]$ ./bin/pg_ctl -D standby promote waiting for server to promote.... done server promoted 3. In promoted standby create a database and a table in the new database. [mithuncy@localhost pgrewmasterbin]$ ./bin/psql -p 5433 postgres postgres=# create database db1; CREATE DATABASE postgres=# \c db1 You are now connected to database "db1" as user "mithuncy". db1=# create table t1 (t int); CREATE TABLE 4. try to rewind the newly promoted standby (with old master as source) [mithuncy@localhost pgrewmasterbin]$ ./bin/pg_ctl -D standby stop waiting for server to shut down....... done server stopped [mithuncy@localhost pgrewmasterbin]$ ./bin/pg_rewind -D standby --source-server="host=127.0.0.1 port=5432 user=mithuncy dbname=postgres" servers diverged at WAL location 0/3000060 on timeline 1 rewinding from last common checkpoint at 0/2000060 on timeline 1 could not remove directory "standby/base/16384": Directory not empty Failure, exiting Note: dry run was successful! [mithuncy@localhost pgrewmasterbin]$ ./bin/pg_rewind -D standby --source-server="host=127.0.0.1 port=5432 user=mithuncy dbname=postgres" -n servers diverged at WAL location 0/3000060 on timeline 1 rewinding from last common checkpoint at 0/2000060 on timeline 1 Done! Also I have tested same in version 10 it works fine there. Did below commit has broken this feature? (Thanks to kuntal for identifying same) commit 266b6acb312fc440c1c1a2036aa9da94916beac6 Author: Fujii Masao <fujii@postgresql.org> Date: Thu Mar 29 04:56:52 2018 +0900 Make pg_rewind skip files and directories that are removed during server start. -- Thanks and Regards Mithun Chicklore Yogendra EnterpriseDB: http://www.enterprisedb.com
Commits
-
Fix pg_rewind when rewinding new database with tables included
- dcf2a0db8529 11.3 landed
- a7eadaaaaf08 12.0 landed
-
Make pg_rewind skip files and directories that are removed during server start.
- 266b6acb312f 11.0 cited