Report expected contrecord length on mismatch
authorAlvaro Herrera <[email protected]>
Fri, 4 Sep 2020 18:58:32 +0000 (14:58 -0400)
committerAlvaro Herrera <[email protected]>
Fri, 4 Sep 2020 18:58:32 +0000 (14:58 -0400)
When reading a WAL record fails to find continuation record(s) of the
proper length, report what it expects, for clarity.

Reviewed-by: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/20200903212152[email protected]

src/backend/access/transam/xlogreader.c

index 67996018da27690f84eda75cc9238fbfea96446a..a63ad8cfd0bfc594a38b1aac027d3e8cf7174a51 100644 (file)
@@ -464,8 +464,9 @@ XLogReadRecord(XLogReaderState *state, char **errormsg)
                total_len != (pageHeader->xlp_rem_len + gotlen))
            {
                report_invalid_record(state,
-                                     "invalid contrecord length %u at %X/%X",
+                                     "invalid contrecord length %u (expected %lld) at %X/%X",
                                      pageHeader->xlp_rem_len,
+                                     ((long long) total_len) - gotlen,
                                      (uint32) (RecPtr >> 32), (uint32) RecPtr);
                goto err;
            }