PostgreSQL Source Code  git master
reorderbuffer.h
Go to the documentation of this file.
1 /*
2  * reorderbuffer.h
3  * PostgreSQL logical replay/reorder buffer management.
4  *
5  * Copyright (c) 2012-2021, PostgreSQL Global Development Group
6  *
7  * src/include/replication/reorderbuffer.h
8  */
9 #ifndef REORDERBUFFER_H
10 #define REORDERBUFFER_H
11 
12 #include "access/htup_details.h"
13 #include "lib/ilist.h"
14 #include "storage/sinval.h"
15 #include "utils/hsearch.h"
16 #include "utils/relcache.h"
17 #include "utils/snapshot.h"
18 #include "utils/timestamp.h"
19 
21 
22 /* an individual tuple, stored in one chunk of memory */
23 typedef struct ReorderBufferTupleBuf
24 {
25  /* position in preallocated list */
27 
28  /* tuple header, the interesting bit for users of logical decoding */
30 
31  /* pre-allocated size of tuple buffer, different from tuple size */
33 
34  /* actual tuple data follows */
36 
37 /* pointer to the data stored in a TupleBuf */
38 #define ReorderBufferTupleBufData(p) \
39  ((HeapTupleHeader) MAXALIGN(((char *) p) + sizeof(ReorderBufferTupleBuf)))
40 
41 /*
42  * Types of the change passed to a 'change' callback.
43  *
44  * For efficiency and simplicity reasons we want to keep Snapshots, CommandIds
45  * and ComboCids in the same list with the user visible INSERT/UPDATE/DELETE
46  * changes. Users of the decoding facilities will never see changes with
47  * *_INTERNAL_* actions.
48  *
49  * The INTERNAL_SPEC_INSERT and INTERNAL_SPEC_CONFIRM changes concern
50  * "speculative insertions", and their confirmation respectively. They're
51  * used by INSERT .. ON CONFLICT .. UPDATE. Users of logical decoding don't
52  * have to care about these.
53  */
55 {
67 };
68 
69 /* forward declaration */
70 struct ReorderBufferTXN;
71 
72 /*
73  * a single 'change', can be an insert (with one tuple), an update (old, new),
74  * or a delete (old).
75  *
76  * The same struct is also used internally for other purposes but that should
77  * never be visible outside reorderbuffer.c.
78  */
79 typedef struct ReorderBufferChange
80 {
82 
83  /* The type of change. */
85 
86  /* Transaction this change belongs to. */
88 
90 
91  /*
92  * Context data for the change. Which part of the union is valid depends
93  * on action.
94  */
95  union
96  {
97  /* Old, new tuples when action == *_INSERT|UPDATE|DELETE */
98  struct
99  {
100  /* relation that has been changed */
102 
103  /* no previously reassembled toast chunks are necessary anymore */
105 
106  /* valid for DELETE || UPDATE */
108  /* valid for INSERT || UPDATE */
110  } tp;
111 
112  /*
113  * Truncate data for REORDER_BUFFER_CHANGE_TRUNCATE representing one
114  * set of relations to be truncated.
115  */
116  struct
117  {
119  bool cascade;
122  } truncate;
123 
124  /* Message with arbitrary data. */
125  struct
126  {
127  char *prefix;
129  char *message;
130  } msg;
131 
132  /* New snapshot, set when action == *_INTERNAL_SNAPSHOT */
134 
135  /*
136  * New command id for existing snapshot in a catalog changing tx. Set
137  * when action == *_INTERNAL_COMMAND_ID.
138  */
140 
141  /*
142  * New cid mapping for catalog changing transaction, set when action
143  * == *_INTERNAL_TUPLECID.
144  */
145  struct
146  {
152  } tuplecid;
153 
154  /* Invalidation. */
155  struct
156  {
157  uint32 ninvalidations; /* Number of messages */
158  SharedInvalidationMessage *invalidations; /* invalidation message */
159  } inval;
160  } data;
161 
162  /*
163  * While in use this is how a change is linked into a transactions,
164  * otherwise it's the preallocated list.
165  */
168 
169 /* ReorderBufferTXN txn_flags */
170 #define RBTXN_HAS_CATALOG_CHANGES 0x0001
171 #define RBTXN_IS_SUBXACT 0x0002
172 #define RBTXN_IS_SERIALIZED 0x0004
173 #define RBTXN_IS_SERIALIZED_CLEAR 0x0008
174 #define RBTXN_IS_STREAMED 0x0010
175 #define RBTXN_HAS_TOAST_INSERT 0x0020
176 #define RBTXN_HAS_SPEC_INSERT 0x0040
177 #define RBTXN_PREPARE 0x0080
178 #define RBTXN_SKIPPED_PREPARE 0x0100
179 
180 /* Does the transaction have catalog changes? */
181 #define rbtxn_has_catalog_changes(txn) \
182 ( \
183  ((txn)->txn_flags & RBTXN_HAS_CATALOG_CHANGES) != 0 \
184 )
185 
186 /* Is the transaction known as a subxact? */
187 #define rbtxn_is_known_subxact(txn) \
188 ( \
189  ((txn)->txn_flags & RBTXN_IS_SUBXACT) != 0 \
190 )
191 
192 /* Has this transaction been spilled to disk? */
193 #define rbtxn_is_serialized(txn) \
194 ( \
195  ((txn)->txn_flags & RBTXN_IS_SERIALIZED) != 0 \
196 )
197 
198 /* Has this transaction ever been spilled to disk? */
199 #define rbtxn_is_serialized_clear(txn) \
200 ( \
201  ((txn)->txn_flags & RBTXN_IS_SERIALIZED_CLEAR) != 0 \
202 )
203 
204 /* This transaction's changes has toast insert, without main table insert. */
205 #define rbtxn_has_toast_insert(txn) \
206 ( \
207  ((txn)->txn_flags & RBTXN_HAS_TOAST_INSERT) != 0 \
208 )
209 /*
210  * This transaction's changes has speculative insert, without speculative
211  * confirm.
212  */
213 #define rbtxn_has_spec_insert(txn) \
214 ( \
215  ((txn)->txn_flags & RBTXN_HAS_SPEC_INSERT) != 0 \
216 )
217 
218 /* Check whether this transaction has an incomplete change. */
219 #define rbtxn_has_incomplete_tuple(txn) \
220 ( \
221  rbtxn_has_toast_insert(txn) || rbtxn_has_spec_insert(txn) \
222 )
223 
224 /*
225  * Has this transaction been streamed to downstream?
226  *
227  * (It's not possible to deduce this from nentries and nentries_mem for
228  * various reasons. For example, all changes may be in subtransactions in
229  * which case we'd have nentries==0 for the toplevel one, which would say
230  * nothing about the streaming. So we maintain this flag, but only for the
231  * toplevel transaction.)
232  */
233 #define rbtxn_is_streamed(txn) \
234 ( \
235  ((txn)->txn_flags & RBTXN_IS_STREAMED) != 0 \
236 )
237 
238 /* Has this transaction been prepared? */
239 #define rbtxn_prepared(txn) \
240 ( \
241  ((txn)->txn_flags & RBTXN_PREPARE) != 0 \
242 )
243 
244 /* prepare for this transaction skipped? */
245 #define rbtxn_skip_prepared(txn) \
246 ( \
247  ((txn)->txn_flags & RBTXN_SKIPPED_PREPARE) != 0 \
248 )
249 
250 typedef struct ReorderBufferTXN
251 {
252  /* See above */
254 
255  /* The transaction's transaction id, can be a toplevel or sub xid. */
257 
258  /* Xid of top-level transaction, if known */
260 
261  /*
262  * Global transaction id required for identification of prepared
263  * transactions.
264  */
265  char *gid;
266 
267  /*
268  * LSN of the first data carrying, WAL record with knowledge about this
269  * xid. This is allowed to *not* be first record adorned with this xid, if
270  * the previous records aren't relevant for logical decoding.
271  */
273 
274  /* ----
275  * LSN of the record that lead to this xact to be prepared or committed or
276  * aborted. This can be a
277  * * plain commit record
278  * * plain commit record, of a parent transaction
279  * * prepared tansaction
280  * * prepared transaction commit
281  * * plain abort record
282  * * prepared transaction abort
283  *
284  * This can also become set to earlier values than transaction end when
285  * a transaction is spilled to disk; specifically it's set to the LSN of
286  * the latest change written to disk so far.
287  * ----
288  */
290 
291  /*
292  * LSN pointing to the end of the commit record + 1.
293  */
295 
296  /* Toplevel transaction for this subxact (NULL for top-level). */
298 
299  /*
300  * LSN of the last lsn at which snapshot information reside, so we can
301  * restart decoding from there and fully recover this transaction from
302  * WAL.
303  */
305 
306  /* origin of the change that caused this transaction */
309 
310  /*
311  * Commit or Prepare time, only known when we read the actual commit or
312  * prepare record.
313  */
315 
316  /*
317  * The base snapshot is used to decode all changes until either this
318  * transaction modifies the catalog, or another catalog-modifying
319  * transaction commits.
320  */
323  dlist_node base_snapshot_node; /* link in txns_by_base_snapshot_lsn */
324 
325  /*
326  * Snapshot/CID from the previous streaming run. Only valid for already
327  * streamed transactions (NULL/InvalidCommandId otherwise).
328  */
331 
332  /*
333  * How many ReorderBufferChange's do we have in this txn.
334  *
335  * Changes in subtransactions are *not* included but tracked separately.
336  */
337  uint64 nentries;
338 
339  /*
340  * How many of the above entries are stored in memory in contrast to being
341  * spilled to disk.
342  */
343  uint64 nentries_mem;
344 
345  /*
346  * List of ReorderBufferChange structs, including new Snapshots, new
347  * CommandIds and command invalidation messages.
348  */
350 
351  /*
352  * List of (relation, ctid) => (cmin, cmax) mappings for catalog tuples.
353  * Those are always assigned to the toplevel transaction. (Keep track of
354  * #entries to create a hash of the right size)
355  */
357  uint64 ntuplecids;
358 
359  /*
360  * On-demand built hash for looking up the above values.
361  */
363 
364  /*
365  * Hash containing (potentially partial) toast entries. NULL if no toast
366  * tuples have been found for the current change.
367  */
369 
370  /*
371  * non-hierarchical list of subtransactions that are *not* aborted. Only
372  * used in toplevel transactions.
373  */
376 
377  /*
378  * Stored cache invalidations. This is not a linked list because we get
379  * all the invalidations at once.
380  */
383 
384  /* ---
385  * Position in one of three lists:
386  * * list of subtransactions if we are *known* to be subxact
387  * * list of toplevel xacts (can be an as-yet unknown subxact)
388  * * list of preallocated ReorderBufferTXNs (if unused)
389  * ---
390  */
392 
393  /*
394  * Size of this transaction (changes currently in memory, in bytes).
395  */
397 
398  /* Size of top-transaction including sub-transactions. */
400 
401  /* If we have detected concurrent abort then ignore future changes. */
403 
404  /*
405  * Private data pointer of the output plugin.
406  */
409 
410 /* so we can define the callbacks used inside struct ReorderBuffer itself */
412 
413 /* change callback signature */
415  ReorderBufferTXN *txn,
416  Relation relation,
417  ReorderBufferChange *change);
418 
419 /* truncate callback signature */
421  ReorderBufferTXN *txn,
422  int nrelations,
423  Relation relations[],
424  ReorderBufferChange *change);
425 
426 /* begin callback signature */
427 typedef void (*ReorderBufferBeginCB) (ReorderBuffer *rb,
428  ReorderBufferTXN *txn);
429 
430 /* commit callback signature */
432  ReorderBufferTXN *txn,
433  XLogRecPtr commit_lsn);
434 
435 /* message callback signature */
437  ReorderBufferTXN *txn,
438  XLogRecPtr message_lsn,
439  bool transactional,
440  const char *prefix, Size sz,
441  const char *message);
442 
443 /* begin prepare callback signature */
445  ReorderBufferTXN *txn);
446 
447 /* prepare callback signature */
449  ReorderBufferTXN *txn,
450  XLogRecPtr prepare_lsn);
451 
452 /* commit prepared callback signature */
454  ReorderBufferTXN *txn,
455  XLogRecPtr commit_lsn);
456 
457 /* rollback prepared callback signature */
459  ReorderBufferTXN *txn,
460  XLogRecPtr prepare_end_lsn,
461  TimestampTz prepare_time);
462 
463 /* start streaming transaction callback signature */
464 typedef void (*ReorderBufferStreamStartCB) (
465  ReorderBuffer *rb,
466  ReorderBufferTXN *txn,
467  XLogRecPtr first_lsn);
468 
469 /* stop streaming transaction callback signature */
470 typedef void (*ReorderBufferStreamStopCB) (
471  ReorderBuffer *rb,
472  ReorderBufferTXN *txn,
473  XLogRecPtr last_lsn);
474 
475 /* discard streamed transaction callback signature */
476 typedef void (*ReorderBufferStreamAbortCB) (
477  ReorderBuffer *rb,
478  ReorderBufferTXN *txn,
479  XLogRecPtr abort_lsn);
480 
481 /* prepare streamed transaction callback signature */
483  ReorderBuffer *rb,
484  ReorderBufferTXN *txn,
485  XLogRecPtr prepare_lsn);
486 
487 /* commit streamed transaction callback signature */
489  ReorderBuffer *rb,
490  ReorderBufferTXN *txn,
491  XLogRecPtr commit_lsn);
492 
493 /* stream change callback signature */
495  ReorderBuffer *rb,
496  ReorderBufferTXN *txn,
497  Relation relation,
498  ReorderBufferChange *change);
499 
500 /* stream message callback signature */
502  ReorderBuffer *rb,
503  ReorderBufferTXN *txn,
504  XLogRecPtr message_lsn,
505  bool transactional,
506  const char *prefix, Size sz,
507  const char *message);
508 
509 /* stream truncate callback signature */
511  ReorderBuffer *rb,
512  ReorderBufferTXN *txn,
513  int nrelations,
514  Relation relations[],
515  ReorderBufferChange *change);
516 
518 {
519  /*
520  * xid => ReorderBufferTXN lookup table
521  */
523 
524  /*
525  * Transactions that could be a toplevel xact, ordered by LSN of the first
526  * record bearing that xid.
527  */
529 
530  /*
531  * Transactions and subtransactions that have a base snapshot, ordered by
532  * LSN of the record which caused us to first obtain the base snapshot.
533  * This is not the same as toplevel_by_lsn, because we only set the base
534  * snapshot on the first logical-decoding-relevant record (eg. heap
535  * writes), whereas the initial LSN could be set by other operations.
536  */
538 
539  /*
540  * one-entry sized cache for by_txn. Very frequently the same txn gets
541  * looked up over and over again.
542  */
545 
546  /*
547  * Callbacks to be called when a transactions commits.
548  */
554 
555  /*
556  * Callbacks to be called when streaming a transaction at prepare time.
557  */
562 
563  /*
564  * Callbacks to be called when streaming a transaction.
565  */
574 
575  /*
576  * Pointer that will be passed untouched to the callbacks.
577  */
579 
580  /*
581  * Saved output plugin option
582  */
584 
585  /*
586  * Private memory context.
587  */
589 
590  /*
591  * Memory contexts for specific types objects
592  */
596 
598 
599  /* buffer for disk<->memory conversions */
600  char *outbuf;
602 
603  /* memory accounting */
605 
606  /*
607  * Statistics about transactions spilled to disk.
608  *
609  * A single transaction may be spilled repeatedly, which is why we keep
610  * two different counters. For spilling, the transaction counter includes
611  * both toplevel transactions and subtransactions.
612  */
613  int64 spillTxns; /* number of transactions spilled to disk */
614  int64 spillCount; /* spill-to-disk invocation counter */
615  int64 spillBytes; /* amount of data spilled to disk */
616 
617  /* Statistics about transactions streamed to the decoding output plugin */
618  int64 streamTxns; /* number of transactions streamed */
619  int64 streamCount; /* streaming invocation counter */
620  int64 streamBytes; /* amount of data streamed */
621 };
622 
623 
626 
631 
632 Oid *ReorderBufferGetRelids(ReorderBuffer *, int nrelids);
634 
637  bool toast_insert);
639  bool transactional, const char *prefix,
640  Size message_size, const char *message);
642  XLogRecPtr commit_lsn, XLogRecPtr end_lsn,
643  TimestampTz commit_time, RepOriginId origin_id, XLogRecPtr origin_lsn);
645  XLogRecPtr commit_lsn, XLogRecPtr end_lsn,
646  XLogRecPtr initial_consistent_point,
647  TimestampTz commit_time,
648  RepOriginId origin_id, XLogRecPtr origin_lsn,
649  char *gid, bool is_commit);
652  XLogRecPtr commit_lsn, XLogRecPtr end_lsn);
657 
661  CommandId cid);
664  CommandId cmin, CommandId cmax, CommandId combocid);
666  Size nmsgs, SharedInvalidationMessage *msgs);
668  SharedInvalidationMessage *invalidations);
670 
674 
676  XLogRecPtr prepare_lsn, XLogRecPtr end_lsn,
677  TimestampTz prepare_time,
678  RepOriginId origin_id, XLogRecPtr origin_lsn);
680 void ReorderBufferPrepare(ReorderBuffer *rb, TransactionId xid, char *gid);
683 
685 
686 void StartupReorderBuffer(void);
687 
688 #endif
void(* ReorderBufferStreamTruncateCB)(ReorderBuffer *rb, ReorderBufferTXN *txn, int nrelations, Relation relations[], ReorderBufferChange *change)
ReorderBuffer * ReorderBufferAllocate(void)
XLogRecPtr first_lsn
uint32 CommandId
Definition: c.h:601
bool ReorderBufferRememberPrepareInfo(ReorderBuffer *rb, TransactionId xid, XLogRecPtr prepare_lsn, XLogRecPtr end_lsn, TimestampTz prepare_time, RepOriginId origin_id, XLogRecPtr origin_lsn)
SharedInvalidationMessage * invalidations
TimestampTz commit_time
ReorderBufferTupleBuf * ReorderBufferGetTupleBuf(ReorderBuffer *, Size tuple_len)
void ReorderBufferFinishPrepared(ReorderBuffer *rb, TransactionId xid, XLogRecPtr commit_lsn, XLogRecPtr end_lsn, XLogRecPtr initial_consistent_point, TimestampTz commit_time, RepOriginId origin_id, XLogRecPtr origin_lsn, char *gid, bool is_commit)
void ReorderBufferCommit(ReorderBuffer *, TransactionId, XLogRecPtr commit_lsn, XLogRecPtr end_lsn, TimestampTz commit_time, RepOriginId origin_id, XLogRecPtr origin_lsn)
Snapshot base_snapshot
bool ReorderBufferXidHasCatalogChanges(ReorderBuffer *, TransactionId xid)
void ReorderBufferQueueMessage(ReorderBuffer *, TransactionId, Snapshot snapshot, XLogRecPtr lsn, bool transactional, const char *prefix, Size message_size, const char *message)
ReorderBufferApplyChangeCB apply_change
void * private_data
dlist_node base_snapshot_node
RepOriginId origin_id
ReorderBufferTupleBuf * oldtuple
void(* ReorderBufferStreamMessageCB)(ReorderBuffer *rb, ReorderBufferTXN *txn, XLogRecPtr message_lsn, bool transactional, const char *prefix, Size sz, const char *message)
void ReorderBufferProcessXid(ReorderBuffer *, TransactionId xid, XLogRecPtr lsn)
uint32 TransactionId
Definition: c.h:587
bool ReorderBufferXidHasBaseSnapshot(ReorderBuffer *, TransactionId xid)
void ReorderBufferAssignChild(ReorderBuffer *, TransactionId, TransactionId, XLogRecPtr commit_lsn)
void(* ReorderBufferCommitPreparedCB)(ReorderBuffer *rb, ReorderBufferTXN *txn, XLogRecPtr commit_lsn)
TransactionId by_txn_last_xid
void ReorderBufferAddSnapshot(ReorderBuffer *, TransactionId, XLogRecPtr lsn, struct SnapshotData *snap)
int64 TimestampTz
Definition: timestamp.h:39
ReorderBufferStreamAbortCB stream_abort
XLogRecPtr current_restart_decoding_lsn
void(* ReorderBufferStreamAbortCB)(ReorderBuffer *rb, ReorderBufferTXN *txn, XLogRecPtr abort_lsn)
void(* ReorderBufferBeginCB)(ReorderBuffer *rb, ReorderBufferTXN *txn)
struct ReorderBufferTXN * txn
Definition: reorderbuffer.h:87
void(* ReorderBufferStreamChangeCB)(ReorderBuffer *rb, ReorderBufferTXN *txn, Relation relation, ReorderBufferChange *change)
PGDLLIMPORT int logical_decoding_work_mem
void StartupReorderBuffer(void)
uint16 RepOriginId
Definition: xlogdefs.h:65
CommandId command_id
Snapshot snapshot_now
void ReorderBufferSkipPrepare(ReorderBuffer *rb, TransactionId xid)
void ReorderBufferForget(ReorderBuffer *, TransactionId, XLogRecPtr lsn)
ReorderBufferCommitCB commit
unsigned int Oid
Definition: postgres_ext.h:31
XLogRecPtr base_snapshot_lsn
ReorderBufferStreamCommitCB stream_commit
Oid * ReorderBufferGetRelids(ReorderBuffer *, int nrelids)
MemoryContext change_context
void ReorderBufferAddInvalidations(ReorderBuffer *, TransactionId, XLogRecPtr lsn, Size nmsgs, SharedInvalidationMessage *msgs)
XLogRecPtr origin_lsn
#define PGDLLIMPORT
Definition: c.h:1317
void(* ReorderBufferPrepareCB)(ReorderBuffer *rb, ReorderBufferTXN *txn, XLogRecPtr prepare_lsn)
void ReorderBufferCommitChild(ReorderBuffer *, TransactionId, TransactionId, XLogRecPtr commit_lsn, XLogRecPtr end_lsn)
void ReorderBufferReturnTupleBuf(ReorderBuffer *, ReorderBufferTupleBuf *tuple)
ReorderBufferChange * ReorderBufferGetChange(ReorderBuffer *)
Definition: dynahash.c:219
ReorderBufferStreamMessageCB stream_message
ReorderBufferChangeType
Definition: reorderbuffer.h:54
void(* ReorderBufferStreamCommitCB)(ReorderBuffer *rb, ReorderBufferTXN *txn, XLogRecPtr commit_lsn)
ReorderBufferTupleBuf * newtuple
dlist_head changes
dlist_head txns_by_base_snapshot_lsn
ReorderBufferStreamPrepareCB stream_prepare
void ReorderBufferInvalidate(ReorderBuffer *, TransactionId, XLogRecPtr lsn)
void ReorderBufferSetBaseSnapshot(ReorderBuffer *, TransactionId, XLogRecPtr lsn, struct SnapshotData *snap)
void ReorderBufferSetRestartPoint(ReorderBuffer *, XLogRecPtr ptr)
HeapTupleData tuple
Definition: reorderbuffer.h:29
unsigned int uint32
Definition: c.h:441
XLogRecPtr final_lsn
ReorderBufferBeginCB begin_prepare
struct ReorderBufferTXN * toptxn
ItemPointerData tid
ReorderBufferMessageCB message
void ReorderBufferReturnRelids(ReorderBuffer *, Oid *relids)
ReorderBufferStreamChangeCB stream_change
void(* ReorderBufferCommitCB)(ReorderBuffer *rb, ReorderBufferTXN *txn, XLogRecPtr commit_lsn)
TransactionId ReorderBufferGetOldestXmin(ReorderBuffer *rb)
void ReorderBufferXidSetCatalogChanges(ReorderBuffer *, TransactionId xid, XLogRecPtr lsn)
void(* ReorderBufferApplyChangeCB)(ReorderBuffer *rb, ReorderBufferTXN *txn, Relation relation, ReorderBufferChange *change)
RepOriginId origin_id
Definition: reorderbuffer.h:89
ReorderBufferStreamTruncateCB stream_truncate
void ReorderBufferAddNewTupleCids(ReorderBuffer *, TransactionId, XLogRecPtr lsn, RelFileNode node, ItemPointerData pt, CommandId cmin, CommandId cmax, CommandId combocid)
MemoryContext context
void(* ReorderBufferStreamStopCB)(ReorderBuffer *rb, ReorderBufferTXN *txn, XLogRecPtr last_lsn)
void ReorderBufferFree(ReorderBuffer *)
ReorderBufferTXN * by_txn_last_txn
void ReorderBufferAbort(ReorderBuffer *, TransactionId, XLogRecPtr lsn)
dlist_head toplevel_by_lsn
TransactionId xid
ReorderBufferStreamStartCB stream_start
ReorderBufferTXN * ReorderBufferGetOldestTXN(ReorderBuffer *)
void ReorderBufferAddNewCommandId(ReorderBuffer *, TransactionId, XLogRecPtr lsn, CommandId cid)
void(* ReorderBufferStreamPrepareCB)(ReorderBuffer *rb, ReorderBufferTXN *txn, XLogRecPtr prepare_lsn)
uint32 bits32
Definition: c.h:450
uint64 XLogRecPtr
Definition: xlogdefs.h:21
void(* ReorderBufferBeginPrepareCB)(ReorderBuffer *rb, ReorderBufferTXN *txn)
struct ReorderBufferTupleBuf ReorderBufferTupleBuf
XLogRecPtr end_lsn
ReorderBufferRollbackPreparedCB rollback_prepared
void ReorderBufferAbortOld(ReorderBuffer *, TransactionId xid)
void(* ReorderBufferMessageCB)(ReorderBuffer *rb, ReorderBufferTXN *txn, XLogRecPtr message_lsn, bool transactional, const char *prefix, Size sz, const char *message)
size_t Size
Definition: c.h:540
SharedInvalidationMessage * invalidations
void(* ReorderBufferRollbackPreparedCB)(ReorderBuffer *rb, ReorderBufferTXN *txn, XLogRecPtr prepare_end_lsn, TimestampTz prepare_time)
dlist_head subtxns
void ReorderBufferImmediateInvalidation(ReorderBuffer *, uint32 ninvalidations, SharedInvalidationMessage *invalidations)
void(* ReorderBufferApplyTruncateCB)(ReorderBuffer *rb, ReorderBufferTXN *txn, int nrelations, Relation relations[], ReorderBufferChange *change)
void(* ReorderBufferStreamStartCB)(ReorderBuffer *rb, ReorderBufferTXN *txn, XLogRecPtr first_lsn)
ReorderBufferApplyTruncateCB apply_truncate
void ReorderBufferQueueChange(ReorderBuffer *, TransactionId, XLogRecPtr lsn, ReorderBufferChange *, bool toast_insert)
void ReorderBufferReturnChange(ReorderBuffer *, ReorderBufferChange *, bool)
XLogRecPtr restart_decoding_lsn
MemoryContext tup_context
void ReorderBufferPrepare(ReorderBuffer *rb, TransactionId xid, char *gid)
ReorderBufferBeginCB begin
ReorderBufferCommitPreparedCB commit_prepared
void * output_plugin_private
TransactionId toplevel_xid
MemoryContext txn_context
dlist_head tuplecids
ReorderBufferPrepareCB prepare
struct ReorderBufferTXN ReorderBufferTXN
struct ReorderBufferChange ReorderBufferChange
ReorderBufferStreamStopCB stream_stop