PostgreSQL Source Code git master
xact.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * xact.h
4 * postgres transaction system definitions
5 *
6 *
7 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/include/access/xact.h
11 *
12 *-------------------------------------------------------------------------
13 */
14#ifndef XACT_H
15#define XACT_H
16
17#include "access/transam.h"
18#include "access/xlogreader.h"
19#include "datatype/timestamp.h"
20#include "lib/stringinfo.h"
21#include "nodes/pg_list.h"
23#include "storage/sinval.h"
24
25/*
26 * Maximum size of Global Transaction ID (including '\0').
27 *
28 * Note that the max value of GIDSIZE must fit in the uint16 gidlen,
29 * specified in TwoPhaseFileHeader.
30 */
31#define GIDSIZE 200
32
33/*
34 * Xact isolation levels
35 */
36#define XACT_READ_UNCOMMITTED 0
37#define XACT_READ_COMMITTED 1
38#define XACT_REPEATABLE_READ 2
39#define XACT_SERIALIZABLE 3
40
42extern PGDLLIMPORT int XactIsoLevel;
43
44/*
45 * We implement three isolation levels internally.
46 * The two stronger ones use one snapshot per database transaction;
47 * the others use one snapshot per statement.
48 * Serializable uses predicate locks in addition to snapshots.
49 * These macros should be used to check which isolation level is selected.
50 */
51#define IsolationUsesXactSnapshot() (XactIsoLevel >= XACT_REPEATABLE_READ)
52#define IsolationIsSerializable() (XactIsoLevel == XACT_SERIALIZABLE)
53
54/* Xact read-only state */
56extern PGDLLIMPORT bool XactReadOnly;
57
58/* flag for logging statements in this transaction */
60
61/*
62 * Xact is deferrable -- only meaningful (currently) for read only
63 * SERIALIZABLE transactions
64 */
66extern PGDLLIMPORT bool XactDeferrable;
67
68typedef enum
69{
70 SYNCHRONOUS_COMMIT_OFF, /* asynchronous commit */
71 SYNCHRONOUS_COMMIT_LOCAL_FLUSH, /* wait for local flush only */
72 SYNCHRONOUS_COMMIT_REMOTE_WRITE, /* wait for local flush and remote
73 * write */
74 SYNCHRONOUS_COMMIT_REMOTE_FLUSH, /* wait for local and remote flush */
75 SYNCHRONOUS_COMMIT_REMOTE_APPLY, /* wait for local and remote flush and
76 * remote apply */
78
79/* Define the default setting for synchronous_commit */
80#define SYNCHRONOUS_COMMIT_ON SYNCHRONOUS_COMMIT_REMOTE_FLUSH
81
82/* Synchronous commit level */
84
85/* used during logical streaming of a transaction */
87extern PGDLLIMPORT bool bsysscan;
88
89/*
90 * Miscellaneous flag bits to record events which occur on the top level
91 * transaction. These flags are only persisted in MyXactFlags and are intended
92 * so we remember to do certain things later in the transaction. This is
93 * globally accessible, so can be set from anywhere in the code which requires
94 * recording flags.
95 */
96extern PGDLLIMPORT int MyXactFlags;
97
98/*
99 * XACT_FLAGS_ACCESSEDTEMPNAMESPACE - set when a temporary object is accessed.
100 * We don't allow PREPARE TRANSACTION in that case.
101 */
102#define XACT_FLAGS_ACCESSEDTEMPNAMESPACE (1U << 0)
103
104/*
105 * XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK - records whether the top level xact
106 * logged any Access Exclusive Locks.
107 */
108#define XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK (1U << 1)
109
110/*
111 * XACT_FLAGS_NEEDIMMEDIATECOMMIT - records whether the top level statement
112 * is one that requires immediate commit, such as CREATE DATABASE.
113 */
114#define XACT_FLAGS_NEEDIMMEDIATECOMMIT (1U << 2)
115
116/*
117 * XACT_FLAGS_PIPELINING - set when we complete an extended-query-protocol
118 * Execute message. This is useful for detecting that an implicit transaction
119 * block has been created via pipelining.
120 */
121#define XACT_FLAGS_PIPELINING (1U << 3)
122
123/*
124 * start- and end-of-transaction callbacks for dynamically loaded modules
125 */
126typedef enum
127{
136} XactEvent;
137
138typedef void (*XactCallback) (XactEvent event, void *arg);
139
140typedef enum
141{
147
148typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid,
149 SubTransactionId parentSubid, void *arg);
150
151/* Data structure for Save/RestoreTransactionCharacteristics */
153{
158
159
160/* ----------------
161 * transaction-related XLOG entries
162 * ----------------
163 */
164
165/*
166 * XLOG allows to store some information in high 4 bits of log record xl_info
167 * field. We use 3 for the opcode, and one about an optional flag variable.
168 */
169#define XLOG_XACT_COMMIT 0x00
170#define XLOG_XACT_PREPARE 0x10
171#define XLOG_XACT_ABORT 0x20
172#define XLOG_XACT_COMMIT_PREPARED 0x30
173#define XLOG_XACT_ABORT_PREPARED 0x40
174#define XLOG_XACT_ASSIGNMENT 0x50
175#define XLOG_XACT_INVALIDATIONS 0x60
176/* free opcode 0x70 */
177
178/* mask for filtering opcodes out of xl_info */
179#define XLOG_XACT_OPMASK 0x70
180
181/* does this record have a 'xinfo' field or not */
182#define XLOG_XACT_HAS_INFO 0x80
183
184/*
185 * The following flags, stored in xinfo, determine which information is
186 * contained in commit/abort records.
187 */
188#define XACT_XINFO_HAS_DBINFO (1U << 0)
189#define XACT_XINFO_HAS_SUBXACTS (1U << 1)
190#define XACT_XINFO_HAS_RELFILELOCATORS (1U << 2)
191#define XACT_XINFO_HAS_INVALS (1U << 3)
192#define XACT_XINFO_HAS_TWOPHASE (1U << 4)
193#define XACT_XINFO_HAS_ORIGIN (1U << 5)
194#define XACT_XINFO_HAS_AE_LOCKS (1U << 6)
195#define XACT_XINFO_HAS_GID (1U << 7)
196#define XACT_XINFO_HAS_DROPPED_STATS (1U << 8)
197
198/*
199 * Also stored in xinfo, these indicating a variety of additional actions that
200 * need to occur when emulating transaction effects during recovery.
201 *
202 * They are named XactCompletion... to differentiate them from
203 * EOXact... routines which run at the end of the original transaction
204 * completion.
205 */
206#define XACT_COMPLETION_APPLY_FEEDBACK (1U << 29)
207#define XACT_COMPLETION_UPDATE_RELCACHE_FILE (1U << 30)
208#define XACT_COMPLETION_FORCE_SYNC_COMMIT (1U << 31)
209
210/* Access macros for above flags */
211#define XactCompletionApplyFeedback(xinfo) \
212 ((xinfo & XACT_COMPLETION_APPLY_FEEDBACK) != 0)
213#define XactCompletionRelcacheInitFileInval(xinfo) \
214 ((xinfo & XACT_COMPLETION_UPDATE_RELCACHE_FILE) != 0)
215#define XactCompletionForceSyncCommit(xinfo) \
216 ((xinfo & XACT_COMPLETION_FORCE_SYNC_COMMIT) != 0)
217
218typedef struct xl_xact_assignment
219{
220 TransactionId xtop; /* assigned XID's top-level XID */
221 int nsubxacts; /* number of subtransaction XIDs */
222 TransactionId xsub[FLEXIBLE_ARRAY_MEMBER]; /* assigned subxids */
224
225#define MinSizeOfXactAssignment offsetof(xl_xact_assignment, xsub)
226
227/*
228 * Commit and abort records can contain a lot of information. But a large
229 * portion of the records won't need all possible pieces of information. So we
230 * only include what's needed.
231 *
232 * A minimal commit/abort record only consists of a xl_xact_commit/abort
233 * struct. The presence of additional information is indicated by bits set in
234 * 'xl_xact_xinfo->xinfo'. The presence of the xinfo field itself is signaled
235 * by a set XLOG_XACT_HAS_INFO bit in the xl_info field.
236 *
237 * NB: All the individual data chunks should be sized to multiples of
238 * sizeof(int) and only require int32 alignment. If they require bigger
239 * alignment, they need to be copied upon reading.
240 */
241
242/* sub-records for commit/abort */
243
244typedef struct xl_xact_xinfo
245{
246 /*
247 * Even though we right now only require two bytes of space in xinfo we
248 * use four so following records don't have to care about alignment.
249 * Commit records can be large, so copying large portions isn't
250 * attractive.
251 */
254
255typedef struct xl_xact_dbinfo
256{
257 Oid dbId; /* MyDatabaseId */
258 Oid tsId; /* MyDatabaseTableSpace */
260
261typedef struct xl_xact_subxacts
262{
263 int nsubxacts; /* number of subtransaction XIDs */
266#define MinSizeOfXactSubxacts offsetof(xl_xact_subxacts, subxacts)
267
269{
270 int nrels; /* number of relations */
273#define MinSizeOfXactRelfileLocators offsetof(xl_xact_relfilelocators, xlocators)
274
275/*
276 * A transactionally dropped statistics entry.
277 *
278 * Declared here rather than pgstat.h because pgstat.h can't be included from
279 * frontend code, but the WAL format needs to be readable by frontend
280 * programs.
281 */
282typedef struct xl_xact_stats_item
283{
284 int kind;
286
287 /*
288 * This stores the value of PgStat_HashKey.objid as two uint32 as all the
289 * fields of xl_xact_xinfo should be multiples of size(int).
290 */
294
296{
300#define MinSizeOfXactStatsItems offsetof(xl_xact_stats_items, items)
301
302typedef struct xl_xact_invals
303{
304 int nmsgs; /* number of shared inval msgs */
307#define MinSizeOfXactInvals offsetof(xl_xact_invals, msgs)
308
309typedef struct xl_xact_twophase
310{
313
314typedef struct xl_xact_origin
315{
319
320typedef struct xl_xact_commit
321{
322 TimestampTz xact_time; /* time of commit */
323
324 /* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */
325 /* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */
326 /* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */
327 /* xl_xact_relfilelocators follows if XINFO_HAS_RELFILELOCATORS */
328 /* xl_xact_stats_items follows if XINFO_HAS_DROPPED_STATS */
329 /* xl_xact_invals follows if XINFO_HAS_INVALS */
330 /* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
331 /* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */
332 /* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */
334#define MinSizeOfXactCommit (offsetof(xl_xact_commit, xact_time) + sizeof(TimestampTz))
335
336typedef struct xl_xact_abort
337{
338 TimestampTz xact_time; /* time of abort */
339
340 /* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */
341 /* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */
342 /* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */
343 /* xl_xact_relfilelocators follows if XINFO_HAS_RELFILELOCATORS */
344 /* xl_xact_stats_items follows if XINFO_HAS_DROPPED_STATS */
345 /* No invalidation messages needed. */
346 /* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
347 /* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */
348 /* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */
350#define MinSizeOfXactAbort sizeof(xl_xact_abort)
351
352typedef struct xl_xact_prepare
353{
354 uint32 magic; /* format identifier */
355 uint32 total_len; /* actual file length */
356 TransactionId xid; /* original transaction XID */
357 Oid database; /* OID of database it was in */
358 TimestampTz prepared_at; /* time of preparation */
359 Oid owner; /* user running the transaction */
360 int32 nsubxacts; /* number of following subxact XIDs */
361 int32 ncommitrels; /* number of delete-on-commit rels */
362 int32 nabortrels; /* number of delete-on-abort rels */
363 int32 ncommitstats; /* number of stats to drop on commit */
364 int32 nabortstats; /* number of stats to drop on abort */
365 int32 ninvalmsgs; /* number of cache invalidation messages */
366 bool initfileinval; /* does relcache init file need invalidation? */
367 uint16 gidlen; /* length of the GID - GID follows the header */
368 XLogRecPtr origin_lsn; /* lsn of this record at origin node */
369 TimestampTz origin_timestamp; /* time of prepare at origin node */
371
372/*
373 * Commit/Abort records in the above form are a bit verbose to parse, so
374 * there's a deconstructed versions generated by ParseCommit/AbortRecord() for
375 * easier consumption.
376 */
378{
381
382 Oid dbId; /* MyDatabaseId */
383 Oid tsId; /* MyDatabaseTableSpace */
384
387
388 int nrels;
390
393
394 int nmsgs;
396
397 TransactionId twophase_xid; /* only for 2PC */
398 char twophase_gid[GIDSIZE]; /* only for 2PC */
399 int nabortrels; /* only for 2PC */
400 RelFileLocator *abortlocators; /* only for 2PC */
401 int nabortstats; /* only for 2PC */
402 xl_xact_stats_item *abortstats; /* only for 2PC */
403
407
409
411{
414
415 Oid dbId; /* MyDatabaseId */
416 Oid tsId; /* MyDatabaseTableSpace */
417
420
421 int nrels;
423
426
427 TransactionId twophase_xid; /* only for 2PC */
428 char twophase_gid[GIDSIZE]; /* only for 2PC */
429
433
434
435/* ----------------
436 * extern definitions
437 * ----------------
438 */
439extern bool IsTransactionState(void);
440extern bool IsAbortedTransactionBlockState(void);
452extern bool SubTransactionIsActive(SubTransactionId subxid);
453extern CommandId GetCurrentCommandId(bool used);
454extern void SetParallelStartTimestamps(TimestampTz xact_ts, TimestampTz stmt_ts);
458extern void SetCurrentStatementStartTimestamp(void);
459extern int GetCurrentTransactionNestLevel(void);
461extern void CommandCounterIncrement(void);
462extern void ForceSyncCommit(void);
463extern void StartTransactionCommand(void);
466extern void CommitTransactionCommand(void);
467extern void AbortCurrentTransaction(void);
468extern void BeginTransactionBlock(void);
469extern bool EndTransactionBlock(bool chain);
470extern bool PrepareTransactionBlock(const char *gid);
471extern void UserAbortTransactionBlock(bool chain);
472extern void BeginImplicitTransactionBlock(void);
473extern void EndImplicitTransactionBlock(void);
474extern void ReleaseSavepoint(const char *name);
475extern void DefineSavepoint(const char *name);
476extern void RollbackToSavepoint(const char *name);
477extern void BeginInternalSubTransaction(const char *name);
478extern void ReleaseCurrentSubTransaction(void);
480extern bool IsSubTransaction(void);
482extern void SerializeTransactionState(Size maxsize, char *start_address);
483extern void StartParallelWorkerTransaction(char *tstatespace);
484extern void EndParallelWorkerTransaction(void);
485extern bool IsTransactionBlock(void);
486extern bool IsTransactionOrTransactionBlock(void);
487extern char TransactionBlockStatusCode(void);
488extern void AbortOutOfAnyTransaction(void);
489extern void PreventInTransactionBlock(bool isTopLevel, const char *stmtType);
490extern void RequireTransactionBlock(bool isTopLevel, const char *stmtType);
491extern void WarnNoTransactionBlock(bool isTopLevel, const char *stmtType);
492extern bool IsInTransactionBlock(bool isTopLevel);
497
498extern bool IsSubxactTopXidLogPending(void);
499extern void MarkSubxactTopXidLogged(void);
500
502
504 int nsubxacts, TransactionId *subxacts,
505 int nrels, RelFileLocator *rels,
506 int ndroppedstats,
507 xl_xact_stats_item *droppedstats,
508 int nmsgs, SharedInvalidationMessage *msgs,
509 bool relcacheInval,
510 int xactflags,
511 TransactionId twophase_xid,
512 const char *twophase_gid);
513
515 int nsubxacts, TransactionId *subxacts,
516 int nrels, RelFileLocator *rels,
517 int ndroppedstats,
518 xl_xact_stats_item *droppedstats,
519 int xactflags, TransactionId twophase_xid,
520 const char *twophase_gid);
521extern void xact_redo(XLogReaderState *record);
522
523/* xactdesc.c */
524extern void xact_desc(StringInfo buf, XLogReaderState *record);
525extern const char *xact_identify(uint8 info);
526
527/* also in xactdesc.c, so they can be shared between front/backend code */
528extern void ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *parsed);
529extern void ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed);
530extern void ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *parsed);
531
532extern void EnterParallelMode(void);
533extern void ExitParallelMode(void);
534extern bool IsInParallelMode(void);
535
536#endif /* XACT_H */
#define PGDLLIMPORT
Definition: c.h:1291
uint8_t uint8
Definition: c.h:500
uint32 SubTransactionId
Definition: c.h:627
#define FLEXIBLE_ARRAY_MEMBER
Definition: c.h:434
int32_t int32
Definition: c.h:498
uint16_t uint16
Definition: c.h:501
uint32_t uint32
Definition: c.h:502
uint32 CommandId
Definition: c.h:637
uint32 TransactionId
Definition: c.h:623
size_t Size
Definition: c.h:576
int64 TimestampTz
Definition: timestamp.h:39
void * arg
static char * buf
Definition: pg_test_fsync.c:72
unsigned int Oid
Definition: postgres_ext.h:32
TimestampTz xact_time
Definition: xact.h:338
TransactionId xtop
Definition: xact.h:220
TransactionId xsub[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:222
TimestampTz xact_time
Definition: xact.h:322
Oid tsId
Definition: xact.h:258
Oid dbId
Definition: xact.h:257
SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:305
int nmsgs
Definition: xact.h:304
TimestampTz origin_timestamp
Definition: xact.h:317
XLogRecPtr origin_lsn
Definition: xact.h:316
xl_xact_stats_item * stats
Definition: xact.h:425
RelFileLocator * xlocators
Definition: xact.h:422
TransactionId twophase_xid
Definition: xact.h:427
TimestampTz xact_time
Definition: xact.h:412
TransactionId * subxacts
Definition: xact.h:419
XLogRecPtr origin_lsn
Definition: xact.h:430
char twophase_gid[GIDSIZE]
Definition: xact.h:428
TimestampTz origin_timestamp
Definition: xact.h:431
xl_xact_stats_item * stats
Definition: xact.h:392
TimestampTz xact_time
Definition: xact.h:379
TransactionId twophase_xid
Definition: xact.h:397
RelFileLocator * xlocators
Definition: xact.h:389
RelFileLocator * abortlocators
Definition: xact.h:400
TimestampTz origin_timestamp
Definition: xact.h:405
TransactionId * subxacts
Definition: xact.h:386
char twophase_gid[GIDSIZE]
Definition: xact.h:398
XLogRecPtr origin_lsn
Definition: xact.h:404
xl_xact_stats_item * abortstats
Definition: xact.h:402
SharedInvalidationMessage * msgs
Definition: xact.h:395
TimestampTz prepared_at
Definition: xact.h:358
int32 nabortrels
Definition: xact.h:362
int32 ninvalmsgs
Definition: xact.h:365
bool initfileinval
Definition: xact.h:366
int32 ncommitstats
Definition: xact.h:363
TimestampTz origin_timestamp
Definition: xact.h:369
uint16 gidlen
Definition: xact.h:367
uint32 total_len
Definition: xact.h:355
int32 nabortstats
Definition: xact.h:364
Oid database
Definition: xact.h:357
XLogRecPtr origin_lsn
Definition: xact.h:368
uint32 magic
Definition: xact.h:354
int32 ncommitrels
Definition: xact.h:361
TransactionId xid
Definition: xact.h:356
int32 nsubxacts
Definition: xact.h:360
RelFileLocator xlocators[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:271
uint32 objid_lo
Definition: xact.h:291
uint32 objid_hi
Definition: xact.h:292
xl_xact_stats_item items[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:298
TransactionId subxacts[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:264
int nsubxacts
Definition: xact.h:263
TransactionId xid
Definition: xact.h:311
uint32 xinfo
Definition: xact.h:252
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
Definition: test_ifaddrs.c:46
const char * name
bool IsTransactionOrTransactionBlock(void)
Definition: xact.c:4989
void SerializeTransactionState(Size maxsize, char *start_address)
Definition: xact.c:5540
void ExitParallelMode(void)
Definition: xact.c:1064
struct xl_xact_stats_item xl_xact_stats_item
PGDLLIMPORT bool XactReadOnly
Definition: xact.c:82
PGDLLIMPORT int MyXactFlags
Definition: xact.c:136
const char * xact_identify(uint8 info)
Definition: xactdesc.c:485
void SaveTransactionCharacteristics(SavedTransactionCharacteristics *s)
Definition: xact.c:3136
void BeginInternalSubTransaction(const char *name)
Definition: xact.c:4694
FullTransactionId GetCurrentFullTransactionId(void)
Definition: xact.c:512
void RestoreTransactionCharacteristics(const SavedTransactionCharacteristics *s)
Definition: xact.c:3144
void WarnNoTransactionBlock(bool isTopLevel, const char *stmtType)
Definition: xact.c:3710
PGDLLIMPORT int synchronous_commit
Definition: xact.c:87
SubTransactionId GetCurrentSubTransactionId(void)
Definition: xact.c:791
void(* SubXactCallback)(SubXactEvent event, SubTransactionId mySubid, SubTransactionId parentSubid, void *arg)
Definition: xact.h:148
void UserAbortTransactionBlock(bool chain)
Definition: xact.c:4204
PGDLLIMPORT bool xact_is_sampled
Definition: xact.c:296
struct xl_xact_assignment xl_xact_assignment
bool IsInTransactionBlock(bool isTopLevel)
Definition: xact.c:3769
bool PrepareTransactionBlock(const char *gid)
Definition: xact.c:3992
struct xl_xact_abort xl_xact_abort
int GetCurrentTransactionNestLevel(void)
Definition: xact.c:929
void xact_redo(XLogReaderState *record)
Definition: xact.c:6363
xl_xact_parsed_commit xl_xact_parsed_prepare
Definition: xact.h:408
TransactionId GetTopTransactionId(void)
Definition: xact.c:426
void EnterParallelMode(void)
Definition: xact.c:1051
struct xl_xact_dbinfo xl_xact_dbinfo
TransactionId GetStableLatestTransactionId(void)
Definition: xact.c:607
void UnregisterSubXactCallback(SubXactCallback callback, void *arg)
Definition: xact.c:3877
PGDLLIMPORT bool DefaultXactReadOnly
Definition: xact.c:81
void BeginImplicitTransactionBlock(void)
Definition: xact.c:4326
SubXactEvent
Definition: xact.h:141
@ SUBXACT_EVENT_PRE_COMMIT_SUB
Definition: xact.h:145
@ SUBXACT_EVENT_START_SUB
Definition: xact.h:142
@ SUBXACT_EVENT_ABORT_SUB
Definition: xact.h:144
@ SUBXACT_EVENT_COMMIT_SUB
Definition: xact.h:143
void(* XactCallback)(XactEvent event, void *arg)
Definition: xact.h:138
void RequireTransactionBlock(bool isTopLevel, const char *stmtType)
Definition: xact.c:3716
struct xl_xact_invals xl_xact_invals
void DefineSavepoint(const char *name)
Definition: xact.c:4373
struct xl_xact_origin xl_xact_origin
PGDLLIMPORT bool bsysscan
Definition: xact.c:100
SyncCommitLevel
Definition: xact.h:69
@ SYNCHRONOUS_COMMIT_LOCAL_FLUSH
Definition: xact.h:71
@ SYNCHRONOUS_COMMIT_REMOTE_WRITE
Definition: xact.h:72
@ SYNCHRONOUS_COMMIT_REMOTE_APPLY
Definition: xact.h:75
@ SYNCHRONOUS_COMMIT_REMOTE_FLUSH
Definition: xact.h:74
@ SYNCHRONOUS_COMMIT_OFF
Definition: xact.h:70
XactEvent
Definition: xact.h:127
@ XACT_EVENT_PRE_PREPARE
Definition: xact.h:135
@ XACT_EVENT_COMMIT
Definition: xact.h:128
@ XACT_EVENT_PARALLEL_PRE_COMMIT
Definition: xact.h:134
@ XACT_EVENT_PARALLEL_COMMIT
Definition: xact.h:129
@ XACT_EVENT_ABORT
Definition: xact.h:130
@ XACT_EVENT_PRE_COMMIT
Definition: xact.h:133
@ XACT_EVENT_PARALLEL_ABORT
Definition: xact.h:131
@ XACT_EVENT_PREPARE
Definition: xact.h:132
void UnregisterXactCallback(XactCallback callback, void *arg)
Definition: xact.c:3817
bool IsTransactionState(void)
Definition: xact.c:387
PGDLLIMPORT bool DefaultXactDeferrable
Definition: xact.c:84
void CommandCounterIncrement(void)
Definition: xact.c:1100
void PreventInTransactionBlock(bool isTopLevel, const char *stmtType)
Definition: xact.c:3648
Size EstimateTransactionStateSpace(void)
Definition: xact.c:5512
TransactionId GetTopTransactionIdIfAny(void)
Definition: xact.c:441
struct xl_xact_commit xl_xact_commit
#define GIDSIZE
Definition: xact.h:31
PGDLLIMPORT bool XactDeferrable
Definition: xact.c:85
char TransactionBlockStatusCode(void)
Definition: xact.c:5003
void RollbackAndReleaseCurrentSubTransaction(void)
Definition: xact.c:4796
FullTransactionId GetCurrentFullTransactionIdIfAny(void)
Definition: xact.c:530
void StartTransactionCommand(void)
Definition: xact.c:3059
bool IsAbortedTransactionBlockState(void)
Definition: xact.c:407
void ReleaseCurrentSubTransaction(void)
Definition: xact.c:4768
void EndImplicitTransactionBlock(void)
Definition: xact.c:4351
void StartParallelWorkerTransaction(char *tstatespace)
Definition: xact.c:5611
void SetParallelStartTimestamps(TimestampTz xact_ts, TimestampTz stmt_ts)
Definition: xact.c:859
void ReleaseSavepoint(const char *name)
Definition: xact.c:4458
FullTransactionId GetTopFullTransactionId(void)
Definition: xact.c:483
struct xl_xact_relfilelocators xl_xact_relfilelocators
XLogRecPtr XactLogCommitRecord(TimestampTz commit_time, int nsubxacts, TransactionId *subxacts, int nrels, RelFileLocator *rels, int ndroppedstats, xl_xact_stats_item *droppedstats, int nmsgs, SharedInvalidationMessage *msgs, bool relcacheInval, int xactflags, TransactionId twophase_xid, const char *twophase_gid)
Definition: xact.c:5814
void ForceSyncCommit(void)
Definition: xact.c:1152
bool IsSubTransaction(void)
Definition: xact.c:5044
void MarkSubxactTopXidLogged(void)
Definition: xact.c:591
struct xl_xact_parsed_abort xl_xact_parsed_abort
struct xl_xact_xinfo xl_xact_xinfo
void SetCurrentStatementStartTimestamp(void)
Definition: xact.c:914
bool TransactionIdIsCurrentTransactionId(TransactionId xid)
Definition: xact.c:941
struct xl_xact_subxacts xl_xact_subxacts
PGDLLIMPORT TransactionId CheckXidAlive
Definition: xact.c:99
bool IsTransactionBlock(void)
Definition: xact.c:4971
bool IsInParallelMode(void)
Definition: xact.c:1089
int xactGetCommittedChildren(TransactionId **ptr)
Definition: xact.c:5790
TransactionId GetCurrentTransactionIdIfAny(void)
Definition: xact.c:471
void BeginTransactionBlock(void)
Definition: xact.c:3924
TimestampTz GetCurrentStatementStartTimestamp(void)
Definition: xact.c:879
TimestampTz GetCurrentTransactionStartTimestamp(void)
Definition: xact.c:870
void EndParallelWorkerTransaction(void)
Definition: xact.c:5636
struct SavedTransactionCharacteristics SavedTransactionCharacteristics
void RegisterXactCallback(XactCallback callback, void *arg)
Definition: xact.c:3804
void CommitTransactionCommand(void)
Definition: xact.c:3157
PGDLLIMPORT int XactIsoLevel
Definition: xact.c:79
void RollbackToSavepoint(const char *name)
Definition: xact.c:4567
struct xl_xact_twophase xl_xact_twophase
bool SubTransactionIsActive(SubTransactionId subxid)
Definition: xact.c:805
void RegisterSubXactCallback(SubXactCallback callback, void *arg)
Definition: xact.c:3864
FullTransactionId GetTopFullTransactionIdIfAny(void)
Definition: xact.c:499
TransactionId GetCurrentTransactionId(void)
Definition: xact.c:454
struct xl_xact_prepare xl_xact_prepare
struct xl_xact_stats_items xl_xact_stats_items
struct xl_xact_parsed_commit xl_xact_parsed_commit
void ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *parsed)
Definition: xactdesc.c:35
void ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed)
Definition: xactdesc.c:141
void xact_desc(StringInfo buf, XLogReaderState *record)
Definition: xactdesc.c:437
bool EndTransactionBlock(bool chain)
Definition: xact.c:4044
bool IsSubxactTopXidLogPending(void)
Definition: xact.c:559
void ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *parsed)
Definition: xactdesc.c:239
void AbortOutOfAnyTransaction(void)
Definition: xact.c:4862
void AbortCurrentTransaction(void)
Definition: xact.c:3451
TimestampTz GetCurrentTransactionStopTimestamp(void)
Definition: xact.c:891
XLogRecPtr XactLogAbortRecord(TimestampTz abort_time, int nsubxacts, TransactionId *subxacts, int nrels, RelFileLocator *rels, int ndroppedstats, xl_xact_stats_item *droppedstats, int xactflags, TransactionId twophase_xid, const char *twophase_gid)
Definition: xact.c:5986
void MarkCurrentTransactionIdLoggedIfAny(void)
Definition: xact.c:541
PGDLLIMPORT int DefaultXactIsoLevel
Definition: xact.c:78
CommandId GetCurrentCommandId(bool used)
Definition: xact.c:829
uint64 XLogRecPtr
Definition: xlogdefs.h:21