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-2022, 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"
22 #include "storage/relfilenode.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 
42 extern 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 */
56 extern PGDLLIMPORT bool XactReadOnly;
57 
58 /* flag for logging statements in this transaction */
59 extern PGDLLIMPORT bool xact_is_sampled;
60 
61 /*
62  * Xact is deferrable -- only meaningful (currently) for read only
63  * SERIALIZABLE transactions
64  */
66 extern PGDLLIMPORT bool XactDeferrable;
67 
68 typedef 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 */
87 extern 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  */
96 extern 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  * start- and end-of-transaction callbacks for dynamically loaded modules
112  */
113 typedef enum
114 {
124 
125 typedef void (*XactCallback) (XactEvent event, void *arg);
126 
127 typedef enum
128 {
134 
135 typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid,
136  SubTransactionId parentSubid, void *arg);
137 
138 /* Data structure for Save/RestoreTransactionCharacteristics */
140 {
145 
146 
147 /* ----------------
148  * transaction-related XLOG entries
149  * ----------------
150  */
151 
152 /*
153  * XLOG allows to store some information in high 4 bits of log record xl_info
154  * field. We use 3 for the opcode, and one about an optional flag variable.
155  */
156 #define XLOG_XACT_COMMIT 0x00
157 #define XLOG_XACT_PREPARE 0x10
158 #define XLOG_XACT_ABORT 0x20
159 #define XLOG_XACT_COMMIT_PREPARED 0x30
160 #define XLOG_XACT_ABORT_PREPARED 0x40
161 #define XLOG_XACT_ASSIGNMENT 0x50
162 #define XLOG_XACT_INVALIDATIONS 0x60
163 /* free opcode 0x70 */
164 
165 /* mask for filtering opcodes out of xl_info */
166 #define XLOG_XACT_OPMASK 0x70
167 
168 /* does this record have a 'xinfo' field or not */
169 #define XLOG_XACT_HAS_INFO 0x80
170 
171 /*
172  * The following flags, stored in xinfo, determine which information is
173  * contained in commit/abort records.
174  */
175 #define XACT_XINFO_HAS_DBINFO (1U << 0)
176 #define XACT_XINFO_HAS_SUBXACTS (1U << 1)
177 #define XACT_XINFO_HAS_RELFILENODES (1U << 2)
178 #define XACT_XINFO_HAS_INVALS (1U << 3)
179 #define XACT_XINFO_HAS_TWOPHASE (1U << 4)
180 #define XACT_XINFO_HAS_ORIGIN (1U << 5)
181 #define XACT_XINFO_HAS_AE_LOCKS (1U << 6)
182 #define XACT_XINFO_HAS_GID (1U << 7)
183 #define XACT_XINFO_HAS_DROPPED_STATS (1U << 8)
184 
185 /*
186  * Also stored in xinfo, these indicating a variety of additional actions that
187  * need to occur when emulating transaction effects during recovery.
188  *
189  * They are named XactCompletion... to differentiate them from
190  * EOXact... routines which run at the end of the original transaction
191  * completion.
192  */
193 #define XACT_COMPLETION_APPLY_FEEDBACK (1U << 29)
194 #define XACT_COMPLETION_UPDATE_RELCACHE_FILE (1U << 30)
195 #define XACT_COMPLETION_FORCE_SYNC_COMMIT (1U << 31)
196 
197 /* Access macros for above flags */
198 #define XactCompletionApplyFeedback(xinfo) \
199  ((xinfo & XACT_COMPLETION_APPLY_FEEDBACK) != 0)
200 #define XactCompletionRelcacheInitFileInval(xinfo) \
201  ((xinfo & XACT_COMPLETION_UPDATE_RELCACHE_FILE) != 0)
202 #define XactCompletionForceSyncCommit(xinfo) \
203  ((xinfo & XACT_COMPLETION_FORCE_SYNC_COMMIT) != 0)
204 
205 typedef struct xl_xact_assignment
206 {
207  TransactionId xtop; /* assigned XID's top-level XID */
208  int nsubxacts; /* number of subtransaction XIDs */
209  TransactionId xsub[FLEXIBLE_ARRAY_MEMBER]; /* assigned subxids */
211 
212 #define MinSizeOfXactAssignment offsetof(xl_xact_assignment, xsub)
213 
214 /*
215  * Commit and abort records can contain a lot of information. But a large
216  * portion of the records won't need all possible pieces of information. So we
217  * only include what's needed.
218  *
219  * A minimal commit/abort record only consists of a xl_xact_commit/abort
220  * struct. The presence of additional information is indicated by bits set in
221  * 'xl_xact_xinfo->xinfo'. The presence of the xinfo field itself is signaled
222  * by a set XLOG_XACT_HAS_INFO bit in the xl_info field.
223  *
224  * NB: All the individual data chunks should be sized to multiples of
225  * sizeof(int) and only require int32 alignment. If they require bigger
226  * alignment, they need to be copied upon reading.
227  */
228 
229 /* sub-records for commit/abort */
230 
231 typedef struct xl_xact_xinfo
232 {
233  /*
234  * Even though we right now only require two bytes of space in xinfo we
235  * use four so following records don't have to care about alignment.
236  * Commit records can be large, so copying large portions isn't
237  * attractive.
238  */
241 
242 typedef struct xl_xact_dbinfo
243 {
244  Oid dbId; /* MyDatabaseId */
245  Oid tsId; /* MyDatabaseTableSpace */
247 
248 typedef struct xl_xact_subxacts
249 {
250  int nsubxacts; /* number of subtransaction XIDs */
253 #define MinSizeOfXactSubxacts offsetof(xl_xact_subxacts, subxacts)
254 
255 typedef struct xl_xact_relfilenodes
256 {
257  int nrels; /* number of relations */
260 #define MinSizeOfXactRelfilenodes offsetof(xl_xact_relfilenodes, xnodes)
261 
262 /*
263  * A transactionally dropped statistics entry.
264  *
265  * Declared here rather than pgstat.h because pgstat.h can't be included from
266  * frontend code, but the WAL format needs to be readable by frontend
267  * programs.
268  */
269 typedef struct xl_xact_stats_item
270 {
271  int kind;
275 
276 typedef struct xl_xact_stats_items
277 {
278  int nitems;
281 #define MinSizeOfXactStatsItems offsetof(xl_xact_stats_items, items)
282 
283 typedef struct xl_xact_invals
284 {
285  int nmsgs; /* number of shared inval msgs */
288 #define MinSizeOfXactInvals offsetof(xl_xact_invals, msgs)
289 
290 typedef struct xl_xact_twophase
291 {
294 
295 typedef struct xl_xact_origin
296 {
300 
301 typedef struct xl_xact_commit
302 {
303  TimestampTz xact_time; /* time of commit */
304 
305  /* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */
306  /* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */
307  /* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */
308  /* xl_xact_relfilenodes follows if XINFO_HAS_RELFILENODES */
309  /* xl_xact_stats_items follows if XINFO_HAS_DROPPED_STATS */
310  /* xl_xact_invals follows if XINFO_HAS_INVALS */
311  /* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
312  /* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */
313  /* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */
315 #define MinSizeOfXactCommit (offsetof(xl_xact_commit, xact_time) + sizeof(TimestampTz))
316 
317 typedef struct xl_xact_abort
318 {
319  TimestampTz xact_time; /* time of abort */
320 
321  /* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */
322  /* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */
323  /* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */
324  /* xl_xact_relfilenodes follows if XINFO_HAS_RELFILENODES */
325  /* xl_xact_stats_items follows if XINFO_HAS_DROPPED_STATS */
326  /* No invalidation messages needed. */
327  /* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
328  /* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */
329  /* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */
331 #define MinSizeOfXactAbort sizeof(xl_xact_abort)
332 
333 typedef struct xl_xact_prepare
334 {
335  uint32 magic; /* format identifier */
336  uint32 total_len; /* actual file length */
337  TransactionId xid; /* original transaction XID */
338  Oid database; /* OID of database it was in */
339  TimestampTz prepared_at; /* time of preparation */
340  Oid owner; /* user running the transaction */
341  int32 nsubxacts; /* number of following subxact XIDs */
342  int32 ncommitrels; /* number of delete-on-commit rels */
343  int32 nabortrels; /* number of delete-on-abort rels */
344  int32 ncommitstats; /* number of stats to drop on commit */
345  int32 nabortstats; /* number of stats to drop on abort */
346  int32 ninvalmsgs; /* number of cache invalidation messages */
347  bool initfileinval; /* does relcache init file need invalidation? */
348  uint16 gidlen; /* length of the GID - GID follows the header */
349  XLogRecPtr origin_lsn; /* lsn of this record at origin node */
350  TimestampTz origin_timestamp; /* time of prepare at origin node */
352 
353 /*
354  * Commit/Abort records in the above form are a bit verbose to parse, so
355  * there's a deconstructed versions generated by ParseCommit/AbortRecord() for
356  * easier consumption.
357  */
358 typedef struct xl_xact_parsed_commit
359 {
362 
363  Oid dbId; /* MyDatabaseId */
364  Oid tsId; /* MyDatabaseTableSpace */
365 
368 
369  int nrels;
371 
372  int nstats;
374 
375  int nmsgs;
377 
378  TransactionId twophase_xid; /* only for 2PC */
379  char twophase_gid[GIDSIZE]; /* only for 2PC */
380  int nabortrels; /* only for 2PC */
381  RelFileNode *abortnodes; /* only for 2PC */
382  int nabortstats; /* only for 2PC */
383  xl_xact_stats_item *abortstats; /* only for 2PC */
384 
388 
390 
391 typedef struct xl_xact_parsed_abort
392 {
395 
396  Oid dbId; /* MyDatabaseId */
397  Oid tsId; /* MyDatabaseTableSpace */
398 
401 
402  int nrels;
404 
405  int nstats;
407 
408  TransactionId twophase_xid; /* only for 2PC */
409  char twophase_gid[GIDSIZE]; /* only for 2PC */
410 
414 
415 
416 /* ----------------
417  * extern definitions
418  * ----------------
419  */
420 extern bool IsTransactionState(void);
421 extern bool IsAbortedTransactionBlockState(void);
432 extern void MarkCurrentTransactionIdLoggedIfAny(void);
433 extern bool SubTransactionIsActive(SubTransactionId subxid);
434 extern CommandId GetCurrentCommandId(bool used);
435 extern void SetParallelStartTimestamps(TimestampTz xact_ts, TimestampTz stmt_ts);
439 extern void SetCurrentStatementStartTimestamp(void);
440 extern int GetCurrentTransactionNestLevel(void);
442 extern void CommandCounterIncrement(void);
443 extern void ForceSyncCommit(void);
444 extern void StartTransactionCommand(void);
447 extern void CommitTransactionCommand(void);
448 extern void AbortCurrentTransaction(void);
449 extern void BeginTransactionBlock(void);
450 extern bool EndTransactionBlock(bool chain);
451 extern bool PrepareTransactionBlock(const char *gid);
452 extern void UserAbortTransactionBlock(bool chain);
453 extern void BeginImplicitTransactionBlock(void);
454 extern void EndImplicitTransactionBlock(void);
455 extern void ReleaseSavepoint(const char *name);
456 extern void DefineSavepoint(const char *name);
457 extern void RollbackToSavepoint(const char *name);
458 extern void BeginInternalSubTransaction(const char *name);
459 extern void ReleaseCurrentSubTransaction(void);
461 extern bool IsSubTransaction(void);
463 extern void SerializeTransactionState(Size maxsize, char *start_address);
464 extern void StartParallelWorkerTransaction(char *tstatespace);
465 extern void EndParallelWorkerTransaction(void);
466 extern bool IsTransactionBlock(void);
467 extern bool IsTransactionOrTransactionBlock(void);
468 extern char TransactionBlockStatusCode(void);
469 extern void AbortOutOfAnyTransaction(void);
470 extern void PreventInTransactionBlock(bool isTopLevel, const char *stmtType);
471 extern void RequireTransactionBlock(bool isTopLevel, const char *stmtType);
472 extern void WarnNoTransactionBlock(bool isTopLevel, const char *stmtType);
473 extern bool IsInTransactionBlock(bool isTopLevel);
474 extern void RegisterXactCallback(XactCallback callback, void *arg);
475 extern void UnregisterXactCallback(XactCallback callback, void *arg);
478 
479 extern bool IsSubxactTopXidLogPending(void);
480 extern void MarkSubxactTopXidLogged(void);
481 
482 extern int xactGetCommittedChildren(TransactionId **ptr);
483 
484 extern XLogRecPtr XactLogCommitRecord(TimestampTz commit_time,
485  int nsubxacts, TransactionId *subxacts,
486  int nrels, RelFileNode *rels,
487  int nstats,
488  xl_xact_stats_item *stats,
489  int nmsgs, SharedInvalidationMessage *msgs,
490  bool relcacheInval,
491  int xactflags,
492  TransactionId twophase_xid,
493  const char *twophase_gid);
494 
495 extern XLogRecPtr XactLogAbortRecord(TimestampTz abort_time,
496  int nsubxacts, TransactionId *subxacts,
497  int nrels, RelFileNode *rels,
498  int nstats,
499  xl_xact_stats_item *stats,
500  int xactflags, TransactionId twophase_xid,
501  const char *twophase_gid);
502 extern void xact_redo(XLogReaderState *record);
503 
504 /* xactdesc.c */
505 extern void xact_desc(StringInfo buf, XLogReaderState *record);
506 extern const char *xact_identify(uint8 info);
507 
508 /* also in xactdesc.c, so they can be shared between front/backend code */
509 extern void ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *parsed);
510 extern void ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed);
511 extern void ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *parsed);
512 
513 extern void EnterParallelMode(void);
514 extern void ExitParallelMode(void);
515 extern bool IsInParallelMode(void);
516 
517 #endif /* XACT_H */
unsigned short uint16
Definition: c.h:440
unsigned int uint32
Definition: c.h:441
#define PGDLLIMPORT
Definition: c.h:1331
uint32 SubTransactionId
Definition: c.h:591
signed int int32
Definition: c.h:429
#define FLEXIBLE_ARRAY_MEMBER
Definition: c.h:350
unsigned char uint8
Definition: c.h:439
uint32 CommandId
Definition: c.h:601
uint32 TransactionId
Definition: c.h:587
size_t Size
Definition: c.h:540
int64 TimestampTz
Definition: timestamp.h:39
const char * name
Definition: encode.c:561
void * arg
static char * buf
Definition: pg_test_fsync.c:67
unsigned int Oid
Definition: postgres_ext.h:31
TimestampTz xact_time
Definition: xact.h:319
TransactionId xtop
Definition: xact.h:207
TransactionId xsub[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:209
TimestampTz xact_time
Definition: xact.h:303
Oid tsId
Definition: xact.h:245
Oid dbId
Definition: xact.h:244
SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:286
int nmsgs
Definition: xact.h:285
TimestampTz origin_timestamp
Definition: xact.h:298
XLogRecPtr origin_lsn
Definition: xact.h:297
xl_xact_stats_item * stats
Definition: xact.h:406
TransactionId twophase_xid
Definition: xact.h:408
TimestampTz xact_time
Definition: xact.h:393
RelFileNode * xnodes
Definition: xact.h:403
TransactionId * subxacts
Definition: xact.h:400
XLogRecPtr origin_lsn
Definition: xact.h:411
char twophase_gid[GIDSIZE]
Definition: xact.h:409
TimestampTz origin_timestamp
Definition: xact.h:412
xl_xact_stats_item * stats
Definition: xact.h:373
TimestampTz xact_time
Definition: xact.h:360
TransactionId twophase_xid
Definition: xact.h:378
RelFileNode * xnodes
Definition: xact.h:370
TimestampTz origin_timestamp
Definition: xact.h:386
TransactionId * subxacts
Definition: xact.h:367
char twophase_gid[GIDSIZE]
Definition: xact.h:379
XLogRecPtr origin_lsn
Definition: xact.h:385
RelFileNode * abortnodes
Definition: xact.h:381
xl_xact_stats_item * abortstats
Definition: xact.h:383
SharedInvalidationMessage * msgs
Definition: xact.h:376
TimestampTz prepared_at
Definition: xact.h:339
int32 nabortrels
Definition: xact.h:343
int32 ninvalmsgs
Definition: xact.h:346
bool initfileinval
Definition: xact.h:347
int32 ncommitstats
Definition: xact.h:344
TimestampTz origin_timestamp
Definition: xact.h:350
uint16 gidlen
Definition: xact.h:348
uint32 total_len
Definition: xact.h:336
int32 nabortstats
Definition: xact.h:345
Oid database
Definition: xact.h:338
XLogRecPtr origin_lsn
Definition: xact.h:349
uint32 magic
Definition: xact.h:335
int32 ncommitrels
Definition: xact.h:342
TransactionId xid
Definition: xact.h:337
int32 nsubxacts
Definition: xact.h:341
RelFileNode xnodes[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:258
xl_xact_stats_item items[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:279
TransactionId subxacts[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:251
int nsubxacts
Definition: xact.h:250
TransactionId xid
Definition: xact.h:292
uint32 xinfo
Definition: xact.h:239
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
Definition: test_ifaddrs.c:48
bool IsTransactionOrTransactionBlock(void)
Definition: xact.c:4784
void SerializeTransactionState(Size maxsize, char *start_address)
Definition: xact.c:5322
void ExitParallelMode(void)
Definition: xact.c:1045
struct xl_xact_stats_item xl_xact_stats_item
PGDLLIMPORT bool XactReadOnly
Definition: xact.c:81
PGDLLIMPORT int MyXactFlags
Definition: xact.c:135
void SaveTransactionCharacteristics(SavedTransactionCharacteristics *s)
Definition: xact.c:3002
void BeginInternalSubTransaction(const char *name)
Definition: xact.c:4490
FullTransactionId GetCurrentFullTransactionId(void)
Definition: xact.c:499
void RestoreTransactionCharacteristics(const SavedTransactionCharacteristics *s)
Definition: xact.c:3010
void WarnNoTransactionBlock(bool isTopLevel, const char *stmtType)
Definition: xact.c:3522
PGDLLIMPORT int synchronous_commit
Definition: xact.c:86
SubTransactionId GetCurrentSubTransactionId(void)
Definition: xact.c:776
void(* SubXactCallback)(SubXactEvent event, SubTransactionId mySubid, SubTransactionId parentSubid, void *arg)
Definition: xact.h:135
void UserAbortTransactionBlock(bool chain)
Definition: xact.c:4000
PGDLLIMPORT bool xact_is_sampled
Definition: xact.c:286
struct xl_xact_assignment xl_xact_assignment
bool IsInTransactionBlock(bool isTopLevel)
Definition: xact.c:3575
bool PrepareTransactionBlock(const char *gid)
Definition: xact.c:3788
struct xl_xact_abort xl_xact_abort
int GetCurrentTransactionNestLevel(void)
Definition: xact.c:910
void xact_redo(XLogReaderState *record)
Definition: xact.c:6137
xl_xact_parsed_commit xl_xact_parsed_prepare
Definition: xact.h:389
TransactionId GetTopTransactionId(void)
Definition: xact.c:413
void EnterParallelMode(void)
Definition: xact.c:1032
struct xl_xact_dbinfo xl_xact_dbinfo
TransactionId GetStableLatestTransactionId(void)
Definition: xact.c:594
void UnregisterSubXactCallback(SubXactCallback callback, void *arg)
Definition: xact.c:3678
PGDLLIMPORT bool DefaultXactReadOnly
Definition: xact.c:80
void BeginImplicitTransactionBlock(void)
Definition: xact.c:4122
SubXactEvent
Definition: xact.h:128
@ SUBXACT_EVENT_PRE_COMMIT_SUB
Definition: xact.h:132
@ SUBXACT_EVENT_START_SUB
Definition: xact.h:129
@ SUBXACT_EVENT_ABORT_SUB
Definition: xact.h:131
@ SUBXACT_EVENT_COMMIT_SUB
Definition: xact.h:130
void(* XactCallback)(XactEvent event, void *arg)
Definition: xact.h:125
void RequireTransactionBlock(bool isTopLevel, const char *stmtType)
Definition: xact.c:3528
struct xl_xact_invals xl_xact_invals
void DefineSavepoint(const char *name)
Definition: xact.c:4169
struct xl_xact_origin xl_xact_origin
PGDLLIMPORT bool bsysscan
Definition: xact.c:99
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:114
@ XACT_EVENT_PRE_PREPARE
Definition: xact.h:122
@ XACT_EVENT_COMMIT
Definition: xact.h:115
@ XACT_EVENT_PARALLEL_PRE_COMMIT
Definition: xact.h:121
@ XACT_EVENT_PARALLEL_COMMIT
Definition: xact.h:116
@ XACT_EVENT_ABORT
Definition: xact.h:117
@ XACT_EVENT_PRE_COMMIT
Definition: xact.h:120
@ XACT_EVENT_PARALLEL_ABORT
Definition: xact.h:118
@ XACT_EVENT_PREPARE
Definition: xact.h:119
void UnregisterXactCallback(XactCallback callback, void *arg)
Definition: xact.c:3623
bool IsTransactionState(void)
Definition: xact.c:374
PGDLLIMPORT bool DefaultXactDeferrable
Definition: xact.c:83
XLogRecPtr XactLogCommitRecord(TimestampTz commit_time, int nsubxacts, TransactionId *subxacts, int nrels, RelFileNode *rels, int nstats, xl_xact_stats_item *stats, int nmsgs, SharedInvalidationMessage *msgs, bool relcacheInval, int xactflags, TransactionId twophase_xid, const char *twophase_gid)
Definition: xact.c:5587
void CommandCounterIncrement(void)
Definition: xact.c:1074
void PreventInTransactionBlock(bool isTopLevel, const char *stmtType)
Definition: xact.c:3462
Size EstimateTransactionStateSpace(void)
Definition: xact.c:5294
TransactionId GetTopTransactionIdIfAny(void)
Definition: xact.c:428
struct xl_xact_commit xl_xact_commit
#define GIDSIZE
Definition: xact.h:31
PGDLLIMPORT bool XactDeferrable
Definition: xact.c:84
char TransactionBlockStatusCode(void)
Definition: xact.c:4798
void RollbackAndReleaseCurrentSubTransaction(void)
Definition: xact.c:4595
FullTransactionId GetCurrentFullTransactionIdIfAny(void)
Definition: xact.c:517
void StartTransactionCommand(void)
Definition: xact.c:2925
bool IsAbortedTransactionBlockState(void)
Definition: xact.c:394
void ReleaseCurrentSubTransaction(void)
Definition: xact.c:4561
void EndImplicitTransactionBlock(void)
Definition: xact.c:4147
void StartParallelWorkerTransaction(char *tstatespace)
Definition: xact.c:5393
void SetParallelStartTimestamps(TimestampTz xact_ts, TimestampTz stmt_ts)
Definition: xact.c:840
void ReleaseSavepoint(const char *name)
Definition: xact.c:4254
const char * xact_identify(uint8 info)
Definition: xactdesc.c:484
FullTransactionId GetTopFullTransactionId(void)
Definition: xact.c:470
void ForceSyncCommit(void)
Definition: xact.c:1124
bool IsSubTransaction(void)
Definition: xact.c:4839
void MarkSubxactTopXidLogged(void)
Definition: xact.c:578
struct xl_xact_parsed_abort xl_xact_parsed_abort
struct xl_xact_relfilenodes xl_xact_relfilenodes
struct xl_xact_xinfo xl_xact_xinfo
void SetCurrentStatementStartTimestamp(void)
Definition: xact.c:886
bool TransactionIdIsCurrentTransactionId(TransactionId xid)
Definition: xact.c:922
struct xl_xact_subxacts xl_xact_subxacts
PGDLLIMPORT TransactionId CheckXidAlive
Definition: xact.c:98
XLogRecPtr XactLogAbortRecord(TimestampTz abort_time, int nsubxacts, TransactionId *subxacts, int nrels, RelFileNode *rels, int nstats, xl_xact_stats_item *stats, int xactflags, TransactionId twophase_xid, const char *twophase_gid)
Definition: xact.c:5759
bool IsTransactionBlock(void)
Definition: xact.c:4766
bool IsInParallelMode(void)
Definition: xact.c:1065
int xactGetCommittedChildren(TransactionId **ptr)
Definition: xact.c:5563
TransactionId GetCurrentTransactionIdIfAny(void)
Definition: xact.c:458
void BeginTransactionBlock(void)
Definition: xact.c:3720
TimestampTz GetCurrentStatementStartTimestamp(void)
Definition: xact.c:860
TimestampTz GetCurrentTransactionStartTimestamp(void)
Definition: xact.c:851
void EndParallelWorkerTransaction(void)
Definition: xact.c:5418
struct SavedTransactionCharacteristics SavedTransactionCharacteristics
void RegisterXactCallback(XactCallback callback, void *arg)
Definition: xact.c:3610
void CommitTransactionCommand(void)
Definition: xact.c:3022
PGDLLIMPORT int XactIsoLevel
Definition: xact.c:78
void RollbackToSavepoint(const char *name)
Definition: xact.c:4363
struct xl_xact_twophase xl_xact_twophase
bool SubTransactionIsActive(SubTransactionId subxid)
Definition: xact.c:790
void RegisterSubXactCallback(SubXactCallback callback, void *arg)
Definition: xact.c:3665
FullTransactionId GetTopFullTransactionIdIfAny(void)
Definition: xact.c:486
TransactionId GetCurrentTransactionId(void)
Definition: xact.c:441
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:436
bool EndTransactionBlock(bool chain)
Definition: xact.c:3840
bool IsSubxactTopXidLogPending(void)
Definition: xact.c:546
void ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *parsed)
Definition: xactdesc.c:239
void AbortOutOfAnyTransaction(void)
Definition: xact.c:4662
void AbortCurrentTransaction(void)
Definition: xact.c:3293
TimestampTz GetCurrentTransactionStopTimestamp(void)
Definition: xact.c:872
void MarkCurrentTransactionIdLoggedIfAny(void)
Definition: xact.c:528
PGDLLIMPORT int DefaultXactIsoLevel
Definition: xact.c:77
CommandId GetCurrentCommandId(bool used)
Definition: xact.c:814
uint64 XLogRecPtr
Definition: xlogdefs.h:21