Skip to content

Commit 911883e

Browse files
author
Alexander Korotkov
committed
Fix alignment issues.
1 parent 5d8e058 commit 911883e

File tree

3 files changed

+43
-44
lines changed

3 files changed

+43
-44
lines changed

src/backend/access/rmgrdesc/xactdesc.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,15 @@ ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *pars
7373
data += parsed->nsubxacts * sizeof(TransactionId);
7474
}
7575

76+
if (parsed->xinfo & XACT_XINFO_HAS_TWOPHASE)
77+
{
78+
xl_xact_twophase *xl_twophase = (xl_xact_twophase *) data;
79+
80+
parsed->twophase_xid = xl_twophase->xid;
81+
82+
data += sizeof(xl_xact_twophase);
83+
}
84+
7685
if (parsed->xinfo & XACT_XINFO_HAS_RELFILENODES)
7786
{
7887
xl_xact_relfilenodes *xl_relfilenodes = (xl_xact_relfilenodes *) data;
@@ -95,15 +104,6 @@ ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *pars
95104
data += xl_invals->nmsgs * sizeof(SharedInvalidationMessage);
96105
}
97106

98-
if (parsed->xinfo & XACT_XINFO_HAS_TWOPHASE)
99-
{
100-
xl_xact_twophase *xl_twophase = (xl_xact_twophase *) data;
101-
102-
parsed->twophase_xid = xl_twophase->xid;
103-
104-
data += sizeof(xl_xact_twophase);
105-
}
106-
107107
if (parsed->xinfo & XACT_XINFO_HAS_ORIGIN)
108108
{
109109
xl_xact_origin xl_origin;
@@ -150,6 +150,15 @@ ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed)
150150
data += parsed->nsubxacts * sizeof(TransactionId);
151151
}
152152

153+
if (parsed->xinfo & XACT_XINFO_HAS_TWOPHASE)
154+
{
155+
xl_xact_twophase *xl_twophase = (xl_xact_twophase *) data;
156+
157+
parsed->twophase_xid = xl_twophase->xid;
158+
159+
data += sizeof(xl_xact_twophase);
160+
}
161+
153162
if (parsed->xinfo & XACT_XINFO_HAS_RELFILENODES)
154163
{
155164
xl_xact_relfilenodes *xl_relfilenodes = (xl_xact_relfilenodes *) data;
@@ -160,15 +169,6 @@ ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed)
160169
data += MinSizeOfXactRelfilenodes;
161170
data += xl_relfilenodes->nrels * sizeof(RelFileNode);
162171
}
163-
164-
if (parsed->xinfo & XACT_XINFO_HAS_TWOPHASE)
165-
{
166-
xl_xact_twophase *xl_twophase = (xl_xact_twophase *) data;
167-
168-
parsed->twophase_xid = xl_twophase->xid;
169-
170-
data += sizeof(xl_xact_twophase);
171-
}
172172
}
173173

174174
static void

src/backend/access/transam/xact.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5110,9 +5110,9 @@ XactLogCommitRecord(TimestampTz commit_time,
51105110
xl_xact_xinfo xl_xinfo;
51115111
xl_xact_dbinfo xl_dbinfo;
51125112
xl_xact_subxacts xl_subxacts;
5113+
xl_xact_twophase xl_twophase;
51135114
xl_xact_relfilenodes xl_relfilenodes;
51145115
xl_xact_invals xl_invals;
5115-
xl_xact_twophase xl_twophase;
51165116
xl_xact_origin xl_origin;
51175117

51185118
uint8 info;
@@ -5160,6 +5160,12 @@ XactLogCommitRecord(TimestampTz commit_time,
51605160
xl_subxacts.nsubxacts = nsubxacts;
51615161
}
51625162

5163+
if (TransactionIdIsValid(twophase_xid))
5164+
{
5165+
xl_xinfo.xinfo |= XACT_XINFO_HAS_TWOPHASE;
5166+
xl_twophase.xid = twophase_xid;
5167+
}
5168+
51635169
if (nrels > 0)
51645170
{
51655171
xl_xinfo.xinfo |= XACT_XINFO_HAS_RELFILENODES;
@@ -5172,12 +5178,6 @@ XactLogCommitRecord(TimestampTz commit_time,
51725178
xl_invals.nmsgs = nmsgs;
51735179
}
51745180

5175-
if (TransactionIdIsValid(twophase_xid))
5176-
{
5177-
xl_xinfo.xinfo |= XACT_XINFO_HAS_TWOPHASE;
5178-
xl_twophase.xid = twophase_xid;
5179-
}
5180-
51815181
/* dump transaction origin information */
51825182
if (replorigin_session_origin != InvalidRepOriginId)
51835183
{
@@ -5252,8 +5252,8 @@ XactLogAbortRecord(TimestampTz abort_time,
52525252
xl_xact_abort xlrec;
52535253
xl_xact_xinfo xl_xinfo;
52545254
xl_xact_subxacts xl_subxacts;
5255-
xl_xact_relfilenodes xl_relfilenodes;
52565255
xl_xact_twophase xl_twophase;
5256+
xl_xact_relfilenodes xl_relfilenodes;
52575257

52585258
uint8 info;
52595259

@@ -5278,18 +5278,18 @@ XactLogAbortRecord(TimestampTz abort_time,
52785278
xl_subxacts.nsubxacts = nsubxacts;
52795279
}
52805280

5281-
if (nrels > 0)
5282-
{
5283-
xl_xinfo.xinfo |= XACT_XINFO_HAS_RELFILENODES;
5284-
xl_relfilenodes.nrels = nrels;
5285-
}
5286-
52875281
if (TransactionIdIsValid(twophase_xid))
52885282
{
52895283
xl_xinfo.xinfo |= XACT_XINFO_HAS_TWOPHASE;
52905284
xl_twophase.xid = twophase_xid;
52915285
}
52925286

5287+
if (nrels > 0)
5288+
{
5289+
xl_xinfo.xinfo |= XACT_XINFO_HAS_RELFILENODES;
5290+
xl_relfilenodes.nrels = nrels;
5291+
}
5292+
52935293
if (xl_xinfo.xinfo != 0)
52945294
info |= XLOG_XACT_HAS_INFO;
52955295

src/include/access/xact.h

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid,
133133
*/
134134
#define XACT_XINFO_HAS_DBINFO (1U << 0)
135135
#define XACT_XINFO_HAS_SUBXACTS (1U << 1)
136-
#define XACT_XINFO_HAS_RELFILENODES (1U << 2)
137-
#define XACT_XINFO_HAS_INVALS (1U << 3)
138-
#define XACT_XINFO_HAS_TWOPHASE (1U << 4)
136+
#define XACT_XINFO_HAS_TWOPHASE (1U << 2)
137+
#define XACT_XINFO_HAS_RELFILENODES (1U << 3)
138+
#define XACT_XINFO_HAS_INVALS (1U << 4)
139139
#define XACT_XINFO_HAS_ORIGIN (1U << 5)
140140

141141
/*
@@ -191,7 +191,7 @@ typedef struct xl_xact_xinfo
191191
* four so following records don't have to care about alignment. Commit
192192
* records can be large, so copying large portions isn't attractive.
193193
*/
194-
uint32 xinfo;
194+
uint64 xinfo;
195195
} xl_xact_xinfo;
196196

197197
typedef struct xl_xact_dbinfo
@@ -207,6 +207,11 @@ typedef struct xl_xact_subxacts
207207
} xl_xact_subxacts;
208208
#define MinSizeOfXactSubxacts offsetof(xl_xact_subxacts, subxacts)
209209

210+
typedef struct xl_xact_twophase
211+
{
212+
TransactionId xid;
213+
} xl_xact_twophase;
214+
210215
typedef struct xl_xact_relfilenodes
211216
{
212217
int nrels; /* number of subtransaction XIDs */
@@ -221,12 +226,6 @@ typedef struct xl_xact_invals
221226
} xl_xact_invals;
222227
#define MinSizeOfXactInvals offsetof(xl_xact_invals, msgs)
223228

224-
typedef struct xl_xact_twophase
225-
{
226-
TransactionId xid;
227-
} xl_xact_twophase;
228-
#define MinSizeOfXactInvals offsetof(xl_xact_invals, msgs)
229-
230229
typedef struct xl_xact_origin
231230
{
232231
XLogRecPtr origin_lsn;
@@ -240,9 +239,9 @@ typedef struct xl_xact_commit
240239
/* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */
241240
/* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */
242241
/* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */
242+
/* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
243243
/* xl_xact_relfilenodes follows if XINFO_HAS_RELFILENODES */
244244
/* xl_xact_invals follows if XINFO_HAS_INVALS */
245-
/* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
246245
/* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */
247246
} xl_xact_commit;
248247
#define MinSizeOfXactCommit (offsetof(xl_xact_commit, xact_time) + sizeof(TimestampTz))
@@ -254,9 +253,9 @@ typedef struct xl_xact_abort
254253
/* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */
255254
/* No db_info required */
256255
/* xl_xact_subxacts follows if HAS_SUBXACT */
256+
/* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
257257
/* xl_xact_relfilenodes follows if HAS_RELFILENODES */
258258
/* No invalidation messages needed. */
259-
/* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
260259
} xl_xact_abort;
261260
#define MinSizeOfXactAbort sizeof(xl_xact_abort)
262261

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy