Hi all, I was just playing with the WAL consistency issue with rows moved across partitions when I noticed that heapdesc.c is not really talkative about the different flag records set.
What about something like the patch attached? I found that useful for debugging. (One comment of heapam_xlog.h mentions xl_heap_delete instead of xl_heap_truncate, noticed it on the way.) Thanks, -- Michael
diff --git a/src/backend/access/rmgrdesc/heapdesc.c b/src/backend/access/rmgrdesc/heapdesc.c index 318a281d7f..f03dbca55b 100644 --- a/src/backend/access/rmgrdesc/heapdesc.c +++ b/src/backend/access/rmgrdesc/heapdesc.c @@ -42,12 +42,32 @@ heap_desc(StringInfo buf, XLogReaderState *record) { xl_heap_insert *xlrec = (xl_heap_insert *) rec; + if (xlrec->flags & XLH_INSERT_ALL_VISIBLE_CLEARED) + appendStringInfo(buf, "all_visible_cleared "); + if (xlrec->flags & XLH_INSERT_LAST_IN_MULTI) + appendStringInfo(buf, "last_in_multi "); + if (xlrec->flags & XLH_INSERT_IS_SPECULATIVE) + appendStringInfo(buf, "is_speculative "); + if (xlrec->flags & XLH_INSERT_CONTAINS_NEW_TUPLE) + appendStringInfo(buf, "contains_new_tuple "); + appendStringInfo(buf, "off %u", xlrec->offnum); } else if (info == XLOG_HEAP_DELETE) { xl_heap_delete *xlrec = (xl_heap_delete *) rec; + if (xlrec->flags & XLH_DELETE_ALL_VISIBLE_CLEARED) + appendStringInfo(buf, "all_visible_cleared "); + if (xlrec->flags & XLH_DELETE_CONTAINS_OLD_TUPLE) + appendStringInfo(buf, "contains_old_tuple "); + if (xlrec->flags & XLH_DELETE_CONTAINS_OLD_KEY) + appendStringInfo(buf, "contains_old_key "); + if (xlrec->flags & XLH_DELETE_IS_SUPER) + appendStringInfo(buf, "is_super "); + if (xlrec->flags & XLH_DELETE_IS_PARTITION_MOVE) + appendStringInfo(buf, "is_partition_move "); + appendStringInfo(buf, "off %u ", xlrec->offnum); out_infobits(buf, xlrec->infobits_set); } @@ -55,6 +75,21 @@ heap_desc(StringInfo buf, XLogReaderState *record) { xl_heap_update *xlrec = (xl_heap_update *) rec; + if (xlrec->flags & XLH_UPDATE_OLD_ALL_VISIBLE_CLEARED) + appendStringInfo(buf, "old_all_visible_cleared "); + if (xlrec->flags & XLH_UPDATE_NEW_ALL_VISIBLE_CLEARED) + appendStringInfo(buf, "new_all_visible_cleared "); + if (xlrec->flags & XLH_UPDATE_CONTAINS_OLD_TUPLE) + appendStringInfo(buf, "contains_old_tuple "); + if (xlrec->flags & XLH_UPDATE_CONTAINS_OLD_KEY) + appendStringInfo(buf, "contains_old_key "); + if (xlrec->flags & XLH_UPDATE_CONTAINS_NEW_TUPLE) + appendStringInfo(buf, "contains_new_tuple "); + if (xlrec->flags & XLH_UPDATE_PREFIX_FROM_OLD) + appendStringInfo(buf, "prefix_from_old "); + if (xlrec->flags & XLH_UPDATE_SUFFIX_FROM_OLD) + appendStringInfo(buf, "suffix_from_old "); + appendStringInfo(buf, "off %u xmax %u ", xlrec->old_offnum, xlrec->old_xmax); @@ -146,6 +181,15 @@ heap2_desc(StringInfo buf, XLogReaderState *record) { xl_heap_multi_insert *xlrec = (xl_heap_multi_insert *) rec; + if (xlrec->flags & XLH_INSERT_ALL_VISIBLE_CLEARED) + appendStringInfo(buf, "all_visible_cleared "); + if (xlrec->flags & XLH_INSERT_LAST_IN_MULTI) + appendStringInfo(buf, "last_in_multi "); + if (xlrec->flags & XLH_INSERT_IS_SPECULATIVE) + appendStringInfo(buf, "is_speculative "); + if (xlrec->flags & XLH_INSERT_CONTAINS_NEW_TUPLE) + appendStringInfo(buf, "contains_new_tuple "); + appendStringInfo(buf, "%d tuples", xlrec->ntuples); } else if (info == XLOG_HEAP2_LOCK_UPDATED) diff --git a/src/include/access/heapam_xlog.h b/src/include/access/heapam_xlog.h index cf88ff7cb4..cc85f4b3c7 100644 --- a/src/include/access/heapam_xlog.h +++ b/src/include/access/heapam_xlog.h @@ -111,7 +111,7 @@ typedef struct xl_heap_delete #define SizeOfHeapDelete (offsetof(xl_heap_delete, flags) + sizeof(uint8)) /* - * xl_heap_delete flag values, 8 bits are available. + * xl_heap_truncate flag values, 8 bits are available. */ #define XLH_TRUNCATE_CASCADE (1<<0) #define XLH_TRUNCATE_RESTART_SEQS (1<<1)
signature.asc
Description: PGP signature