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

Commitc963e84

Browse files
committed
Make origin data initialization consistent other fields in 2PC header
As of1eb6d65, the origin data is optionally stored in a 2PC fileheader, with the data filled in EndPrepare() even in the default casewhere there is no origin data to add. This was inconsistent with allthe other fields of TwoPhaseFileHeader which are initialized inStartPrepare(), so move the initialization of origin_lsn andorigin_timestamp there instead. The effect of missing theinitialization at this early stage is only cosmetic based on the currentlogic of the code, but could have led to issues in the long-term, and itis more consistent done this way.Reported-by: Ranier VilelaDiscussion:https://postgr.es/m/CAEudQAooECJ+gU_RZB-yhioPOV94R4ucoHAf68PiJhLpgpVpBw@mail.gmail.com
1 parent994d767 commitc963e84

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,6 +1074,9 @@ StartPrepare(GlobalTransaction gxact)
10741074
hdr.ninvalmsgs=xactGetCommittedInvalidationMessages(&invalmsgs,
10751075
&hdr.initfileinval);
10761076
hdr.gidlen=strlen(gxact->gid)+1;/* Include '\0' */
1077+
/* EndPrepare will fill the origin data, if necessary */
1078+
hdr.origin_lsn=InvalidXLogRecPtr;
1079+
hdr.origin_timestamp=0;
10771080

10781081
save_state_data(&hdr,sizeof(TwoPhaseFileHeader));
10791082
save_state_data(gxact->gid,hdr.gidlen);
@@ -1133,11 +1136,6 @@ EndPrepare(GlobalTransaction gxact)
11331136
hdr->origin_lsn=replorigin_session_origin_lsn;
11341137
hdr->origin_timestamp=replorigin_session_origin_timestamp;
11351138
}
1136-
else
1137-
{
1138-
hdr->origin_lsn=InvalidXLogRecPtr;
1139-
hdr->origin_timestamp=0;
1140-
}
11411139

11421140
/*
11431141
* If the data size exceeds MaxAllocSize, we won't be able to read it in

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp