pg_upgrade: Upgrade an Assert to a real 'if' test

It seems possible for the condition being tested to be true in
production, and nobody would never know (except when some data
eventually becomes corrupt?).

Author: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m//202109040001.zky3wgv2qeqg@alvherre.pgsql
This commit is contained in:
Alvaro Herrera 2022-03-23 19:23:51 +01:00
parent 591767150f
commit 3e1c942a4e
No known key found for this signature in database
GPG Key ID: 1C20ACB9D5C564AE
1 changed files with 3 additions and 1 deletions

View File

@ -102,7 +102,9 @@ extractPageMap(const char *datadir, XLogRecPtr startpoint, int tliIndex,
* If 'endpoint' didn't point exactly at a record boundary, the caller
* messed up.
*/
Assert(xlogreader->EndRecPtr == endpoint);
if (xlogreader->EndRecPtr != endpoint)
pg_fatal("end pointer %X/%X is not a valid end point; expected %X/%X",
LSN_FORMAT_ARGS(endpoint), LSN_FORMAT_ARGS(xlogreader->EndRecPtr));
XLogReaderFree(xlogreader);
if (xlogreadfd != -1)