On Tue, Feb 27, 2018 at 07:40:27AM +0000, Kato, Sho wrote: > I came up with an another scenario where user uses a synchronized old > master as a new master. > If so, pg_rewind need to copy WAL from a source server. > Is pg_rewind assuming to use the old master as a new master?
The rewound instance needs to replay WAL from the last checkpoint where WAL forked at promotion up to the point where WAL is being inserted on the new primary when running pg_rewind, hence the rewound server needs to follow the new, promoted, server anyway. So you would be able to use a rewound instance only after it has reached a consistent state, and only after it has replayed on the new timeline. So I don't see how much that would be useful, the promoted server is going the new leader anyway, so trying to make a rewound server again the leader just complicates your HA flow. > If pg_rewind is used only for a standby server installation, > pg_rewind does not need to get WAL from source server, does it? Not necessarily. You can always have an archive. The rewound instance will likely need WAL segments on the new timeline though, after promoting the new standby, please do not forget that a checkpoint needs to be issued on it so as its control file is updated to reflect on-disk its new timeline number that pg_rewind uses as a reference. In 10 and older versions, the odds of not needing an archive are higher than in v11 since we have removed the need of the secondary last checkpoint on HEAD: WAL recycling is faster now. -- Michael
signature.asc
Description: PGP signature