Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Fix description of WAL record XLOG_BTREE_META_CLEANUP
authorMichael Paquier <michael@paquier.xyz>
Wed, 19 Jun 2019 02:02:28 +0000 (11:02 +0900)
committerMichael Paquier <michael@paquier.xyz>
Wed, 19 Jun 2019 02:02:28 +0000 (11:02 +0900)
This record uses one metadata buffer and registers some data associated
to the buffer, but when parsing the record for its description a direct
access to the record data was done, but there is none.  This leads
usually to an incorrect description, but can also cause crashes like in
pg_waldump.  Instead, fix things so as the parsing uses the data
associated to the metadata block.

This is an oversight from 3d92796, so backpatch down to 11.

Author: Michael Paquier
Description: https://postgr.es/m/20190617013059.GA3153@paquier.xyz
Backpatch-through: 11

src/backend/access/rmgrdesc/nbtdesc.c

index 5c4457179de77359f077ebd4a8df5f64c06ab575..80bd70a9751038c58e5f2f03067988b55c40f9a4 100644 (file)
@@ -98,8 +98,10 @@ btree_desc(StringInfo buf, XLogReaderState *record)
            }
        case XLOG_BTREE_META_CLEANUP:
            {
-               xl_btree_metadata *xlrec = (xl_btree_metadata *) rec;
+               xl_btree_metadata *xlrec;
 
+               xlrec = (xl_btree_metadata *) XLogRecGetBlockData(record, 0,
+                                                                 NULL);
                appendStringInfo(buf, "oldest_btpo_xact %u; last_cleanup_num_heap_tuples: %f",
                                 xlrec->oldest_btpo_xact,
                                 xlrec->last_cleanup_num_heap_tuples);