On 2 February 2018 at 02:17, Michael Paquier <michael.paqu...@gmail.com> wrote: > On Fri, Feb 02, 2018 at 12:21:49AM +0000, Simon Riggs wrote: >> Yes, it would be about 99% of the time. > > When it comes to recovery, I don't think that 99% is a guarantee > sufficient. (Wondering about the maths behind such a number as well.) > >> But you have it backwards - we are not assuming that case. That is the >> only case that has risk - the one where an old WAL record starts at >> exactly the place the latest one stops. Otherwise the rest of the WAL >> record will certainly fail the CRC check, since it will effectively >> have random data in it, as you say. > > Your patch assumes that a single WAL segment recycling is fine to > escape based on the file name, but you need to think beyond that. It > seems to me that your assumption is wrong if the tail of a segment gets > reused after more cycles than a single one, which could happen when > doing recovery from an archive, where segments used could have junk in > them. So you actually *increase* the odds of problems if a segment is > forcibly switched and archived, then reused in recovery after being > fetched from an archive.
This seems to be a pivotal point in your argument, yet it is just an assertion. Please explain for the archive why you think the odds increase in the way you describe. Thanks -- Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services