Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit07a4a93

Browse files
committed
Initialize tsId and dbId fields in WAL record of COMMIT PREPARED.
Commitdd428c7 added dbId and tsId to the xl_xact_commit struct but missedthat prepared transaction commits reuse that struct. Fix that.Because those fields were left unitialized, replaying a commit prepared WALrecord in a hot standby node would fail to remove the relcache init file.That can lead to "could not open file" errors on the standby. Relcache initfile only needs to be removed when a system table/index is rewritten in thetransaction using two phase commit, so that should be rare in practice. InHEAD, the incorrect dbId/tsId values are also used for filtering in logicalreplication code, causing the transaction to always be filtered out.Analysis and fix by Andres Freund. Backpatch to 9.0 where hot standby wasintroduced.
1 parentf62d417 commit07a4a93

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎src/backend/access/transam/twophase.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2082,9 +2082,13 @@ RecordTransactionCommitPrepared(TransactionId xid,
20822082

20832083
/* Emit the XLOG commit record */
20842084
xlrec.xid=xid;
2085-
xlrec.crec.xact_time=GetCurrentTimestamp();
2085+
20862086
xlrec.crec.xinfo=initfileinval ?XACT_COMPLETION_UPDATE_RELCACHE_FILE :0;
2087-
xlrec.crec.nmsgs=0;
2087+
2088+
xlrec.crec.dbId=MyDatabaseId;
2089+
xlrec.crec.tsId=MyDatabaseTableSpace;
2090+
2091+
xlrec.crec.xact_time=GetCurrentTimestamp();
20882092
xlrec.crec.nrels=nrels;
20892093
xlrec.crec.nsubxacts=nchildren;
20902094
xlrec.crec.nmsgs=ninvalmsgs;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp