On Thu, Dec 15, 2016 at 11:25:10AM +0200, Heikki Linnakangas wrote: > On 12/15/2016 10:44 AM, Magnus Hagander wrote: > > I wonder if there might be more corner cases like this, but in this > > particular one it seems easy enough to just say that failing to rename > > recovery.conf because it didn't exist is safe. > > Yeah. It's unexpected though, so I think erroring out is quite reasonable. > If the recovery.conf file went missing, who knows what else is wrong.
i'd rather not mess up with the exiting behavior and just complain to the pilot to not do that. This enters in the category of not removing the backup_label file after taking a backup... > > But in the case of failing to rename recovery.conf for example because of > > permissions errors, we don't want to ignore it. But we also really don't > > want to end up with this kind of inconsistent data directory IMO. I don't > > know that code well enough to suggest how to fix it though -- hoping for > > input for someone who knows it closer? > > Hmm. Perhaps we should write the timeline history file only after renaming > recovery.conf. In general, we should keep the window between writing the > timeline history file and writing the end-of-recovery record as small as > possible. I don't think we can eliminate it completely, but it makes sense > to minimize it. Something like the attached (completely untested). I did some tests. And after a lookup it looks like a good thing to book the timeline number at an earlier step and let other nodes know about it. So +1 on it. Looking at PrescanPreparedTransactions(), I am thinking as well that it would be better to get a hard failure when bumping on a corrupted 2PC file. Future files are one thing, but corrupted files should be treated more carefully. -- Michael
Description: PGP signature