aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam
diff options
context:
space:
mode:
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>2018-04-17 16:10:42 -0400
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>2018-04-17 16:10:42 -0400
commitcf5a1890592bfa2f45d306789533efba97496233 (patch)
tree92f978a9d69f0235d83359574767758d96b5f70f /src/backend/access/transam
parentb7e2cbc5b49fbab5bc286b9e4cd4062a6703e7a7 (diff)
downloadpostgresql-cf5a1890592bfa2f45d306789533efba97496233.tar.gz
postgresql-cf5a1890592bfa2f45d306789533efba97496233.zip
Fix confusion on the padding of GIDs in on commit and abort records.
Review of commit 1eb6d652: It's pointless to add padding to the GID fields, when the code that follows assumes that there is no alignment, and uses memcpy(). Remove the pointless padding. Update comments to note the new fields in the WAL records. Reviewed-by: Michael Paquier Discussion: https://www.postgresql.org/message-id/33b787bf-dc20-1161-54e9-3f3b607bf59d%40iki.fi
Diffstat (limited to 'src/backend/access/transam')
-rw-r--r--src/backend/access/transam/twophase.c2
-rw-r--r--src/backend/access/transam/xact.c24
2 files changed, 4 insertions, 22 deletions
diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index d6e4b7980f3..5c05d545c46 100644
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -1129,9 +1129,11 @@ EndPrepare(GlobalTransaction gxact)
gxact->prepare_end_lsn = XLogInsert(RM_XACT_ID, XLOG_XACT_PREPARE);
if (replorigin)
+ {
/* Move LSNs forward for this replication origin */
replorigin_session_advance(replorigin_session_origin_lsn,
gxact->prepare_end_lsn);
+ }
XLogFlush(gxact->prepare_end_lsn);
diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c
index 948733c1e3d..4747353bb93 100644
--- a/src/backend/access/transam/xact.c
+++ b/src/backend/access/transam/xact.c
@@ -5245,9 +5245,7 @@ XactLogCommitRecord(TimestampTz commit_time,
xl_xact_invals xl_invals;
xl_xact_twophase xl_twophase;
xl_xact_origin xl_origin;
-
uint8 info;
- int gidlen = 0;
Assert(CritSectionCount > 0);
@@ -5313,10 +5311,7 @@ XactLogCommitRecord(TimestampTz commit_time,
Assert(twophase_gid != NULL);
if (XLogLogicalInfoActive())
- {
xl_xinfo.xinfo |= XACT_XINFO_HAS_GID;
- gidlen = strlen(twophase_gid) + 1; /* include '\0' */
- }
}
/* dump transaction origin information */
@@ -5370,12 +5365,7 @@ XactLogCommitRecord(TimestampTz commit_time,
{
XLogRegisterData((char *) (&xl_twophase), sizeof(xl_xact_twophase));
if (xl_xinfo.xinfo & XACT_XINFO_HAS_GID)
- {
- static const char zeroes[MAXIMUM_ALIGNOF] = { 0 };
- XLogRegisterData((char*) twophase_gid, gidlen);
- if (MAXALIGN(gidlen) != gidlen)
- XLogRegisterData((char*) zeroes, MAXALIGN(gidlen) - gidlen);
- }
+ XLogRegisterData((char *) twophase_gid, strlen(twophase_gid));
}
if (xl_xinfo.xinfo & XACT_XINFO_HAS_ORIGIN)
@@ -5409,7 +5399,6 @@ XactLogAbortRecord(TimestampTz abort_time,
xl_xact_origin xl_origin;
uint8 info;
- int gidlen = 0;
Assert(CritSectionCount > 0);
@@ -5448,10 +5437,7 @@ XactLogAbortRecord(TimestampTz abort_time,
Assert(twophase_gid != NULL);
if (XLogLogicalInfoActive())
- {
xl_xinfo.xinfo |= XACT_XINFO_HAS_GID;
- gidlen = strlen(twophase_gid) + 1; /* include '\0' */
- }
}
if (TransactionIdIsValid(twophase_xid) && XLogLogicalInfoActive())
@@ -5487,7 +5473,6 @@ XactLogAbortRecord(TimestampTz abort_time,
if (xl_xinfo.xinfo & XACT_XINFO_HAS_DBINFO)
XLogRegisterData((char *) (&xl_dbinfo), sizeof(xl_dbinfo));
-
if (xl_xinfo.xinfo & XACT_XINFO_HAS_SUBXACTS)
{
XLogRegisterData((char *) (&xl_subxacts),
@@ -5508,12 +5493,7 @@ XactLogAbortRecord(TimestampTz abort_time,
{
XLogRegisterData((char *) (&xl_twophase), sizeof(xl_xact_twophase));
if (xl_xinfo.xinfo & XACT_XINFO_HAS_GID)
- {
- static const char zeroes[MAXIMUM_ALIGNOF] = { 0 };
- XLogRegisterData((char*) twophase_gid, gidlen);
- if (MAXALIGN(gidlen) != gidlen)
- XLogRegisterData((char*) zeroes, MAXALIGN(gidlen) - gidlen);
- }
+ XLogRegisterData((char *) twophase_gid, strlen(twophase_gid) + 1);
}
if (xl_xinfo.xinfo & XACT_XINFO_HAS_ORIGIN)