Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 3df08c0

Browse files
committed
Fix XactLogAbortRecord
1 parent 40e46be commit 3df08c0

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

contrib/mmts/multimaster.c

+4-1
Original file line numberDiff line numberDiff line change
@@ -3320,6 +3320,8 @@ MtmReplicationStartupHook(struct PGLogicalStartupHookArgs* args)
33203320
MTM_LOG1("Recovered position of node %d is %lx", MtmReplicationNodeId, recoveredLSN);
33213321
if (Mtm->nodes[MtmReplicationNodeId-1].restartLSN < recoveredLSN) {
33223322
MTM_LOG2("[restartlsn] node %d: %lx -> %lx (MtmReplicationStartupHook)", MtmReplicationNodeId, Mtm->nodes[MtmReplicationNodeId-1].restartLSN, recoveredLSN);
3323+
Assert(Mtm->nodes[MtmReplicationNodeId-1].restartLSN == InvalidXLogRecPtr
3324+
|| recoveredLSN < Mtm->nodes[MtmReplicationNodeId-1].restartLSN + MtmMaxRecoveryLag);
33233325
Mtm->nodes[MtmReplicationNodeId-1].restartLSN = recoveredLSN;
33243326
}
33253327
} else {
@@ -3533,7 +3535,8 @@ bool MtmFilterTransaction(char* record, int size)
35333535
}
35343536
restart_lsn = origin_node == MtmReplicationNodeId ? end_lsn : origin_lsn;
35353537
if (Mtm->nodes[origin_node-1].restartLSN < restart_lsn) {
3536-
Assert(restart_lsn != InvalidXLogRecPtr);
3538+
Assert(Mtm->nodes[origin_node-1].restartLSN == InvalidXLogRecPtr
3539+
|| restart_lsn < Mtm->nodes[origin_node-1].restartLSN + MtmMaxRecoveryLag);
35373540
MTM_LOG2("[restartlsn] node %d: %lx -> %lx (MtmFilterTransaction)", MtmReplicationNodeId, Mtm->nodes[MtmReplicationNodeId-1].restartLSN, restart_lsn);
35383541
Mtm->nodes[origin_node-1].restartLSN = restart_lsn;
35393542
} else {

contrib/mmts/tests2/test_regression.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def setUpClass(self):
1515
@classmethod
1616
def tearDownClass(self):
1717
print('tearDown')
18-
#subprocess.check_call(['docker-compose','down'])
18+
subprocess.check_call(['docker-compose','down'])
1919

2020
def test_regression(self):
2121
# XXX: make smth clever here

src/backend/access/rmgrdesc/xactdesc.c

+11-2
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ xact_desc_commit(StringInfo buf, uint8 info, xl_xact_commit *xlrec, RepOriginId
252252
}
253253

254254
static void
255-
xact_desc_abort(StringInfo buf, uint8 info, xl_xact_abort *xlrec)
255+
xact_desc_abort(StringInfo buf, uint8 info, xl_xact_abort *xlrec, RepOriginId origin_id)
256256
{
257257
xl_xact_parsed_abort parsed;
258258
int i;
@@ -282,6 +282,14 @@ xact_desc_abort(StringInfo buf, uint8 info, xl_xact_abort *xlrec)
282282
for (i = 0; i < parsed.nsubxacts; i++)
283283
appendStringInfo(buf, " %u", parsed.subxacts[i]);
284284
}
285+
if (parsed.xinfo & XACT_XINFO_HAS_ORIGIN)
286+
{
287+
appendStringInfo(buf, "; origin: node %u, lsn %X/%X, at %s",
288+
origin_id,
289+
(uint32) (parsed.origin_lsn >> 32),
290+
(uint32) parsed.origin_lsn,
291+
timestamptz_to_str(parsed.origin_timestamp));
292+
}
285293
}
286294

287295
static void
@@ -312,7 +320,8 @@ xact_desc(StringInfo buf, XLogReaderState *record)
312320
{
313321
xl_xact_abort *xlrec = (xl_xact_abort *) rec;
314322

315-
xact_desc_abort(buf, XLogRecGetInfo(record), xlrec);
323+
xact_desc_abort(buf, XLogRecGetInfo(record), xlrec,
324+
XLogRecGetOrigin(record));
316325
}
317326
else if (info == XLOG_XACT_ASSIGNMENT)
318327
{

src/backend/access/transam/xact.c

-3
Original file line numberDiff line numberDiff line change
@@ -5358,9 +5358,6 @@ XactLogAbortRecord(TimestampTz abort_time,
53585358
XLogRegisterData((char *) twophase_gid, xl_twophase.gidlen);
53595359
}
53605360

5361-
if (xl_xinfo.xinfo & XACT_XINFO_HAS_DBINFO)
5362-
XLogRegisterData((char *) (&xl_dbinfo), sizeof(xl_dbinfo));
5363-
53645361
if (xl_xinfo.xinfo & XACT_XINFO_HAS_ORIGIN)
53655362
XLogRegisterData((char *) (&xl_origin), sizeof(xl_xact_origin));
53665363

0 commit comments

Comments
 (0)