Thanks to visit codestin.com
Credit goes to doxygen.postgresql.org

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 weakest uses one snapshot per statement;
47 * the two stronger levels use one snapshot per database transaction.
48 * Serializable uses predicate locks in addition to the snapshot.
49 * These macros can be used to determine which implementation to use
50 * depending on the prevailing serialization level.
51 */
52#define IsolationUsesXactSnapshot() (XactIsoLevel >= XACT_REPEATABLE_READ)
53#define IsolationIsSerializable() (XactIsoLevel == XACT_SERIALIZABLE)
54
55/* Xact read-only state */
57extern PGDLLIMPORT bool XactReadOnly;
58
59/* flag for logging statements in this transaction */
61
62/*
63 * Xact is deferrable -- only meaningful (currently) for read only
64 * SERIALIZABLE transactions
65 */
67extern PGDLLIMPORT bool XactDeferrable;
68
69typedef enum
70{
71 SYNCHRONOUS_COMMIT_OFF, /* asynchronous commit */
72 SYNCHRONOUS_COMMIT_LOCAL_FLUSH, /* wait for local flush only */
73 SYNCHRONOUS_COMMIT_REMOTE_WRITE, /* wait for local flush and remote
74 * write */
75 SYNCHRONOUS_COMMIT_REMOTE_FLUSH, /* wait for local and remote flush */
76 SYNCHRONOUS_COMMIT_REMOTE_APPLY, /* wait for local and remote flush and
77 * remote apply */
79
80/* Define the default setting for synchronous_commit */
81#define SYNCHRONOUS_COMMIT_ON SYNCHRONOUS_COMMIT_REMOTE_FLUSH
82
83/* Synchronous commit level */
85
86/* used during logical streaming of a transaction */
88extern PGDLLIMPORT bool bsysscan;
89
90/*
91 * Miscellaneous flag bits to record events which occur on the top level
92 * transaction. These flags are only persisted in MyXactFlags and are intended
93 * so we remember to do certain things later in the transaction. This is
94 * globally accessible, so can be set from anywhere in the code which requires
95 * recording flags.
96 */
97extern PGDLLIMPORT int MyXactFlags;
98
99/*
100 * XACT_FLAGS_ACCESSEDTEMPNAMESPACE - set when a temporary object is accessed.
101 * We don't allow PREPARE TRANSACTION in that case.
102 */
103#define XACT_FLAGS_ACCESSEDTEMPNAMESPACE (1U << 0)
104
105/*
106 * XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK - records whether the top level xact
107 * logged any Access Exclusive Locks.
108 */
109#define XACT_FLAGS_ACQUIREDACCESSEXCLUSIVELOCK (1U << 1)
110
111/*
112 * XACT_FLAGS_NEEDIMMEDIATECOMMIT - records whether the top level statement
113 * is one that requires immediate commit, such as CREATE DATABASE.
114 */
115#define XACT_FLAGS_NEEDIMMEDIATECOMMIT (1U << 2)
116
117/*
118 * XACT_FLAGS_PIPELINING - set when we complete an extended-query-protocol
119 * Execute message. This is useful for detecting that an implicit transaction
120 * block has been created via pipelining.
121 */
122#define XACT_FLAGS_PIPELINING (1U << 3)
123
124/*
125 * start- and end-of-transaction callbacks for dynamically loaded modules
126 */
127typedef enum
128{
137} XactEvent;
138
139typedef void (*XactCallback) (XactEvent event, void *arg);
140
141typedef enum
142{
148
149typedef void (*SubXactCallback) (SubXactEvent event, SubTransactionId mySubid,
150 SubTransactionId parentSubid, void *arg);
151
152/* Data structure for Save/RestoreTransactionCharacteristics */
154{
159
160
161/* ----------------
162 * transaction-related XLOG entries
163 * ----------------
164 */
165
166/*
167 * XLOG allows to store some information in high 4 bits of log record xl_info
168 * field. We use 3 for the opcode, and one about an optional flag variable.
169 */
170#define XLOG_XACT_COMMIT 0x00
171#define XLOG_XACT_PREPARE 0x10
172#define XLOG_XACT_ABORT 0x20
173#define XLOG_XACT_COMMIT_PREPARED 0x30
174#define XLOG_XACT_ABORT_PREPARED 0x40
175#define XLOG_XACT_ASSIGNMENT 0x50
176#define XLOG_XACT_INVALIDATIONS 0x60
177/* free opcode 0x70 */
178
179/* mask for filtering opcodes out of xl_info */
180#define XLOG_XACT_OPMASK 0x70
181
182/* does this record have a 'xinfo' field or not */
183#define XLOG_XACT_HAS_INFO 0x80
184
185/*
186 * The following flags, stored in xinfo, determine which information is
187 * contained in commit/abort records.
188 */
189#define XACT_XINFO_HAS_DBINFO (1U << 0)
190#define XACT_XINFO_HAS_SUBXACTS (1U << 1)
191#define XACT_XINFO_HAS_RELFILELOCATORS (1U << 2)
192#define XACT_XINFO_HAS_INVALS (1U << 3)
193#define XACT_XINFO_HAS_TWOPHASE (1U << 4)
194#define XACT_XINFO_HAS_ORIGIN (1U << 5)
195#define XACT_XINFO_HAS_AE_LOCKS (1U << 6)
196#define XACT_XINFO_HAS_GID (1U << 7)
197#define XACT_XINFO_HAS_DROPPED_STATS (1U << 8)
198
199/*
200 * Also stored in xinfo, these indicating a variety of additional actions that
201 * need to occur when emulating transaction effects during recovery.
202 *
203 * They are named XactCompletion... to differentiate them from
204 * EOXact... routines which run at the end of the original transaction
205 * completion.
206 */
207#define XACT_COMPLETION_APPLY_FEEDBACK (1U << 29)
208#define XACT_COMPLETION_UPDATE_RELCACHE_FILE (1U << 30)
209#define XACT_COMPLETION_FORCE_SYNC_COMMIT (1U << 31)
210
211/* Access macros for above flags */
212#define XactCompletionApplyFeedback(xinfo) \
213 ((xinfo & XACT_COMPLETION_APPLY_FEEDBACK) != 0)
214#define XactCompletionRelcacheInitFileInval(xinfo) \
215 ((xinfo & XACT_COMPLETION_UPDATE_RELCACHE_FILE) != 0)
216#define XactCompletionForceSyncCommit(xinfo) \
217 ((xinfo & XACT_COMPLETION_FORCE_SYNC_COMMIT) != 0)
218
219typedef struct xl_xact_assignment
220{
221 TransactionId xtop; /* assigned XID's top-level XID */
222 int nsubxacts; /* number of subtransaction XIDs */
223 TransactionId xsub[FLEXIBLE_ARRAY_MEMBER]; /* assigned subxids */
225
226#define MinSizeOfXactAssignment offsetof(xl_xact_assignment, xsub)
227
228/*
229 * Commit and abort records can contain a lot of information. But a large
230 * portion of the records won't need all possible pieces of information. So we
231 * only include what's needed.
232 *
233 * A minimal commit/abort record only consists of a xl_xact_commit/abort
234 * struct. The presence of additional information is indicated by bits set in
235 * 'xl_xact_xinfo->xinfo'. The presence of the xinfo field itself is signaled
236 * by a set XLOG_XACT_HAS_INFO bit in the xl_info field.
237 *
238 * NB: All the individual data chunks should be sized to multiples of
239 * sizeof(int) and only require int32 alignment. If they require bigger
240 * alignment, they need to be copied upon reading.
241 */
242
243/* sub-records for commit/abort */
244
245typedef struct xl_xact_xinfo
246{
247 /*
248 * Even though we right now only require two bytes of space in xinfo we
249 * use four so following records don't have to care about alignment.
250 * Commit records can be large, so copying large portions isn't
251 * attractive.
252 */
255
256typedef struct xl_xact_dbinfo
257{
258 Oid dbId; /* MyDatabaseId */
259 Oid tsId; /* MyDatabaseTableSpace */
261
262typedef struct xl_xact_subxacts
263{
264 int nsubxacts; /* number of subtransaction XIDs */
267#define MinSizeOfXactSubxacts offsetof(xl_xact_subxacts, subxacts)
268
270{
271 int nrels; /* number of relations */
274#define MinSizeOfXactRelfileLocators offsetof(xl_xact_relfilelocators, xlocators)
275
276/*
277 * A transactionally dropped statistics entry.
278 *
279 * Declared here rather than pgstat.h because pgstat.h can't be included from
280 * frontend code, but the WAL format needs to be readable by frontend
281 * programs.
282 */
283typedef struct xl_xact_stats_item
284{
285 int kind;
287
288 /*
289 * This stores the value of PgStat_HashKey.objid as two uint32 as all the
290 * fields of xl_xact_xinfo should be multiples of size(int).
291 */
295
297{
301#define MinSizeOfXactStatsItems offsetof(xl_xact_stats_items, items)
302
303typedef struct xl_xact_invals
304{
305 int nmsgs; /* number of shared inval msgs */
308#define MinSizeOfXactInvals offsetof(xl_xact_invals, msgs)
309
310typedef struct xl_xact_twophase
311{
314
315typedef struct xl_xact_origin
316{
320
321typedef struct xl_xact_commit
322{
323 TimestampTz xact_time; /* time of commit */
324
325 /* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */
326 /* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */
327 /* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */
328 /* xl_xact_relfilelocators follows if XINFO_HAS_RELFILELOCATORS */
329 /* xl_xact_stats_items follows if XINFO_HAS_DROPPED_STATS */
330 /* xl_xact_invals follows if XINFO_HAS_INVALS */
331 /* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
332 /* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */
333 /* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */
335#define MinSizeOfXactCommit (offsetof(xl_xact_commit, xact_time) + sizeof(TimestampTz))
336
337typedef struct xl_xact_abort
338{
339 TimestampTz xact_time; /* time of abort */
340
341 /* xl_xact_xinfo follows if XLOG_XACT_HAS_INFO */
342 /* xl_xact_dbinfo follows if XINFO_HAS_DBINFO */
343 /* xl_xact_subxacts follows if XINFO_HAS_SUBXACT */
344 /* xl_xact_relfilelocators follows if XINFO_HAS_RELFILELOCATORS */
345 /* xl_xact_stats_items follows if XINFO_HAS_DROPPED_STATS */
346 /* No invalidation messages needed. */
347 /* xl_xact_twophase follows if XINFO_HAS_TWOPHASE */
348 /* twophase_gid follows if XINFO_HAS_GID. As a null-terminated string. */
349 /* xl_xact_origin follows if XINFO_HAS_ORIGIN, stored unaligned! */
351#define MinSizeOfXactAbort sizeof(xl_xact_abort)
352
353typedef struct xl_xact_prepare
354{
355 uint32 magic; /* format identifier */
356 uint32 total_len; /* actual file length */
357 TransactionId xid; /* original transaction XID */
358 Oid database; /* OID of database it was in */
359 TimestampTz prepared_at; /* time of preparation */
360 Oid owner; /* user running the transaction */
361 int32 nsubxacts; /* number of following subxact XIDs */
362 int32 ncommitrels; /* number of delete-on-commit rels */
363 int32 nabortrels; /* number of delete-on-abort rels */
364 int32 ncommitstats; /* number of stats to drop on commit */
365 int32 nabortstats; /* number of stats to drop on abort */
366 int32 ninvalmsgs; /* number of cache invalidation messages */
367 bool initfileinval; /* does relcache init file need invalidation? */
368 uint16 gidlen; /* length of the GID - GID follows the header */
369 XLogRecPtr origin_lsn; /* lsn of this record at origin node */
370 TimestampTz origin_timestamp; /* time of prepare at origin node */
372
373/*
374 * Commit/Abort records in the above form are a bit verbose to parse, so
375 * there's a deconstructed versions generated by ParseCommit/AbortRecord() for
376 * easier consumption.
377 */
379{
382
383 Oid dbId; /* MyDatabaseId */
384 Oid tsId; /* MyDatabaseTableSpace */
385
388
389 int nrels;
391
394
395 int nmsgs;
397
398 TransactionId twophase_xid; /* only for 2PC */
399 char twophase_gid[GIDSIZE]; /* only for 2PC */
400 int nabortrels; /* only for 2PC */
401 RelFileLocator *abortlocators; /* only for 2PC */
402 int nabortstats; /* only for 2PC */
403 xl_xact_stats_item *abortstats; /* only for 2PC */
404
408
410
412{
415
416 Oid dbId; /* MyDatabaseId */
417 Oid tsId; /* MyDatabaseTableSpace */
418
421
422 int nrels;
424
427
428 TransactionId twophase_xid; /* only for 2PC */
429 char twophase_gid[GIDSIZE]; /* only for 2PC */
430
434
435
436/* ----------------
437 * extern definitions
438 * ----------------
439 */
440extern bool IsTransactionState(void);
441extern bool IsAbortedTransactionBlockState(void);
453extern bool SubTransactionIsActive(SubTransactionId subxid);
454extern CommandId GetCurrentCommandId(bool used);
455extern void SetParallelStartTimestamps(TimestampTz xact_ts, TimestampTz stmt_ts);
459extern void SetCurrentStatementStartTimestamp(void);
460extern int GetCurrentTransactionNestLevel(void);
462extern void CommandCounterIncrement(void);
463extern void ForceSyncCommit(void);
464extern void StartTransactionCommand(void);
467extern void CommitTransactionCommand(void);
468extern void AbortCurrentTransaction(void);
469extern void BeginTransactionBlock(void);
470extern bool EndTransactionBlock(bool chain);
471extern bool PrepareTransactionBlock(const char *gid);
472extern void UserAbortTransactionBlock(bool chain);
473extern void BeginImplicitTransactionBlock(void);
474extern void EndImplicitTransactionBlock(void);
475extern void ReleaseSavepoint(const char *name);
476extern void DefineSavepoint(const char *name);
477extern void RollbackToSavepoint(const char *name);
478extern void BeginInternalSubTransaction(const char *name);
479extern void ReleaseCurrentSubTransaction(void);
481extern bool IsSubTransaction(void);
483extern void SerializeTransactionState(Size maxsize, char *start_address);
484extern void StartParallelWorkerTransaction(char *tstatespace);
485extern void EndParallelWorkerTransaction(void);
486extern bool IsTransactionBlock(void);
487extern bool IsTransactionOrTransactionBlock(void);
488extern char TransactionBlockStatusCode(void);
489extern void AbortOutOfAnyTransaction(void);
490extern void PreventInTransactionBlock(bool isTopLevel, const char *stmtType);
491extern void RequireTransactionBlock(bool isTopLevel, const char *stmtType);
492extern void WarnNoTransactionBlock(bool isTopLevel, const char *stmtType);
493extern bool IsInTransactionBlock(bool isTopLevel);
498
499extern bool IsSubxactTopXidLogPending(void);
500extern void MarkSubxactTopXidLogged(void);
501
503
505 int nsubxacts, TransactionId *subxacts,
506 int nrels, RelFileLocator *rels,
507 int ndroppedstats,
508 xl_xact_stats_item *droppedstats,
509 int nmsgs, SharedInvalidationMessage *msgs,
510 bool relcacheInval,
511 int xactflags,
512 TransactionId twophase_xid,
513 const char *twophase_gid);
514
516 int nsubxacts, TransactionId *subxacts,
517 int nrels, RelFileLocator *rels,
518 int ndroppedstats,
519 xl_xact_stats_item *droppedstats,
520 int xactflags, TransactionId twophase_xid,
521 const char *twophase_gid);
522extern void xact_redo(XLogReaderState *record);
523
524/* xactdesc.c */
525extern void xact_desc(StringInfo buf, XLogReaderState *record);
526extern const char *xact_identify(uint8 info);
527
528/* also in xactdesc.c, so they can be shared between front/backend code */
529extern void ParseCommitRecord(uint8 info, xl_xact_commit *xlrec, xl_xact_parsed_commit *parsed);
530extern void ParseAbortRecord(uint8 info, xl_xact_abort *xlrec, xl_xact_parsed_abort *parsed);
531extern void ParsePrepareRecord(uint8 info, xl_xact_prepare *xlrec, xl_xact_parsed_prepare *parsed);
532
533extern void EnterParallelMode(void);
534extern void ExitParallelMode(void);
535extern bool IsInParallelMode(void);
536
537#endif /* XACT_H */
#define PGDLLIMPORT
Definition: c.h:1320
uint8_t uint8
Definition: c.h:537
uint32 SubTransactionId
Definition: c.h:662
#define FLEXIBLE_ARRAY_MEMBER
Definition: c.h:471
int32_t int32
Definition: c.h:535
uint16_t uint16
Definition: c.h:538
uint32_t uint32
Definition: c.h:539
uint32 CommandId
Definition: c.h:672
uint32 TransactionId
Definition: c.h:658
size_t Size
Definition: c.h:611
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:339
TransactionId xtop
Definition: xact.h:221
TransactionId xsub[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:223
TimestampTz xact_time
Definition: xact.h:323
Oid tsId
Definition: xact.h:259
Oid dbId
Definition: xact.h:258
SharedInvalidationMessage msgs[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:306
int nmsgs
Definition: xact.h:305
TimestampTz origin_timestamp
Definition: xact.h:318
XLogRecPtr origin_lsn
Definition: xact.h:317
xl_xact_stats_item * stats
Definition: xact.h:426
RelFileLocator * xlocators
Definition: xact.h:423
TransactionId twophase_xid
Definition: xact.h:428
TimestampTz xact_time
Definition: xact.h:413
TransactionId * subxacts
Definition: xact.h:420
XLogRecPtr origin_lsn
Definition: xact.h:431
char twophase_gid[GIDSIZE]
Definition: xact.h:429
TimestampTz origin_timestamp
Definition: xact.h:432
xl_xact_stats_item * stats
Definition: xact.h:393
TimestampTz xact_time
Definition: xact.h:380
TransactionId twophase_xid
Definition: xact.h:398
RelFileLocator * xlocators
Definition: xact.h:390
RelFileLocator * abortlocators
Definition: xact.h:401
TimestampTz origin_timestamp
Definition: xact.h:406
TransactionId * subxacts
Definition: xact.h:387
char twophase_gid[GIDSIZE]
Definition: xact.h:399
XLogRecPtr origin_lsn
Definition: xact.h:405
xl_xact_stats_item * abortstats
Definition: xact.h:403
SharedInvalidationMessage * msgs
Definition: xact.h:396
TimestampTz prepared_at
Definition: xact.h:359
int32 nabortrels
Definition: xact.h:363
int32 ninvalmsgs
Definition: xact.h:366
bool initfileinval
Definition: xact.h:367
int32 ncommitstats
Definition: xact.h:364
TimestampTz origin_timestamp
Definition: xact.h:370
uint16 gidlen
Definition: xact.h:368
uint32 total_len
Definition: xact.h:356
int32 nabortstats
Definition: xact.h:365
Oid database
Definition: xact.h:358
XLogRecPtr origin_lsn
Definition: xact.h:369
uint32 magic
Definition: xact.h:355
int32 ncommitrels
Definition: xact.h:362
TransactionId xid
Definition: xact.h:357
int32 nsubxacts
Definition: xact.h:361
RelFileLocator xlocators[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:272
uint32 objid_lo
Definition: xact.h:292
uint32 objid_hi
Definition: xact.h:293
xl_xact_stats_item items[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:299
TransactionId subxacts[FLEXIBLE_ARRAY_MEMBER]
Definition: xact.h:265
int nsubxacts
Definition: xact.h:264
TransactionId xid
Definition: xact.h:312
uint32 xinfo
Definition: xact.h:253
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:5001
void SerializeTransactionState(Size maxsize, char *start_address)
Definition: xact.c:5552
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:487
void SaveTransactionCharacteristics(SavedTransactionCharacteristics *s)
Definition: xact.c:3148
void BeginInternalSubTransaction(const char *name)
Definition: xact.c:4706
FullTransactionId GetCurrentFullTransactionId(void)
Definition: xact.c:512
void RestoreTransactionCharacteristics(const SavedTransactionCharacteristics *s)
Definition: xact.c:3156
void WarnNoTransactionBlock(bool isTopLevel, const char *stmtType)
Definition: xact.c:3722
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:149
void UserAbortTransactionBlock(bool chain)
Definition: xact.c:4216
PGDLLIMPORT bool xact_is_sampled
Definition: xact.c:296
struct xl_xact_assignment xl_xact_assignment
bool IsInTransactionBlock(bool isTopLevel)
Definition: xact.c:3781
bool PrepareTransactionBlock(const char *gid)
Definition: xact.c:4004
struct xl_xact_abort xl_xact_abort
int GetCurrentTransactionNestLevel(void)
Definition: xact.c:929
void xact_redo(XLogReaderState *record)
Definition: xact.c:6375
xl_xact_parsed_commit xl_xact_parsed_prepare
Definition: xact.h:409
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:3889
PGDLLIMPORT bool DefaultXactReadOnly
Definition: xact.c:81
void BeginImplicitTransactionBlock(void)
Definition: xact.c:4338
SubXactEvent
Definition: xact.h:142
@ SUBXACT_EVENT_PRE_COMMIT_SUB
Definition: xact.h:146
@ SUBXACT_EVENT_START_SUB
Definition: xact.h:143
@ SUBXACT_EVENT_ABORT_SUB
Definition: xact.h:145
@ SUBXACT_EVENT_COMMIT_SUB
Definition: xact.h:144
void(* XactCallback)(XactEvent event, void *arg)
Definition: xact.h:139
void RequireTransactionBlock(bool isTopLevel, const char *stmtType)
Definition: xact.c:3728
struct xl_xact_invals xl_xact_invals
void DefineSavepoint(const char *name)
Definition: xact.c:4385
struct xl_xact_origin xl_xact_origin
PGDLLIMPORT bool bsysscan
Definition: xact.c:100
SyncCommitLevel
Definition: xact.h:70
@ SYNCHRONOUS_COMMIT_LOCAL_FLUSH
Definition: xact.h:72
@ SYNCHRONOUS_COMMIT_REMOTE_WRITE
Definition: xact.h:73
@ SYNCHRONOUS_COMMIT_REMOTE_APPLY
Definition: xact.h:76
@ SYNCHRONOUS_COMMIT_REMOTE_FLUSH
Definition: xact.h:75
@ SYNCHRONOUS_COMMIT_OFF
Definition: xact.h:71
XactEvent
Definition: xact.h:128
@ XACT_EVENT_PRE_PREPARE
Definition: xact.h:136
@ XACT_EVENT_COMMIT
Definition: xact.h:129
@ XACT_EVENT_PARALLEL_PRE_COMMIT
Definition: xact.h:135
@ XACT_EVENT_PARALLEL_COMMIT
Definition: xact.h:130
@ XACT_EVENT_ABORT
Definition: xact.h:131
@ XACT_EVENT_PRE_COMMIT
Definition: xact.h:134
@ XACT_EVENT_PARALLEL_ABORT
Definition: xact.h:132
@ XACT_EVENT_PREPARE
Definition: xact.h:133
void UnregisterXactCallback(XactCallback callback, void *arg)
Definition: xact.c:3829
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:3660
Size EstimateTransactionStateSpace(void)
Definition: xact.c:5524
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:5015
void RollbackAndReleaseCurrentSubTransaction(void)
Definition: xact.c:4808
FullTransactionId GetCurrentFullTransactionIdIfAny(void)
Definition: xact.c:530
void StartTransactionCommand(void)
Definition: xact.c:3071
bool IsAbortedTransactionBlockState(void)
Definition: xact.c:407
void ReleaseCurrentSubTransaction(void)
Definition: xact.c:4780
void EndImplicitTransactionBlock(void)
Definition: xact.c:4363
void StartParallelWorkerTransaction(char *tstatespace)
Definition: xact.c:5623
void SetParallelStartTimestamps(TimestampTz xact_ts, TimestampTz stmt_ts)
Definition: xact.c:859
void ReleaseSavepoint(const char *name)
Definition: xact.c:4470
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:5826
void ForceSyncCommit(void)
Definition: xact.c:1152
bool IsSubTransaction(void)
Definition: xact.c:5056
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:4983
bool IsInParallelMode(void)
Definition: xact.c:1089
int xactGetCommittedChildren(TransactionId **ptr)
Definition: xact.c:5802
TransactionId GetCurrentTransactionIdIfAny(void)
Definition: xact.c:471
void BeginTransactionBlock(void)
Definition: xact.c:3936
TimestampTz GetCurrentStatementStartTimestamp(void)
Definition: xact.c:879
TimestampTz GetCurrentTransactionStartTimestamp(void)
Definition: xact.c:870
void EndParallelWorkerTransaction(void)
Definition: xact.c:5648
struct SavedTransactionCharacteristics SavedTransactionCharacteristics
void RegisterXactCallback(XactCallback callback, void *arg)
Definition: xact.c:3816
void CommitTransactionCommand(void)
Definition: xact.c:3169
PGDLLIMPORT int XactIsoLevel
Definition: xact.c:79
void RollbackToSavepoint(const char *name)
Definition: xact.c:4579
struct xl_xact_twophase xl_xact_twophase
bool SubTransactionIsActive(SubTransactionId subxid)
Definition: xact.c:805
void RegisterSubXactCallback(SubXactCallback callback, void *arg)
Definition: xact.c:3876
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:439
bool EndTransactionBlock(bool chain)
Definition: xact.c:4056
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:4874
void AbortCurrentTransaction(void)
Definition: xact.c:3463
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:5998
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