Re: pgsql: Add block information in error context of WAL REDO apply loop - Mailing list pgsql-committers

From Andres Freund
Subject Re: pgsql: Add block information in error context of WAL REDO apply loop
Date
Msg-id 20201006023802.qqfi6m5bw5y77zql@alap3.anarazel.de
Whole thread Raw
In response to pgsql: Add block information in error context of WAL REDO apply loop  (Michael Paquier <michael@paquier.xyz>)
Responses Re: pgsql: Add block information in error context of WAL REDO apply loop  (Michael Paquier <michael@paquier.xyz>)
List pgsql-committers
Hi,

On 2020-10-02 00:41:12 +0000, Michael Paquier wrote:
> Add block information in error context of WAL REDO apply loop
> 
> Providing this information can be useful for example when diagnosing
> problems related to recovery conflicts or for recovery issues without
> having to go through the output generated by pg_waldump to get some
> information about the blocks a WAL record works on.
> 
> The block information is printed in the same format as pg_waldump.  This
> already existed in xlog.c for debugging purposes with -DWAL_DEBUG, so
> adding the block information in the callback has required just a small
> refactoring.
> 
> Author: Bertrand Drouvot
> Reviewed-by: Michael Paquier, Masahiko Sawada
> Discussion: https://postgr.es/m/c31e2cba-efda-762c-f4ad-5c25e5dac3d0@amazon.com

My compiler quite justifiably complains about:

+#endif                          /* WAL_DEBUG */
+
+/*
+ * Returns a string giving information about all the blocks in an
+ * XLogRecord.
+ */
+static void
+xlog_block_info(StringInfo buf, XLogReaderState *record)
+{
+    int         block_id;
+
     /* decode block references */
     for (block_id = 0; block_id <= record->max_block_id; block_id++)
     {
@@ -10284,7 +10298,6 @@ xlog_outrec(StringInfo buf, XLogReaderState *record)
             appendStringInfoString(buf, " FPW");
     }
 }
-#endif                          /* WAL_DEBUG */

because as far as I can see there's no remaining use of block_id in
xlog_outrec() after this change.

Greetings,

Andres Freund



pgsql-committers by date:

Previous
From: Andres Freund
Date:
Subject: pgsql: Try to unbreak 021_row_visibility.pl on mingw.
Next
From: Michael Paquier
Date:
Subject: pgsql: Fix compilation warning in xlog.c