aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/rmgrdesc/heapdesc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/rmgrdesc/heapdesc.c')
-rw-r--r--src/backend/access/rmgrdesc/heapdesc.c123
1 files changed, 89 insertions, 34 deletions
diff --git a/src/backend/access/rmgrdesc/heapdesc.c b/src/backend/access/rmgrdesc/heapdesc.c
index 24b6f92bd55..cd9d59d6af8 100644
--- a/src/backend/access/rmgrdesc/heapdesc.c
+++ b/src/backend/access/rmgrdesc/heapdesc.c
@@ -51,17 +51,12 @@ heap_desc(StringInfo buf, XLogRecord *record)
{
xl_heap_insert *xlrec = (xl_heap_insert *) rec;
- if (record->xl_info & XLOG_HEAP_INIT_PAGE)
- appendStringInfoString(buf, "insert(init): ");
- else
- appendStringInfoString(buf, "insert: ");
out_target(buf, &(xlrec->target));
}
else if (info == XLOG_HEAP_DELETE)
{
xl_heap_delete *xlrec = (xl_heap_delete *) rec;
- appendStringInfoString(buf, "delete: ");
out_target(buf, &(xlrec->target));
appendStringInfoChar(buf, ' ');
out_infobits(buf, xlrec->infobits_set);
@@ -70,10 +65,6 @@ heap_desc(StringInfo buf, XLogRecord *record)
{
xl_heap_update *xlrec = (xl_heap_update *) rec;
- if (record->xl_info & XLOG_HEAP_INIT_PAGE)
- appendStringInfoString(buf, "update(init): ");
- else
- appendStringInfoString(buf, "update: ");
out_target(buf, &(xlrec->target));
appendStringInfo(buf, " xmax %u ", xlrec->old_xmax);
out_infobits(buf, xlrec->old_infobits_set);
@@ -86,10 +77,6 @@ heap_desc(StringInfo buf, XLogRecord *record)
{
xl_heap_update *xlrec = (xl_heap_update *) rec;
- if (record->xl_info & XLOG_HEAP_INIT_PAGE) /* can this case happen? */
- appendStringInfoString(buf, "hot_update(init): ");
- else
- appendStringInfoString(buf, "hot_update: ");
out_target(buf, &(xlrec->target));
appendStringInfo(buf, " xmax %u ", xlrec->old_xmax);
out_infobits(buf, xlrec->old_infobits_set);
@@ -102,7 +89,7 @@ heap_desc(StringInfo buf, XLogRecord *record)
{
xl_heap_lock *xlrec = (xl_heap_lock *) rec;
- appendStringInfo(buf, "lock %u: ", xlrec->locking_xid);
+ appendStringInfo(buf, "xid %u: ", xlrec->locking_xid);
out_target(buf, &(xlrec->target));
appendStringInfoChar(buf, ' ');
out_infobits(buf, xlrec->infobits_set);
@@ -111,11 +98,8 @@ heap_desc(StringInfo buf, XLogRecord *record)
{
xl_heap_inplace *xlrec = (xl_heap_inplace *) rec;
- appendStringInfoString(buf, "inplace: ");
out_target(buf, &(xlrec->target));
}
- else
- appendStringInfoString(buf, "UNKNOWN");
}
void
heap2_desc(StringInfo buf, XLogRecord *record)
@@ -128,7 +112,7 @@ heap2_desc(StringInfo buf, XLogRecord *record)
{
xl_heap_clean *xlrec = (xl_heap_clean *) rec;
- appendStringInfo(buf, "clean: rel %u/%u/%u; blk %u remxid %u",
+ appendStringInfo(buf, "rel %u/%u/%u; blk %u remxid %u",
xlrec->node.spcNode, xlrec->node.dbNode,
xlrec->node.relNode, xlrec->block,
xlrec->latestRemovedXid);
@@ -137,27 +121,22 @@ heap2_desc(StringInfo buf, XLogRecord *record)
{
xl_heap_freeze_page *xlrec = (xl_heap_freeze_page *) rec;
- appendStringInfo(buf, "freeze_page: rel %u/%u/%u; blk %u; cutoff xid %u ntuples %u",
+ appendStringInfo(buf, "rel %u/%u/%u; blk %u; cutoff xid %u ntuples %u",
xlrec->node.spcNode, xlrec->node.dbNode,
xlrec->node.relNode, xlrec->block,
xlrec->cutoff_xid, xlrec->ntuples);
}
- else if (info == XLOG_HEAP2_REWRITE)
- {
- appendStringInfoString(buf, "heap rewrite:");
- }
else if (info == XLOG_HEAP2_CLEANUP_INFO)
{
xl_heap_cleanup_info *xlrec = (xl_heap_cleanup_info *) rec;
- appendStringInfo(buf, "cleanup info: remxid %u",
- xlrec->latestRemovedXid);
+ appendStringInfo(buf, "remxid %u", xlrec->latestRemovedXid);
}
else if (info == XLOG_HEAP2_VISIBLE)
{
xl_heap_visible *xlrec = (xl_heap_visible *) rec;
- appendStringInfo(buf, "visible: rel %u/%u/%u; blk %u",
+ appendStringInfo(buf, "rel %u/%u/%u; blk %u",
xlrec->node.spcNode, xlrec->node.dbNode,
xlrec->node.relNode, xlrec->block);
}
@@ -165,10 +144,6 @@ heap2_desc(StringInfo buf, XLogRecord *record)
{
xl_heap_multi_insert *xlrec = (xl_heap_multi_insert *) rec;
- if (record->xl_info & XLOG_HEAP_INIT_PAGE)
- appendStringInfoString(buf, "multi-insert (init): ");
- else
- appendStringInfoString(buf, "multi-insert: ");
appendStringInfo(buf, "rel %u/%u/%u; blk %u; %d tuples",
xlrec->node.spcNode, xlrec->node.dbNode, xlrec->node.relNode,
xlrec->blkno, xlrec->ntuples);
@@ -177,7 +152,7 @@ heap2_desc(StringInfo buf, XLogRecord *record)
{
xl_heap_lock_updated *xlrec = (xl_heap_lock_updated *) rec;
- appendStringInfo(buf, "lock updated: xmax %u msk %04x; ", xlrec->xmax,
+ appendStringInfo(buf, "xmax %u msk %04x; ", xlrec->xmax,
xlrec->infobits_set);
out_target(buf, &(xlrec->target));
}
@@ -185,11 +160,91 @@ heap2_desc(StringInfo buf, XLogRecord *record)
{
xl_heap_new_cid *xlrec = (xl_heap_new_cid *) rec;
- appendStringInfo(buf, "new_cid: ");
out_target(buf, &(xlrec->target));
appendStringInfo(buf, "; cmin: %u, cmax: %u, combo: %u",
xlrec->cmin, xlrec->cmax, xlrec->combocid);
}
- else
- appendStringInfoString(buf, "UNKNOWN");
+}
+
+static const char *
+append_init(const char *str)
+{
+ static char x[32];
+
+ strcpy(x, str);
+ strcat(x, "+INIT");
+
+ return x;
+}
+
+const char *
+heap_identify(uint8 info)
+{
+ const char *id = NULL;
+
+ switch (info & XLOG_HEAP_OPMASK)
+ {
+ case XLOG_HEAP_INSERT:
+ id = "INSERT";
+ break;
+ case XLOG_HEAP_DELETE:
+ id = "DELETE";
+ break;
+ case XLOG_HEAP_UPDATE:
+ id = "UPDATE";
+ break;
+ case XLOG_HEAP_HOT_UPDATE:
+ id = "HOT_UPDATE";
+ break;
+ case XLOG_HEAP_LOCK:
+ id = "LOCK";
+ break;
+ case XLOG_HEAP_INPLACE:
+ id = "INPLACE";
+ break;
+ }
+
+ if (info & XLOG_HEAP_INIT_PAGE)
+ id = append_init(id);
+
+ return id;
+}
+
+const char *
+heap2_identify(uint8 info)
+{
+ const char *id = NULL;
+
+ switch (info & XLOG_HEAP_OPMASK)
+ {
+ case XLOG_HEAP2_CLEAN:
+ id = "CLEAN";
+ break;
+ case XLOG_HEAP2_FREEZE_PAGE:
+ id = "FREEZE_PAGE";
+ break;
+ case XLOG_HEAP2_CLEANUP_INFO:
+ id = "CLEANUP_INFO";
+ break;
+ case XLOG_HEAP2_VISIBLE:
+ id = "VISIBLE";
+ break;
+ case XLOG_HEAP2_MULTI_INSERT:
+ id = "MULTI_INSERT";
+ break;
+ case XLOG_HEAP2_LOCK_UPDATED:
+ id = "LOCK_UPDATED";
+ break;
+ case XLOG_HEAP2_NEW_CID:
+ id = "NEW_CID";
+ break;
+ case XLOG_HEAP2_REWRITE:
+ id = "REWRITE";
+ break;
+ }
+
+ if (info & XLOG_HEAP_INIT_PAGE)
+ id = append_init(id);
+
+ return id;
}