static void xact_desc_commit(StringInfo buf, xl_xact_commit *xlrec) { int i; TransactionId *subxacts; subxacts = (TransactionId *) &xlrec->xnodes[xlrec->nrels]; appendStringInfoString(buf, timestamptz_to_str(xlrec->xact_time)); if (xlrec->nrels > 0) { appendStringInfo(buf, "; rels:"); for (i = 0; i < xlrec->nrels; i++) { char *path = relpathperm(xlrec->xnodes[i], MAIN_FORKNUM); appendStringInfo(buf, " %s", path); pfree(path); } } if (xlrec->nsubxacts > 0) { appendStringInfo(buf, "; subxacts:"); for (i = 0; i < xlrec->nsubxacts; i++) appendStringInfo(buf, " %u", subxacts[i]); } if (xlrec->nmsgs > 0) { SharedInvalidationMessage *msgs; msgs = (SharedInvalidationMessage *) &subxacts[xlrec->nsubxacts]; if (XactCompletionRelcacheInitFileInval(xlrec->xinfo)) appendStringInfo(buf, "; relcache init file inval dbid %u tsid %u", xlrec->dbId, xlrec->tsId); appendStringInfo(buf, "; inval msgs:"); for (i = 0; i < xlrec->nmsgs; i++) { SharedInvalidationMessage *msg = &msgs[i]; if (msg->id >= 0) appendStringInfo(buf, " catcache %d", msg->id); else if (msg->id == SHAREDINVALCATALOG_ID) appendStringInfo(buf, " catalog %u", msg->cat.catId); else if (msg->id == SHAREDINVALRELCACHE_ID) appendStringInfo(buf, " relcache %u", msg->rc.relId); /* remaining cases not expected, but print something anyway */ else if (msg->id == SHAREDINVALSMGR_ID) appendStringInfo(buf, " smgr"); else if (msg->id == SHAREDINVALRELMAP_ID) appendStringInfo(buf, " relmap"); else appendStringInfo(buf, " unknown id %d", msg->id); } } }
static void xact_desc_commit(StringInfo buf, uint8 info, xl_xact_commit *xlrec, RepOriginId origin_id) { xl_xact_parsed_commit parsed; int i; ParseCommitRecord(info, xlrec, &parsed); /* If this is a prepared xact, show the xid of the original xact */ if (TransactionIdIsValid(parsed.twophase_xid)) appendStringInfo(buf, "%u: ", parsed.twophase_xid); appendStringInfoString(buf, timestamptz_to_str(xlrec->xact_time)); if (parsed.nrels > 0) { appendStringInfoString(buf, "; rels:"); for (i = 0; i < parsed.nrels; i++) { char *path = relpathperm(parsed.xnodes[i], MAIN_FORKNUM); appendStringInfo(buf, " %s", path); pfree(path); } } if (parsed.nsubxacts > 0) { appendStringInfoString(buf, "; subxacts:"); for (i = 0; i < parsed.nsubxacts; i++) appendStringInfo(buf, " %u", parsed.subxacts[i]); } if (parsed.nmsgs > 0) { if (XactCompletionRelcacheInitFileInval(parsed.xinfo)) appendStringInfo(buf, "; relcache init file inval dbid %u tsid %u", parsed.dbId, parsed.tsId); appendStringInfoString(buf, "; inval msgs:"); for (i = 0; i < parsed.nmsgs; i++) { SharedInvalidationMessage *msg = &parsed.msgs[i]; if (msg->id >= 0) appendStringInfo(buf, " catcache %d", msg->id); else if (msg->id == SHAREDINVALCATALOG_ID) appendStringInfo(buf, " catalog %u", msg->cat.catId); else if (msg->id == SHAREDINVALRELCACHE_ID) appendStringInfo(buf, " relcache %u", msg->rc.relId); /* not expected, but print something anyway */ else if (msg->id == SHAREDINVALSMGR_ID) appendStringInfoString(buf, " smgr"); /* not expected, but print something anyway */ else if (msg->id == SHAREDINVALRELMAP_ID) appendStringInfoString(buf, " relmap"); else if (msg->id == SHAREDINVALSNAPSHOT_ID) appendStringInfo(buf, " snapshot %u", msg->sn.relId); else appendStringInfo(buf, " unknown id %d", msg->id); } } if (XactCompletionForceSyncCommit(parsed.xinfo)) appendStringInfo(buf, "; sync"); if (parsed.xinfo & XACT_XINFO_HAS_ORIGIN) { appendStringInfo(buf, "; origin: node %u, lsn %X/%X, at %s", origin_id, (uint32)(parsed.origin_lsn >> 32), (uint32)parsed.origin_lsn, timestamptz_to_str(parsed.origin_timestamp)); }