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/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  * start- and end-of-transaction callbacks for dynamically loaded modules
118  */
119 typedef enum
120 {
130 
131 typedef void (*XactCallback) (XactEvent event, void *arg);
132 
133 typedef enum
134 {
140 
141 typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid,
142  SubTransactionId parentSubid, void *arg);
143 
144 /* Data structure for Save/RestoreTransactionCharacteristics */
146 {
151 
152 
153 /* ----------------
154  * transaction-related XLOG entries
155  * ----------------
156  */
157 
158 /*
159  * XLOG allows to store some information in high 4 bits of log record xl_info
160  * field. We use 3 for the opcode, and one about an optional flag variable.
161  */
162 #define XLOG_XACT_COMMIT 0x00
163 #define XLOG_XACT_PREPARE 0x10
164 #define XLOG_XACT_ABORT 0x20
165 #define XLOG_XACT_COMMIT_PREPARED 0x30
166 #define XLOG_XACT_ABORT_PREPARED 0x40
167 #define XLOG_XACT_ASSIGNMENT 0x50
168 #define XLOG_XACT_INVALIDATIONS 0x60
169 /* free opcode 0x70 */
170 
171 /* mask for filtering opcodes out of xl_info */
172 #define XLOG_XACT_OPMASK 0x70
173 
174 /* does this record have a 'xinfo' field or not */
175 #define XLOG_XACT_HAS_INFO 0x80
176 
177 /*
178  * The following flags, stored in xinfo, determine which information is
179  * contained in commit/abort records.
180  */
181 #define XACT_XINFO_HAS_DBINFO (1U << 0)
182 #define XACT_XINFO_HAS_SUBXACTS (1U << 1)
183 #define XACT_XINFO_HAS_RELFILELOCATORS (1U << 2)
184 #define XACT_XINFO_HAS_INVALS (1U << 3)
185 #define XACT_XINFO_HAS_TWOPHASE (1U << 4)
186 #define XACT_XINFO_HAS_ORIGIN (1U << 5)
187 #define XACT_XINFO_HAS_AE_LOCKS (1U << 6)
188 #define XACT_XINFO_HAS_GID (1U << 7)
189 #define XACT_XINFO_HAS_DROPPED_STATS (1U << 8)
190 
191 /*
192  * Also stored in xinfo, these indicating a variety of additional actions that
193  * need to occur when emulating transaction effects during recovery.
194  *
195  * They are named XactCompletion... to differentiate them from
196  * EOXact... routines which run at the end of the original transaction
197  * completion.
198  */
199 #define XACT_COMPLETION_APPLY_FEEDBACK (1U << 29)
200 #define XACT_COMPLETION_UPDATE_RELCACHE_FILE (1U << 30)
201 #define XACT_COMPLETION_FORCE_SYNC_COMMIT (1U << 31)
202 
203 /* Access macros for above flags */
204 #define XactCompletionApplyFeedback(xinfo) \
205  ((xinfo & XACT_COMPLETION_APPLY_FEEDBACK) != 0)
206 #define XactCompletionRelcacheInitFileInval(xinfo) \
207  ((xinfo & XACT_COMPLETION_UPDATE_RELCACHE_FILE) != 0)
208 #define XactCompletionForceSyncCommit(xinfo) \
209  ((xinfo & XACT_COMPLETION_FORCE_SYNC_COMMIT) != 0)
210 
211 typedef struct xl_xact_assignment
212 {
213  TransactionId xtop; /* assigned XID's top-level XID */
214  int nsubxacts; /* number of subtransaction XIDs */
215  TransactionId xsub[FLEXIBLE_ARRAY_MEMBER]; /* assigned subxids */
217 
218 #define MinSizeOfXactAssignment offsetof(xl_xact_assignment, xsub)
219 
220 /*
221  * Commit and abort records can contain a lot of information. But a large
222  * portion of the records won't need all possible pieces of information. So we
223  * only include what's needed.
224  *
225  * A minimal commit/abort record only consists of a xl_xact_commit/abort
226  * struct. The presence of additional information is indicated by bits set in
227  * 'xl_xact_xinfo->xinfo'. The presence of the xinfo field itself is signaled
228  * by a set XLOG_XACT_HAS_INFO bit in the xl_info field.
229  *
230  * NB: All the individual data chunks should be sized to multiples of
231  * sizeof(int) and only require int32 alignment. If they require bigger
232  * alignment, they need to be copied upon reading.
233  */
234 
235 /* sub-records for commit/abort */
236 
237 typedef struct xl_xact_xinfo
238 {
239  /*
240  * Even though we right now only require two bytes of space in xinfo we
241  * use four so following records don't have to care about alignment.
242  * Commit records can be large, so copying large portions isn't
243  * attractive.
244  */
247 
248 typedef struct xl_xact_dbinfo
249 {
250  Oid dbId; /* MyDatabaseId */
251  Oid tsId; /* MyDatabaseTableSpace */
253 
254 typedef struct xl_xact_subxacts
255 {
256  int nsubxacts; /* number of subtransaction XIDs */
259 #define MinSizeOfXactSubxacts offsetof(xl_xact_subxacts, subxacts)
260 
262 {
263  int nrels; /* number of relations */
266 #define MinSizeOfXactRelfileLocators offsetof(xl_xact_relfilelocators, xlocators)
267 
268 /*
269  * A transactionally dropped statistics entry.
270  *
271  * Declared here rather than pgstat.h because pgstat.h can't be included from
272  * frontend code, but the WAL format needs to be readable by frontend
273  * programs.
274  */
275 typedef struct xl_xact_stats_item
276 {
277  int kind;
281 
282 typedef struct xl_xact_stats_items
283 {
284  int nitems;
287 #define MinSizeOfXactStatsItems offsetof(xl_xact_stats_items, items)
288 
289 typedef struct xl_xact_invals
290 {
291  int nmsgs; /* number of shared inval msgs */
294 #define MinSizeOfXactInvals offsetof(xl_xact_invals, msgs)
295 
296 typedef struct xl_xact_twophase
297 {
300 
301 typedef struct xl_xact_origin
302 {
306 
307 typedef struct xl_xact_commit
308 {
309  TimestampTz xact_time; /* time of commit */
310 
311  /* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */
312  /* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */
313  /* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */
314  /* xl_xact_relfilelocators follows if XINFO_HAS_RELFILELOCATORS */
315  /* xl_xact_stats_items follows if XINFO_HAS_DROPPED_STATS */
316  /* xl_xact_invals follows if XINFO_HAS_INVALS */
317  /* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
318  /* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */
319  /* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */
321 #define MinSizeOfXactCommit (offsetof(xl_xact_commit, xact_time) + sizeof(TimestampTz))
322 
323 typedef struct xl_xact_abort
324 {
325  TimestampTz xact_time; /* time of abort */
326 
327  /* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */
328  /* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */
329  /* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */
330  /* xl_xact_relfilelocators follows if XINFO_HAS_RELFILELOCATORS */
331  /* xl_xact_stats_items follows if XINFO_HAS_DROPPED_STATS */
332  /* No invalidation messages needed. */
333  /* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
334  /* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */
335  /* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */
337 #define MinSizeOfXactAbort sizeof(xl_xact_abort)
338 
339 typedef struct xl_xact_prepare
340 {
341  uint32 magic; /* format identifier */
342  uint32 total_len; /* actual file length */
343  TransactionId xid; /* original transaction XID */
344  Oid database; /* OID of database it was in */
345  TimestampTz prepared_at; /* time of preparation */
346  Oid owner; /* user running the transaction */
347  int32 nsubxacts; /* number of following subxact XIDs */
348  int32 ncommitrels; /* number of delete-on-commit rels */
349  int32 nabortrels; /* number of delete-on-abort rels */
350  int32 ncommitstats; /* number of stats to drop on commit */
351  int32 nabortstats; /* number of stats to drop on abort */
352  int32 ninvalmsgs; /* number of cache invalidation messages */
353  bool initfileinval; /* does relcache init file need invalidation? */
354  uint16 gidlen; /* length of the GID - GID follows the header */
355  XLogRecPtr origin_lsn; /* lsn of this record at origin node */
356  TimestampTz origin_timestamp; /* time of prepare at origin node */
358 
359 /*
360  * Commit/Abort records in the above form are a bit verbose to parse, so
361  * there's a deconstructed versions generated by ParseCommit/AbortRecord() for
362  * easier consumption.
363  */
364 typedef struct xl_xact_parsed_commit
365 {
368 
369  Oid dbId; /* MyDatabaseId */
370  Oid tsId; /* MyDatabaseTableSpace */
371 
374 
375  int nrels;
377 
378  int nstats;
380 
381  int nmsgs;
383 
384  TransactionId twophase_xid; /* only for 2PC */
385  char twophase_gid[GIDSIZE]; /* only for 2PC */
386  int nabortrels; /* only for 2PC */
387  RelFileLocator *abortlocators; /* only for 2PC */
388  int nabortstats; /* only for 2PC */
389  xl_xact_stats_item *abortstats; /* only for 2PC */
390 
394 
396 
397 typedef struct xl_xact_parsed_abort
398 {
401 
402  Oid dbId; /* MyDatabaseId */
403  Oid tsId; /* MyDatabaseTableSpace */
404 
407 
408  int nrels;
410 
411  int nstats;
413 
414  TransactionId twophase_xid; /* only for 2PC */
415  char twophase_gid[GIDSIZE]; /* only for 2PC */
416 
420 
421 
422 /* ----------------
423  * extern definitions
424  * ----------------
425  */
426 extern bool IsTransactionState(void);
427 extern bool IsAbortedTransactionBlockState(void);
438 extern void MarkCurrentTransactionIdLoggedIfAny(void);
439 extern bool SubTransactionIsActive(SubTransactionId subxid);
440 extern CommandId GetCurrentCommandId(bool used);
441 extern void SetParallelStartTimestamps(TimestampTz xact_ts, TimestampTz stmt_ts);
445 extern void SetCurrentStatementStartTimestamp(void);
446 extern int GetCurrentTransactionNestLevel(void);
448 extern void CommandCounterIncrement(void);
449 extern void ForceSyncCommit(void);
450 extern void StartTransactionCommand(void);
453 extern void CommitTransactionCommand(void);
454 extern void AbortCurrentTransaction(void);
455 extern void BeginTransactionBlock(void);
456 extern bool EndTransactionBlock(bool chain);
457 extern bool PrepareTransactionBlock(const char *gid);
458 extern void UserAbortTransactionBlock(bool chain);
459 extern void BeginImplicitTransactionBlock(void);
460 extern void EndImplicitTransactionBlock(void);
461 extern void ReleaseSavepoint(const char *name);
462 extern void DefineSavepoint(const char *name);
463 extern void RollbackToSavepoint(const char *name);
464 extern void BeginInternalSubTransaction(const char *name);
465 extern void ReleaseCurrentSubTransaction(void);
467 extern bool IsSubTransaction(void);
469 extern void SerializeTransactionState(Size maxsize, char *start_address);
470 extern void StartParallelWorkerTransaction(char *tstatespace);
471 extern void EndParallelWorkerTransaction(void);
472 extern bool IsTransactionBlock(void);
473 extern bool IsTransactionOrTransactionBlock(void);
474 extern char TransactionBlockStatusCode(void);
475 extern void AbortOutOfAnyTransaction(void);
476 extern void PreventInTransactionBlock(bool isTopLevel, const char *stmtType);
477 extern void RequireTransactionBlock(bool isTopLevel, const char *stmtType);
478 extern void WarnNoTransactionBlock(bool isTopLevel, const char *stmtType);
479 extern bool IsInTransactionBlock(bool isTopLevel);
480 extern void RegisterXactCallback(XactCallback callback, void *arg);
481 extern void UnregisterXactCallback(XactCallback callback, void *arg);
484 
485 extern bool IsSubxactTopXidLogPending(void);
486 extern void MarkSubxactTopXidLogged(void);
487 
488 extern int xactGetCommittedChildren(TransactionId **ptr);
489 
490 extern XLogRecPtr XactLogCommitRecord(TimestampTz commit_time,
491  int nsubxacts, TransactionId *subxacts,
492  int nrels, RelFileLocator *rels,
493  int ndroppedstats,
494  xl_xact_stats_item *droppedstats,
495  int nmsgs, SharedInvalidationMessage *msgs,
496  bool relcacheInval,
497  int xactflags,
498  TransactionId twophase_xid,
499  const char *twophase_gid);
500 
501 extern XLogRecPtr XactLogAbortRecord(TimestampTz abort_time,
502  int nsubxacts, TransactionId *subxacts,
503  int nrels, RelFileLocator *rels,
504  int ndroppedstats,
505  xl_xact_stats_item *droppedstats,
506  int xactflags, TransactionId twophase_xid,
507  const char *twophase_gid);
508 extern void xact_redo(XLogReaderState *record);
509 
510 /* xactdesc.c */
511 extern void xact_desc(StringInfo buf, XLogReaderState *record);
512 extern const char *xact_identify(uint8 info);
513 
514 /* also in xactdesc.c, so they can be shared between front/backend code */
515 extern void ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *parsed);
516 extern void ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed);
517 extern void ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *parsed);
518 
519 extern void EnterParallelMode(void);
520 extern void ExitParallelMode(void);
521 extern bool IsInParallelMode(void);
522 
523 #endif /* XACT_H */
unsigned short uint16
Definition: c.h:441
unsigned int uint32
Definition: c.h:442
#define PGDLLIMPORT
Definition: c.h:1252
uint32 SubTransactionId
Definition: c.h:592
signed int int32
Definition: c.h:430
#define FLEXIBLE_ARRAY_MEMBER
Definition: c.h:362
unsigned char uint8
Definition: c.h:440
uint32 CommandId
Definition: c.h:602
uint32 TransactionId
Definition: c.h:588
size_t Size
Definition: c.h:541
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:325
TransactionId xtop
Definition: xact.h:213
TransactionId xsub[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:215
TimestampTz xact_time
Definition: xact.h:309
Oid tsId
Definition: xact.h:251
Oid dbId
Definition: xact.h:250
SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:292
int nmsgs
Definition: xact.h:291
TimestampTz origin_timestamp
Definition: xact.h:304
XLogRecPtr origin_lsn
Definition: xact.h:303
xl_xact_stats_item * stats
Definition: xact.h:412
RelFileLocator * xlocators
Definition: xact.h:409
TransactionId twophase_xid
Definition: xact.h:414
TimestampTz xact_time
Definition: xact.h:399
TransactionId * subxacts
Definition: xact.h:406
XLogRecPtr origin_lsn
Definition: xact.h:417
char twophase_gid[GIDSIZE]
Definition: xact.h:415
TimestampTz origin_timestamp
Definition: xact.h:418
xl_xact_stats_item * stats
Definition: xact.h:379
TimestampTz xact_time
Definition: xact.h:366
TransactionId twophase_xid
Definition: xact.h:384
RelFileLocator * xlocators
Definition: xact.h:376
RelFileLocator * abortlocators
Definition: xact.h:387
TimestampTz origin_timestamp
Definition: xact.h:392
TransactionId * subxacts
Definition: xact.h:373
char twophase_gid[GIDSIZE]
Definition: xact.h:385
XLogRecPtr origin_lsn
Definition: xact.h:391
xl_xact_stats_item * abortstats
Definition: xact.h:389
SharedInvalidationMessage * msgs
Definition: xact.h:382
TimestampTz prepared_at
Definition: xact.h:345
int32 nabortrels
Definition: xact.h:349
int32 ninvalmsgs
Definition: xact.h:352
bool initfileinval
Definition: xact.h:353
int32 ncommitstats
Definition: xact.h:350
TimestampTz origin_timestamp
Definition: xact.h:356
uint16 gidlen
Definition: xact.h:354
uint32 total_len
Definition: xact.h:342
int32 nabortstats
Definition: xact.h:351
Oid database
Definition: xact.h:344
XLogRecPtr origin_lsn
Definition: xact.h:355
uint32 magic
Definition: xact.h:341
int32 ncommitrels
Definition: xact.h:348
TransactionId xid
Definition: xact.h:343
int32 nsubxacts
Definition: xact.h:347
RelFileLocator xlocators[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:264
xl_xact_stats_item items[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:285
TransactionId subxacts[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:257
int nsubxacts
Definition: xact.h:256
TransactionId xid
Definition: xact.h:298
uint32 xinfo
Definition: xact.h:245
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
Definition: test_ifaddrs.c:46
bool IsTransactionOrTransactionBlock(void)
Definition: xact.c:4814
void SerializeTransactionState(Size maxsize, char *start_address)
Definition: xact.c:5352
void ExitParallelMode(void)
Definition: xact.c:1048
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:4520
FullTransactionId GetCurrentFullTransactionId(void)
Definition: xact.c:502
void RestoreTransactionCharacteristics(const SavedTransactionCharacteristics *s)
Definition: xact.c:3010
void WarnNoTransactionBlock(bool isTopLevel, const char *stmtType)
Definition: xact.c:3531
PGDLLIMPORT int synchronous_commit
Definition: xact.c:86
SubTransactionId GetCurrentSubTransactionId(void)
Definition: xact.c:779
void(* SubXactCallback)(SubXactEvent event, SubTransactionId mySubid, SubTransactionId parentSubid, void *arg)
Definition: xact.h:141
void UserAbortTransactionBlock(bool chain)
Definition: xact.c:4030
PGDLLIMPORT bool xact_is_sampled
Definition: xact.c:289
struct xl_xact_assignment xl_xact_assignment
bool IsInTransactionBlock(bool isTopLevel)
Definition: xact.c:3588
bool PrepareTransactionBlock(const char *gid)
Definition: xact.c:3818
struct xl_xact_abort xl_xact_abort
int GetCurrentTransactionNestLevel(void)
Definition: xact.c:913
void xact_redo(XLogReaderState *record)
Definition: xact.c:6167
xl_xact_parsed_commit xl_xact_parsed_prepare
Definition: xact.h:395
TransactionId GetTopTransactionId(void)
Definition: xact.c:416
void EnterParallelMode(void)
Definition: xact.c:1035
struct xl_xact_dbinfo xl_xact_dbinfo
TransactionId GetStableLatestTransactionId(void)
Definition: xact.c:597
void UnregisterSubXactCallback(SubXactCallback callback, void *arg)
Definition: xact.c:3703
PGDLLIMPORT bool DefaultXactReadOnly
Definition: xact.c:80
void BeginImplicitTransactionBlock(void)
Definition: xact.c:4152
SubXactEvent
Definition: xact.h:134
@ SUBXACT_EVENT_PRE_COMMIT_SUB
Definition: xact.h:138
@ SUBXACT_EVENT_START_SUB
Definition: xact.h:135
@ SUBXACT_EVENT_ABORT_SUB
Definition: xact.h:137
@ SUBXACT_EVENT_COMMIT_SUB
Definition: xact.h:136
void(* XactCallback)(XactEvent event, void *arg)
Definition: xact.h:131
void RequireTransactionBlock(bool isTopLevel, const char *stmtType)
Definition: xact.c:3537
struct xl_xact_invals xl_xact_invals
void DefineSavepoint(const char *name)
Definition: xact.c:4199
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:120
@ XACT_EVENT_PRE_PREPARE
Definition: xact.h:128
@ XACT_EVENT_COMMIT
Definition: xact.h:121
@ XACT_EVENT_PARALLEL_PRE_COMMIT
Definition: xact.h:127
@ XACT_EVENT_PARALLEL_COMMIT
Definition: xact.h:122
@ XACT_EVENT_ABORT
Definition: xact.h:123
@ XACT_EVENT_PRE_COMMIT
Definition: xact.h:126
@ XACT_EVENT_PARALLEL_ABORT
Definition: xact.h:124
@ XACT_EVENT_PREPARE
Definition: xact.h:125
void UnregisterXactCallback(XactCallback callback, void *arg)
Definition: xact.c:3643
bool IsTransactionState(void)
Definition: xact.c:377
PGDLLIMPORT bool DefaultXactDeferrable
Definition: xact.c:83
void CommandCounterIncrement(void)
Definition: xact.c:1077
void PreventInTransactionBlock(bool isTopLevel, const char *stmtType)
Definition: xact.c:3469
Size EstimateTransactionStateSpace(void)
Definition: xact.c:5324
TransactionId GetTopTransactionIdIfAny(void)
Definition: xact.c:431
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:4828
void RollbackAndReleaseCurrentSubTransaction(void)
Definition: xact.c:4625
FullTransactionId GetCurrentFullTransactionIdIfAny(void)
Definition: xact.c:520
void StartTransactionCommand(void)
Definition: xact.c:2925
bool IsAbortedTransactionBlockState(void)
Definition: xact.c:397
void ReleaseCurrentSubTransaction(void)
Definition: xact.c:4591
void EndImplicitTransactionBlock(void)
Definition: xact.c:4177
void StartParallelWorkerTransaction(char *tstatespace)
Definition: xact.c:5423
void SetParallelStartTimestamps(TimestampTz xact_ts, TimestampTz stmt_ts)
Definition: xact.c:843
void ReleaseSavepoint(const char *name)
Definition: xact.c:4284
const char * xact_identify(uint8 info)
Definition: xactdesc.c:484
FullTransactionId GetTopFullTransactionId(void)
Definition: xact.c:473
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:5617
void ForceSyncCommit(void)
Definition: xact.c:1127
bool IsSubTransaction(void)
Definition: xact.c:4869
void MarkSubxactTopXidLogged(void)
Definition: xact.c:581
struct xl_xact_parsed_abort xl_xact_parsed_abort
struct xl_xact_xinfo xl_xact_xinfo
void SetCurrentStatementStartTimestamp(void)
Definition: xact.c:898
bool TransactionIdIsCurrentTransactionId(TransactionId xid)
Definition: xact.c:925
struct xl_xact_subxacts xl_xact_subxacts
PGDLLIMPORT TransactionId CheckXidAlive
Definition: xact.c:98
bool IsTransactionBlock(void)
Definition: xact.c:4796
bool IsInParallelMode(void)
Definition: xact.c:1068
int xactGetCommittedChildren(TransactionId **ptr)
Definition: xact.c:5593
TransactionId GetCurrentTransactionIdIfAny(void)
Definition: xact.c:461
void BeginTransactionBlock(void)
Definition: xact.c:3750
TimestampTz GetCurrentStatementStartTimestamp(void)
Definition: xact.c:863
TimestampTz GetCurrentTransactionStartTimestamp(void)
Definition: xact.c:854
void EndParallelWorkerTransaction(void)
Definition: xact.c:5448
struct SavedTransactionCharacteristics SavedTransactionCharacteristics
void RegisterXactCallback(XactCallback callback, void *arg)
Definition: xact.c:3630
void CommitTransactionCommand(void)
Definition: xact.c:3022
PGDLLIMPORT int XactIsoLevel
Definition: xact.c:78
void RollbackToSavepoint(const char *name)
Definition: xact.c:4393
struct xl_xact_twophase xl_xact_twophase
bool SubTransactionIsActive(SubTransactionId subxid)
Definition: xact.c:793
void RegisterSubXactCallback(SubXactCallback callback, void *arg)
Definition: xact.c:3690
FullTransactionId GetTopFullTransactionIdIfAny(void)
Definition: xact.c:489
TransactionId GetCurrentTransactionId(void)
Definition: xact.c:444
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:3870
bool IsSubxactTopXidLogPending(void)
Definition: xact.c:549
void ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *parsed)
Definition: xactdesc.c:239
void AbortOutOfAnyTransaction(void)
Definition: xact.c:4692
void AbortCurrentTransaction(void)
Definition: xact.c:3293
TimestampTz GetCurrentTransactionStopTimestamp(void)
Definition: xact.c:875
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:5789
void MarkCurrentTransactionIdLoggedIfAny(void)
Definition: xact.c:531
PGDLLIMPORT int DefaultXactIsoLevel
Definition: xact.c:77
CommandId GetCurrentCommandId(bool used)
Definition: xact.c:817
uint64 XLogRecPtr
Definition: xlogdefs.h:21