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 98eb3e06ce
commit ca26c64581
No known key found for this signature in database
GPG Key ID: 1C20ACB9D5C564AE

View File

@ -101,7 +101,11 @@ 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",
(uint32) (endpoint >> 32), (uint32) (endpoint),
(uint32) (xlogreader->EndRecPtr >> 32), (uint32)
(xlogreader->EndRecPtr));
XLogReaderFree(xlogreader);
if (xlogreadfd != -1)