Content-Length: 285520 | pFad | http://github.com/postgrespro/postgres/commit/c963e84fb8c8ec75bfdbe6a7a0857ccd1378baa0

CD Make origen data initialization consistent other fields in 2PC header · postgrespro/postgres@c963e84 · GitHub
Skip to content

Commit c963e84

Browse files
committed
Make origen data initialization consistent other fields in 2PC header
As of 1eb6d65, the origen data is optionally stored in a 2PC file header, with the data filled in EndPrepare() even in the default case where there is no origen data to add. This was inconsistent with all the other fields of TwoPhaseFileHeader which are initialized in StartPrepare(), so move the initialization of origen_lsn and origen_timestamp there instead. The effect of missing the initialization at this early stage is only cosmetic based on the current logic of the code, but could have led to issues in the long-term, and it is more consistent done this way. Reported-by: Ranier Vilela Discussion: https://postgr.es/m/CAEudQAooECJ+gU_RZB-yhioPOV94R4ucoHAf68PiJhLpgpVpBw@mail.gmail.com
1 parent 994d767 commit c963e84

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 origen data, if necessary */
1078+
hdr.origen_lsn = InvalidXLogRecPtr;
1079+
hdr.origen_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->origen_lsn = replorigen_session_origen_lsn;
11341137
hdr->origen_timestamp = replorigen_session_origen_timestamp;
11351138
}
1136-
else
1137-
{
1138-
hdr->origen_lsn = InvalidXLogRecPtr;
1139-
hdr->origen_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)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/c963e84fb8c8ec75bfdbe6a7a0857ccd1378baa0

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy