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-2024, 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/relfilelocator.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  * 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  */
126 typedef enum
127 {
136 } XactEvent;
137 
138 typedef void (*XactCallback) (XactEvent event, void *arg);
139 
140 typedef enum
141 {
146 } SubXactEvent;
147 
148 typedef 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 
218 typedef 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 
244 typedef 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 
255 typedef struct xl_xact_dbinfo
256 {
257  Oid dbId; /* MyDatabaseId */
258  Oid tsId; /* MyDatabaseTableSpace */
260 
261 typedef 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  */
282 typedef struct xl_xact_stats_item
283 {
284  int kind;
288 
289 typedef struct xl_xact_stats_items
290 {
291  int nitems;
294 #define MinSizeOfXactStatsItems offsetof(xl_xact_stats_items, items)
295 
296 typedef struct xl_xact_invals
297 {
298  int nmsgs; /* number of shared inval msgs */
301 #define MinSizeOfXactInvals offsetof(xl_xact_invals, msgs)
302 
303 typedef struct xl_xact_twophase
304 {
307 
308 typedef struct xl_xact_origin
309 {
313 
314 typedef struct xl_xact_commit
315 {
316  TimestampTz xact_time; /* time of commit */
317 
318  /* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */
319  /* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */
320  /* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */
321  /* xl_xact_relfilelocators follows if XINFO_HAS_RELFILELOCATORS */
322  /* xl_xact_stats_items follows if XINFO_HAS_DROPPED_STATS */
323  /* xl_xact_invals follows if XINFO_HAS_INVALS */
324  /* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
325  /* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */
326  /* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */
328 #define MinSizeOfXactCommit (offsetof(xl_xact_commit, xact_time) + sizeof(TimestampTz))
329 
330 typedef struct xl_xact_abort
331 {
332  TimestampTz xact_time; /* time of abort */
333 
334  /* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */
335  /* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */
336  /* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */
337  /* xl_xact_relfilelocators follows if XINFO_HAS_RELFILELOCATORS */
338  /* xl_xact_stats_items follows if XINFO_HAS_DROPPED_STATS */
339  /* No invalidation messages needed. */
340  /* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
341  /* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */
342  /* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */
344 #define MinSizeOfXactAbort sizeof(xl_xact_abort)
345 
346 typedef struct xl_xact_prepare
347 {
348  uint32 magic; /* format identifier */
349  uint32 total_len; /* actual file length */
350  TransactionId xid; /* original transaction XID */
351  Oid database; /* OID of database it was in */
352  TimestampTz prepared_at; /* time of preparation */
353  Oid owner; /* user running the transaction */
354  int32 nsubxacts; /* number of following subxact XIDs */
355  int32 ncommitrels; /* number of delete-on-commit rels */
356  int32 nabortrels; /* number of delete-on-abort rels */
357  int32 ncommitstats; /* number of stats to drop on commit */
358  int32 nabortstats; /* number of stats to drop on abort */
359  int32 ninvalmsgs; /* number of cache invalidation messages */
360  bool initfileinval; /* does relcache init file need invalidation? */
361  uint16 gidlen; /* length of the GID - GID follows the header */
362  XLogRecPtr origin_lsn; /* lsn of this record at origin node */
363  TimestampTz origin_timestamp; /* time of prepare at origin node */
365 
366 /*
367  * Commit/Abort records in the above form are a bit verbose to parse, so
368  * there's a deconstructed versions generated by ParseCommit/AbortRecord() for
369  * easier consumption.
370  */
371 typedef struct xl_xact_parsed_commit
372 {
375 
376  Oid dbId; /* MyDatabaseId */
377  Oid tsId; /* MyDatabaseTableSpace */
378 
381 
382  int nrels;
384 
385  int nstats;
387 
388  int nmsgs;
390 
391  TransactionId twophase_xid; /* only for 2PC */
392  char twophase_gid[GIDSIZE]; /* only for 2PC */
393  int nabortrels; /* only for 2PC */
394  RelFileLocator *abortlocators; /* only for 2PC */
395  int nabortstats; /* only for 2PC */
396  xl_xact_stats_item *abortstats; /* only for 2PC */
397 
401 
403 
404 typedef struct xl_xact_parsed_abort
405 {
408 
409  Oid dbId; /* MyDatabaseId */
410  Oid tsId; /* MyDatabaseTableSpace */
411 
414 
415  int nrels;
417 
418  int nstats;
420 
421  TransactionId twophase_xid; /* only for 2PC */
422  char twophase_gid[GIDSIZE]; /* only for 2PC */
423 
427 
428 
429 /* ----------------
430  * extern definitions
431  * ----------------
432  */
433 extern bool IsTransactionState(void);
434 extern bool IsAbortedTransactionBlockState(void);
445 extern void MarkCurrentTransactionIdLoggedIfAny(void);
446 extern bool SubTransactionIsActive(SubTransactionId subxid);
447 extern CommandId GetCurrentCommandId(bool used);
448 extern void SetParallelStartTimestamps(TimestampTz xact_ts, TimestampTz stmt_ts);
452 extern void SetCurrentStatementStartTimestamp(void);
453 extern int GetCurrentTransactionNestLevel(void);
455 extern void CommandCounterIncrement(void);
456 extern void ForceSyncCommit(void);
457 extern void StartTransactionCommand(void);
460 extern void CommitTransactionCommand(void);
461 extern void AbortCurrentTransaction(void);
462 extern void BeginTransactionBlock(void);
463 extern bool EndTransactionBlock(bool chain);
464 extern bool PrepareTransactionBlock(const char *gid);
465 extern void UserAbortTransactionBlock(bool chain);
466 extern void BeginImplicitTransactionBlock(void);
467 extern void EndImplicitTransactionBlock(void);
468 extern void ReleaseSavepoint(const char *name);
469 extern void DefineSavepoint(const char *name);
470 extern void RollbackToSavepoint(const char *name);
471 extern void BeginInternalSubTransaction(const char *name);
472 extern void ReleaseCurrentSubTransaction(void);
474 extern bool IsSubTransaction(void);
476 extern void SerializeTransactionState(Size maxsize, char *start_address);
477 extern void StartParallelWorkerTransaction(char *tstatespace);
478 extern void EndParallelWorkerTransaction(void);
479 extern bool IsTransactionBlock(void);
480 extern bool IsTransactionOrTransactionBlock(void);
481 extern char TransactionBlockStatusCode(void);
482 extern void AbortOutOfAnyTransaction(void);
483 extern void PreventInTransactionBlock(bool isTopLevel, const char *stmtType);
484 extern void RequireTransactionBlock(bool isTopLevel, const char *stmtType);
485 extern void WarnNoTransactionBlock(bool isTopLevel, const char *stmtType);
486 extern bool IsInTransactionBlock(bool isTopLevel);
487 extern void RegisterXactCallback(XactCallback callback, void *arg);
488 extern void UnregisterXactCallback(XactCallback callback, void *arg);
491 
492 extern bool IsSubxactTopXidLogPending(void);
493 extern void MarkSubxactTopXidLogged(void);
494 
495 extern int xactGetCommittedChildren(TransactionId **ptr);
496 
497 extern XLogRecPtr XactLogCommitRecord(TimestampTz commit_time,
498  int nsubxacts, TransactionId *subxacts,
499  int nrels, RelFileLocator *rels,
500  int ndroppedstats,
501  xl_xact_stats_item *droppedstats,
502  int nmsgs, SharedInvalidationMessage *msgs,
503  bool relcacheInval,
504  int xactflags,
505  TransactionId twophase_xid,
506  const char *twophase_gid);
507 
508 extern XLogRecPtr XactLogAbortRecord(TimestampTz abort_time,
509  int nsubxacts, TransactionId *subxacts,
510  int nrels, RelFileLocator *rels,
511  int ndroppedstats,
512  xl_xact_stats_item *droppedstats,
513  int xactflags, TransactionId twophase_xid,
514  const char *twophase_gid);
515 extern void xact_redo(XLogReaderState *record);
516 
517 /* xactdesc.c */
518 extern void xact_desc(StringInfo buf, XLogReaderState *record);
519 extern const char *xact_identify(uint8 info);
520 
521 /* also in xactdesc.c, so they can be shared between front/backend code */
522 extern void ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *parsed);
523 extern void ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed);
524 extern void ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *parsed);
525 
526 extern void EnterParallelMode(void);
527 extern void ExitParallelMode(void);
528 extern bool IsInParallelMode(void);
529 
530 #endif /* XACT_H */
unsigned short uint16
Definition: c.h:492
unsigned int uint32
Definition: c.h:493
#define PGDLLIMPORT
Definition: c.h:1303
uint32 SubTransactionId
Definition: c.h:643
signed int int32
Definition: c.h:481
#define FLEXIBLE_ARRAY_MEMBER
Definition: c.h:385
unsigned char uint8
Definition: c.h:491
uint32 CommandId
Definition: c.h:653
uint32 TransactionId
Definition: c.h:639
size_t Size
Definition: c.h:592
int64 TimestampTz
Definition: timestamp.h:39
void * arg
static char * buf
Definition: pg_test_fsync.c:73
unsigned int Oid
Definition: postgres_ext.h:31
TimestampTz xact_time
Definition: xact.h:332
TransactionId xtop
Definition: xact.h:220
TransactionId xsub[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:222
TimestampTz xact_time
Definition: xact.h:316
Oid tsId
Definition: xact.h:258
Oid dbId
Definition: xact.h:257
SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:299
int nmsgs
Definition: xact.h:298
TimestampTz origin_timestamp
Definition: xact.h:311
XLogRecPtr origin_lsn
Definition: xact.h:310
xl_xact_stats_item * stats
Definition: xact.h:419
RelFileLocator * xlocators
Definition: xact.h:416
TransactionId twophase_xid
Definition: xact.h:421
TimestampTz xact_time
Definition: xact.h:406
TransactionId * subxacts
Definition: xact.h:413
XLogRecPtr origin_lsn
Definition: xact.h:424
char twophase_gid[GIDSIZE]
Definition: xact.h:422
TimestampTz origin_timestamp
Definition: xact.h:425
xl_xact_stats_item * stats
Definition: xact.h:386
TimestampTz xact_time
Definition: xact.h:373
TransactionId twophase_xid
Definition: xact.h:391
RelFileLocator * xlocators
Definition: xact.h:383
RelFileLocator * abortlocators
Definition: xact.h:394
TimestampTz origin_timestamp
Definition: xact.h:399
TransactionId * subxacts
Definition: xact.h:380
char twophase_gid[GIDSIZE]
Definition: xact.h:392
XLogRecPtr origin_lsn
Definition: xact.h:398
xl_xact_stats_item * abortstats
Definition: xact.h:396
SharedInvalidationMessage * msgs
Definition: xact.h:389
TimestampTz prepared_at
Definition: xact.h:352
int32 nabortrels
Definition: xact.h:356
int32 ninvalmsgs
Definition: xact.h:359
bool initfileinval
Definition: xact.h:360
int32 ncommitstats
Definition: xact.h:357
TimestampTz origin_timestamp
Definition: xact.h:363
uint16 gidlen
Definition: xact.h:361
uint32 total_len
Definition: xact.h:349
int32 nabortstats
Definition: xact.h:358
Oid database
Definition: xact.h:351
XLogRecPtr origin_lsn
Definition: xact.h:362
uint32 magic
Definition: xact.h:348
int32 ncommitrels
Definition: xact.h:355
TransactionId xid
Definition: xact.h:350
int32 nsubxacts
Definition: xact.h:354
RelFileLocator xlocators[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:271
xl_xact_stats_item items[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:292
TransactionId subxacts[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:264
int nsubxacts
Definition: xact.h:263
TransactionId xid
Definition: xact.h:305
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:4910
void SerializeTransactionState(Size maxsize, char *start_address)
Definition: xact.c:5462
void ExitParallelMode(void)
Definition: xact.c:1050
struct xl_xact_stats_item xl_xact_stats_item
PGDLLIMPORT bool XactReadOnly
Definition: xact.c:80
PGDLLIMPORT int MyXactFlags
Definition: xact.c:134
void SaveTransactionCharacteristics(SavedTransactionCharacteristics *s)
Definition: xact.c:3032
void BeginInternalSubTransaction(const char *name)
Definition: xact.c:4616
FullTransactionId GetCurrentFullTransactionId(void)
Definition: xact.c:504
void RestoreTransactionCharacteristics(const SavedTransactionCharacteristics *s)
Definition: xact.c:3040
void WarnNoTransactionBlock(bool isTopLevel, const char *stmtType)
Definition: xact.c:3629
PGDLLIMPORT int synchronous_commit
Definition: xact.c:85
SubTransactionId GetCurrentSubTransactionId(void)
Definition: xact.c:781
void(* SubXactCallback)(SubXactEvent event, SubTransactionId mySubid, SubTransactionId parentSubid, void *arg)
Definition: xact.h:148
void UserAbortTransactionBlock(bool chain)
Definition: xact.c:4126
PGDLLIMPORT bool xact_is_sampled
Definition: xact.c:288
struct xl_xact_assignment xl_xact_assignment
bool IsInTransactionBlock(bool isTopLevel)
Definition: xact.c:3688
bool PrepareTransactionBlock(const char *gid)
Definition: xact.c:3914
struct xl_xact_abort xl_xact_abort
int GetCurrentTransactionNestLevel(void)
Definition: xact.c:915
void xact_redo(XLogReaderState *record)
Definition: xact.c:6285
xl_xact_parsed_commit xl_xact_parsed_prepare
Definition: xact.h:402
TransactionId GetTopTransactionId(void)
Definition: xact.c:418
void EnterParallelMode(void)
Definition: xact.c:1037
struct xl_xact_dbinfo xl_xact_dbinfo
TransactionId GetStableLatestTransactionId(void)
Definition: xact.c:599
void UnregisterSubXactCallback(SubXactCallback callback, void *arg)
Definition: xact.c:3799
PGDLLIMPORT bool DefaultXactReadOnly
Definition: xact.c:79
void BeginImplicitTransactionBlock(void)
Definition: xact.c:4248
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:3635
struct xl_xact_invals xl_xact_invals
void DefineSavepoint(const char *name)
Definition: xact.c:4295
struct xl_xact_origin xl_xact_origin
PGDLLIMPORT bool bsysscan
Definition: xact.c:98
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:3739
bool IsTransactionState(void)
Definition: xact.c:379
PGDLLIMPORT bool DefaultXactDeferrable
Definition: xact.c:82
void CommandCounterIncrement(void)
Definition: xact.c:1079
void PreventInTransactionBlock(bool isTopLevel, const char *stmtType)
Definition: xact.c:3557
Size EstimateTransactionStateSpace(void)
Definition: xact.c:5434
TransactionId GetTopTransactionIdIfAny(void)
Definition: xact.c:433
struct xl_xact_commit xl_xact_commit
#define GIDSIZE
Definition: xact.h:31
PGDLLIMPORT bool XactDeferrable
Definition: xact.c:83
char TransactionBlockStatusCode(void)
Definition: xact.c:4924
void RollbackAndReleaseCurrentSubTransaction(void)
Definition: xact.c:4721
FullTransactionId GetCurrentFullTransactionIdIfAny(void)
Definition: xact.c:522
void StartTransactionCommand(void)
Definition: xact.c:2955
bool IsAbortedTransactionBlockState(void)
Definition: xact.c:399
void ReleaseCurrentSubTransaction(void)
Definition: xact.c:4687
void EndImplicitTransactionBlock(void)
Definition: xact.c:4273
void StartParallelWorkerTransaction(char *tstatespace)
Definition: xact.c:5533
void SetParallelStartTimestamps(TimestampTz xact_ts, TimestampTz stmt_ts)
Definition: xact.c:845
void ReleaseSavepoint(const char *name)
Definition: xact.c:4380
const char * xact_identify(uint8 info)
Definition: xactdesc.c:484
FullTransactionId GetTopFullTransactionId(void)
Definition: xact.c:475
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:5736
void ForceSyncCommit(void)
Definition: xact.c:1129
bool IsSubTransaction(void)
Definition: xact.c:4965
void MarkSubxactTopXidLogged(void)
Definition: xact.c:583
struct xl_xact_parsed_abort xl_xact_parsed_abort
struct xl_xact_xinfo xl_xact_xinfo
void SetCurrentStatementStartTimestamp(void)
Definition: xact.c:900
bool TransactionIdIsCurrentTransactionId(TransactionId xid)
Definition: xact.c:927
struct xl_xact_subxacts xl_xact_subxacts
PGDLLIMPORT TransactionId CheckXidAlive
Definition: xact.c:97
bool IsTransactionBlock(void)
Definition: xact.c:4892
bool IsInParallelMode(void)
Definition: xact.c:1070
int xactGetCommittedChildren(TransactionId **ptr)
Definition: xact.c:5712
TransactionId GetCurrentTransactionIdIfAny(void)
Definition: xact.c:463
void BeginTransactionBlock(void)
Definition: xact.c:3846
TimestampTz GetCurrentStatementStartTimestamp(void)
Definition: xact.c:865
TimestampTz GetCurrentTransactionStartTimestamp(void)
Definition: xact.c:856
void EndParallelWorkerTransaction(void)
Definition: xact.c:5558
struct SavedTransactionCharacteristics SavedTransactionCharacteristics
void RegisterXactCallback(XactCallback callback, void *arg)
Definition: xact.c:3726
void CommitTransactionCommand(void)
Definition: xact.c:3053
PGDLLIMPORT int XactIsoLevel
Definition: xact.c:77
void RollbackToSavepoint(const char *name)
Definition: xact.c:4489
struct xl_xact_twophase xl_xact_twophase
bool SubTransactionIsActive(SubTransactionId subxid)
Definition: xact.c:795
void RegisterSubXactCallback(SubXactCallback callback, void *arg)
Definition: xact.c:3786
FullTransactionId GetTopFullTransactionIdIfAny(void)
Definition: xact.c:491
TransactionId GetCurrentTransactionId(void)
Definition: xact.c:446
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:3966
bool IsSubxactTopXidLogPending(void)
Definition: xact.c:551
void ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *parsed)
Definition: xactdesc.c:239
void AbortOutOfAnyTransaction(void)
Definition: xact.c:4788
void AbortCurrentTransaction(void)
Definition: xact.c:3351
TimestampTz GetCurrentTransactionStopTimestamp(void)
Definition: xact.c:877
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:5908
void MarkCurrentTransactionIdLoggedIfAny(void)
Definition: xact.c:533
PGDLLIMPORT int DefaultXactIsoLevel
Definition: xact.c:76
CommandId GetCurrentCommandId(bool used)
Definition: xact.c:819
uint64 XLogRecPtr
Definition: xlogdefs.h:21