Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
reorderbuffer.h754 linesDownload Raw Back to replication
1/*2 * reorderbuffer.h3 *	  PostgreSQL logical replay/reorder buffer management.4 *5 * Copyright (c) 2012-2023, PostgreSQL Global Development Group6 *7 * src/include/replication/reorderbuffer.h8 */9#ifndef REORDERBUFFER_H10#define REORDERBUFFER_H11 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 20/* GUC variables */21extern PGDLLIMPORT int logical_decoding_work_mem;22extern PGDLLIMPORT int debug_logical_replication_streaming;23 24/* possible values for debug_logical_replication_streaming */25typedef enum26{27	DEBUG_LOGICAL_REP_STREAMING_BUFFERED,28	DEBUG_LOGICAL_REP_STREAMING_IMMEDIATE29}			DebugLogicalRepStreamingMode;30 31/* an individual tuple, stored in one chunk of memory */32typedef struct ReorderBufferTupleBuf33{34	/* position in preallocated list */35	slist_node	node;36 37	/* tuple header, the interesting bit for users of logical decoding */38	HeapTupleData tuple;39 40	/* pre-allocated size of tuple buffer, different from tuple size */41	Size		alloc_tuple_size;42 43	/* actual tuple data follows */44} ReorderBufferTupleBuf;45 46/* pointer to the data stored in a TupleBuf */47#define ReorderBufferTupleBufData(p) \48	((HeapTupleHeader) MAXALIGN(((char *) p) + sizeof(ReorderBufferTupleBuf)))49 50/*51 * Types of the change passed to a 'change' callback.52 *53 * For efficiency and simplicity reasons we want to keep Snapshots, CommandIds54 * and ComboCids in the same list with the user visible INSERT/UPDATE/DELETE55 * changes. Users of the decoding facilities will never see changes with56 * *_INTERNAL_* actions.57 *58 * The INTERNAL_SPEC_INSERT and INTERNAL_SPEC_CONFIRM, and INTERNAL_SPEC_ABORT59 * changes concern "speculative insertions", their confirmation, and abort60 * respectively.  They're used by INSERT .. ON CONFLICT .. UPDATE.  Users of61 * logical decoding don't have to care about these.62 */63typedef enum ReorderBufferChangeType64{65	REORDER_BUFFER_CHANGE_INSERT,66	REORDER_BUFFER_CHANGE_UPDATE,67	REORDER_BUFFER_CHANGE_DELETE,68	REORDER_BUFFER_CHANGE_MESSAGE,69	REORDER_BUFFER_CHANGE_INVALIDATION,70	REORDER_BUFFER_CHANGE_INTERNAL_SNAPSHOT,71	REORDER_BUFFER_CHANGE_INTERNAL_COMMAND_ID,72	REORDER_BUFFER_CHANGE_INTERNAL_TUPLECID,73	REORDER_BUFFER_CHANGE_INTERNAL_SPEC_INSERT,74	REORDER_BUFFER_CHANGE_INTERNAL_SPEC_CONFIRM,75	REORDER_BUFFER_CHANGE_INTERNAL_SPEC_ABORT,76	REORDER_BUFFER_CHANGE_TRUNCATE77} ReorderBufferChangeType;78 79/* forward declaration */80struct ReorderBufferTXN;81 82/*83 * a single 'change', can be an insert (with one tuple), an update (old, new),84 * or a delete (old).85 *86 * The same struct is also used internally for other purposes but that should87 * never be visible outside reorderbuffer.c.88 */89typedef struct ReorderBufferChange90{91	XLogRecPtr	lsn;92 93	/* The type of change. */94	ReorderBufferChangeType action;95 96	/* Transaction this change belongs to. */97	struct ReorderBufferTXN *txn;98 99	RepOriginId origin_id;100 101	/*102	 * Context data for the change. Which part of the union is valid depends103	 * on action.104	 */105	union106	{107		/* Old, new tuples when action == *_INSERT|UPDATE|DELETE */108		struct109		{110			/* relation that has been changed */111			RelFileLocator rlocator;112 113			/* no previously reassembled toast chunks are necessary anymore */114			bool		clear_toast_afterwards;115 116			/* valid for DELETE || UPDATE */117			ReorderBufferTupleBuf *oldtuple;118			/* valid for INSERT || UPDATE */119			ReorderBufferTupleBuf *newtuple;120		}			tp;121 122		/*123		 * Truncate data for REORDER_BUFFER_CHANGE_TRUNCATE representing one124		 * set of relations to be truncated.125		 */126		struct127		{128			Size		nrelids;129			bool		cascade;130			bool		restart_seqs;131			Oid		   *relids;132		}			truncate;133 134		/* Message with arbitrary data. */135		struct136		{137			char	   *prefix;138			Size		message_size;139			char	   *message;140		}			msg;141 142		/* New snapshot, set when action == *_INTERNAL_SNAPSHOT */143		Snapshot	snapshot;144 145		/*146		 * New command id for existing snapshot in a catalog changing tx. Set147		 * when action == *_INTERNAL_COMMAND_ID.148		 */149		CommandId	command_id;150 151		/*152		 * New cid mapping for catalog changing transaction, set when action153		 * == *_INTERNAL_TUPLECID.154		 */155		struct156		{157			RelFileLocator locator;158			ItemPointerData tid;159			CommandId	cmin;160			CommandId	cmax;161			CommandId	combocid;162		}			tuplecid;163 164		/* Invalidation. */165		struct166		{167			uint32		ninvalidations; /* Number of messages */168			SharedInvalidationMessage *invalidations;	/* invalidation message */169		}			inval;170	}			data;171 172	/*173	 * While in use this is how a change is linked into a transactions,174	 * otherwise it's the preallocated list.175	 */176	dlist_node	node;177} ReorderBufferChange;178 179/* ReorderBufferTXN txn_flags */180#define RBTXN_HAS_CATALOG_CHANGES 	0x0001181#define RBTXN_IS_SUBXACT          	0x0002182#define RBTXN_IS_SERIALIZED       	0x0004183#define RBTXN_IS_SERIALIZED_CLEAR 	0x0008184#define RBTXN_IS_STREAMED         	0x0010185#define RBTXN_HAS_PARTIAL_CHANGE  	0x0020186#define RBTXN_PREPARE             	0x0040187#define RBTXN_SKIPPED_PREPARE	  	0x0080188#define RBTXN_HAS_STREAMABLE_CHANGE	0x0100189 190/* Does the transaction have catalog changes? */191#define rbtxn_has_catalog_changes(txn) \192( \193	 ((txn)->txn_flags & RBTXN_HAS_CATALOG_CHANGES) != 0 \194)195 196/* Is the transaction known as a subxact? */197#define rbtxn_is_known_subxact(txn) \198( \199	((txn)->txn_flags & RBTXN_IS_SUBXACT) != 0 \200)201 202/* Has this transaction been spilled to disk? */203#define rbtxn_is_serialized(txn) \204( \205	((txn)->txn_flags & RBTXN_IS_SERIALIZED) != 0 \206)207 208/* Has this transaction ever been spilled to disk? */209#define rbtxn_is_serialized_clear(txn) \210( \211	((txn)->txn_flags & RBTXN_IS_SERIALIZED_CLEAR) != 0 \212)213 214/* Has this transaction contains partial changes? */215#define rbtxn_has_partial_change(txn) \216( \217	((txn)->txn_flags & RBTXN_HAS_PARTIAL_CHANGE) != 0 \218)219 220/* Does this transaction contain streamable changes? */221#define rbtxn_has_streamable_change(txn) \222( \223	((txn)->txn_flags & RBTXN_HAS_STREAMABLE_CHANGE) != 0 \224)225 226/*227 * Has this transaction been streamed to downstream?228 *229 * (It's not possible to deduce this from nentries and nentries_mem for230 * various reasons. For example, all changes may be in subtransactions in231 * which case we'd have nentries==0 for the toplevel one, which would say232 * nothing about the streaming. So we maintain this flag, but only for the233 * toplevel transaction.)234 */235#define rbtxn_is_streamed(txn) \236( \237	((txn)->txn_flags & RBTXN_IS_STREAMED) != 0 \238)239 240/* Has this transaction been prepared? */241#define rbtxn_prepared(txn) \242( \243	((txn)->txn_flags & RBTXN_PREPARE) != 0 \244)245 246/* prepare for this transaction skipped? */247#define rbtxn_skip_prepared(txn) \248( \249	((txn)->txn_flags & RBTXN_SKIPPED_PREPARE) != 0 \250)251 252/* Is this a top-level transaction? */253#define rbtxn_is_toptxn(txn) \254( \255	(txn)->toptxn == NULL \256)257 258/* Is this a subtransaction? */259#define rbtxn_is_subtxn(txn) \260( \261	(txn)->toptxn != NULL \262)263 264/* Get the top-level transaction of this (sub)transaction. */265#define rbtxn_get_toptxn(txn) \266( \267	rbtxn_is_subtxn(txn) ? (txn)->toptxn : (txn) \268)269 270typedef struct ReorderBufferTXN271{272	/* See above */273	bits32		txn_flags;274 275	/* The transaction's transaction id, can be a toplevel or sub xid. */276	TransactionId xid;277 278	/* Xid of top-level transaction, if known */279	TransactionId toplevel_xid;280 281	/*282	 * Global transaction id required for identification of prepared283	 * transactions.284	 */285	char	   *gid;286 287	/*288	 * LSN of the first data carrying, WAL record with knowledge about this289	 * xid. This is allowed to *not* be first record adorned with this xid, if290	 * the previous records aren't relevant for logical decoding.291	 */292	XLogRecPtr	first_lsn;293 294	/* ----295	 * LSN of the record that lead to this xact to be prepared or committed or296	 * aborted. This can be a297	 * * plain commit record298	 * * plain commit record, of a parent transaction299	 * * prepared transaction300	 * * prepared transaction commit301	 * * plain abort record302	 * * prepared transaction abort303	 *304	 * This can also become set to earlier values than transaction end when305	 * a transaction is spilled to disk; specifically it's set to the LSN of306	 * the latest change written to disk so far.307	 * ----308	 */309	XLogRecPtr	final_lsn;310 311	/*312	 * LSN pointing to the end of the commit record + 1.313	 */314	XLogRecPtr	end_lsn;315 316	/* Toplevel transaction for this subxact (NULL for top-level). */317	struct ReorderBufferTXN *toptxn;318 319	/*320	 * LSN of the last lsn at which snapshot information reside, so we can321	 * restart decoding from there and fully recover this transaction from322	 * WAL.323	 */324	XLogRecPtr	restart_decoding_lsn;325 326	/* origin of the change that caused this transaction */327	RepOriginId origin_id;328	XLogRecPtr	origin_lsn;329 330	/*331	 * Commit or Prepare time, only known when we read the actual commit or332	 * prepare record.333	 */334	union335	{336		TimestampTz commit_time;337		TimestampTz prepare_time;338		TimestampTz abort_time;339	}			xact_time;340 341	/*342	 * The base snapshot is used to decode all changes until either this343	 * transaction modifies the catalog, or another catalog-modifying344	 * transaction commits.345	 */346	Snapshot	base_snapshot;347	XLogRecPtr	base_snapshot_lsn;348	dlist_node	base_snapshot_node; /* link in txns_by_base_snapshot_lsn */349 350	/*351	 * Snapshot/CID from the previous streaming run. Only valid for already352	 * streamed transactions (NULL/InvalidCommandId otherwise).353	 */354	Snapshot	snapshot_now;355	CommandId	command_id;356 357	/*358	 * How many ReorderBufferChange's do we have in this txn.359	 *360	 * Changes in subtransactions are *not* included but tracked separately.361	 */362	uint64		nentries;363 364	/*365	 * How many of the above entries are stored in memory in contrast to being366	 * spilled to disk.367	 */368	uint64		nentries_mem;369 370	/*371	 * List of ReorderBufferChange structs, including new Snapshots, new372	 * CommandIds and command invalidation messages.373	 */374	dlist_head	changes;375 376	/*377	 * List of (relation, ctid) => (cmin, cmax) mappings for catalog tuples.378	 * Those are always assigned to the toplevel transaction. (Keep track of379	 * #entries to create a hash of the right size)380	 */381	dlist_head	tuplecids;382	uint64		ntuplecids;383 384	/*385	 * On-demand built hash for looking up the above values.386	 */387	HTAB	   *tuplecid_hash;388 389	/*390	 * Hash containing (potentially partial) toast entries. NULL if no toast391	 * tuples have been found for the current change.392	 */393	HTAB	   *toast_hash;394 395	/*396	 * non-hierarchical list of subtransactions that are *not* aborted. Only397	 * used in toplevel transactions.398	 */399	dlist_head	subtxns;400	uint32		nsubtxns;401 402	/*403	 * Stored cache invalidations. This is not a linked list because we get404	 * all the invalidations at once.405	 */406	uint32		ninvalidations;407	SharedInvalidationMessage *invalidations;408 409	/* ---410	 * Position in one of three lists:411	 * * list of subtransactions if we are *known* to be subxact412	 * * list of toplevel xacts (can be an as-yet unknown subxact)413	 * * list of preallocated ReorderBufferTXNs (if unused)414	 * ---415	 */416	dlist_node	node;417 418	/*419	 * A node in the list of catalog modifying transactions420	 */421	dlist_node	catchange_node;422 423	/*424	 * Size of this transaction (changes currently in memory, in bytes).425	 */426	Size		size;427 428	/* Size of top-transaction including sub-transactions. */429	Size		total_size;430 431	/* If we have detected concurrent abort then ignore future changes. */432	bool		concurrent_abort;433 434	/*435	 * Private data pointer of the output plugin.436	 */437	void	   *output_plugin_private;438} ReorderBufferTXN;439 440/* so we can define the callbacks used inside struct ReorderBuffer itself */441typedef struct ReorderBuffer ReorderBuffer;442 443/* change callback signature */444typedef void (*ReorderBufferApplyChangeCB) (ReorderBuffer *rb,445											ReorderBufferTXN *txn,446											Relation relation,447											ReorderBufferChange *change);448 449/* truncate callback signature */450typedef void (*ReorderBufferApplyTruncateCB) (ReorderBuffer *rb,451											  ReorderBufferTXN *txn,452											  int nrelations,453											  Relation relations[],454											  ReorderBufferChange *change);455 456/* begin callback signature */457typedef void (*ReorderBufferBeginCB) (ReorderBuffer *rb,458									  ReorderBufferTXN *txn);459 460/* commit callback signature */461typedef void (*ReorderBufferCommitCB) (ReorderBuffer *rb,462									   ReorderBufferTXN *txn,463									   XLogRecPtr commit_lsn);464 465/* message callback signature */466typedef void (*ReorderBufferMessageCB) (ReorderBuffer *rb,467										ReorderBufferTXN *txn,468										XLogRecPtr message_lsn,469										bool transactional,470										const char *prefix, Size sz,471										const char *message);472 473/* begin prepare callback signature */474typedef void (*ReorderBufferBeginPrepareCB) (ReorderBuffer *rb,475											 ReorderBufferTXN *txn);476 477/* prepare callback signature */478typedef void (*ReorderBufferPrepareCB) (ReorderBuffer *rb,479										ReorderBufferTXN *txn,480										XLogRecPtr prepare_lsn);481 482/* commit prepared callback signature */483typedef void (*ReorderBufferCommitPreparedCB) (ReorderBuffer *rb,484											   ReorderBufferTXN *txn,485											   XLogRecPtr commit_lsn);486 487/* rollback  prepared callback signature */488typedef void (*ReorderBufferRollbackPreparedCB) (ReorderBuffer *rb,489												 ReorderBufferTXN *txn,490												 XLogRecPtr prepare_end_lsn,491												 TimestampTz prepare_time);492 493/* start streaming transaction callback signature */494typedef void (*ReorderBufferStreamStartCB) (495											ReorderBuffer *rb,496											ReorderBufferTXN *txn,497											XLogRecPtr first_lsn);498 499/* stop streaming transaction callback signature */500typedef void (*ReorderBufferStreamStopCB) (501										   ReorderBuffer *rb,502										   ReorderBufferTXN *txn,503										   XLogRecPtr last_lsn);504 505/* discard streamed transaction callback signature */506typedef void (*ReorderBufferStreamAbortCB) (507											ReorderBuffer *rb,508											ReorderBufferTXN *txn,509											XLogRecPtr abort_lsn);510 511/* prepare streamed transaction callback signature */512typedef void (*ReorderBufferStreamPrepareCB) (513											  ReorderBuffer *rb,514											  ReorderBufferTXN *txn,515											  XLogRecPtr prepare_lsn);516 517/* commit streamed transaction callback signature */518typedef void (*ReorderBufferStreamCommitCB) (519											 ReorderBuffer *rb,520											 ReorderBufferTXN *txn,521											 XLogRecPtr commit_lsn);522 523/* stream change callback signature */524typedef void (*ReorderBufferStreamChangeCB) (525											 ReorderBuffer *rb,526											 ReorderBufferTXN *txn,527											 Relation relation,528											 ReorderBufferChange *change);529 530/* stream message callback signature */531typedef void (*ReorderBufferStreamMessageCB) (532											  ReorderBuffer *rb,533											  ReorderBufferTXN *txn,534											  XLogRecPtr message_lsn,535											  bool transactional,536											  const char *prefix, Size sz,537											  const char *message);538 539/* stream truncate callback signature */540typedef void (*ReorderBufferStreamTruncateCB) (541											   ReorderBuffer *rb,542											   ReorderBufferTXN *txn,543											   int nrelations,544											   Relation relations[],545											   ReorderBufferChange *change);546 547/* update progress txn callback signature */548typedef void (*ReorderBufferUpdateProgressTxnCB) (549												  ReorderBuffer *rb,550												  ReorderBufferTXN *txn,551												  XLogRecPtr lsn);552 553struct ReorderBuffer554{555	/*556	 * xid => ReorderBufferTXN lookup table557	 */558	HTAB	   *by_txn;559 560	/*561	 * Transactions that could be a toplevel xact, ordered by LSN of the first562	 * record bearing that xid.563	 */564	dlist_head	toplevel_by_lsn;565 566	/*567	 * Transactions and subtransactions that have a base snapshot, ordered by568	 * LSN of the record which caused us to first obtain the base snapshot.569	 * This is not the same as toplevel_by_lsn, because we only set the base570	 * snapshot on the first logical-decoding-relevant record (eg. heap571	 * writes), whereas the initial LSN could be set by other operations.572	 */573	dlist_head	txns_by_base_snapshot_lsn;574 575	/*576	 * Transactions and subtransactions that have modified system catalogs.577	 */578	dclist_head catchange_txns;579 580	/*581	 * one-entry sized cache for by_txn. Very frequently the same txn gets582	 * looked up over and over again.583	 */584	TransactionId by_txn_last_xid;585	ReorderBufferTXN *by_txn_last_txn;586 587	/*588	 * Callbacks to be called when a transactions commits.589	 */590	ReorderBufferBeginCB begin;591	ReorderBufferApplyChangeCB apply_change;592	ReorderBufferApplyTruncateCB apply_truncate;593	ReorderBufferCommitCB commit;594	ReorderBufferMessageCB message;595 596	/*597	 * Callbacks to be called when streaming a transaction at prepare time.598	 */599	ReorderBufferBeginCB begin_prepare;600	ReorderBufferPrepareCB prepare;601	ReorderBufferCommitPreparedCB commit_prepared;602	ReorderBufferRollbackPreparedCB rollback_prepared;603 604	/*605	 * Callbacks to be called when streaming a transaction.606	 */607	ReorderBufferStreamStartCB stream_start;608	ReorderBufferStreamStopCB stream_stop;609	ReorderBufferStreamAbortCB stream_abort;610	ReorderBufferStreamPrepareCB stream_prepare;611	ReorderBufferStreamCommitCB stream_commit;612	ReorderBufferStreamChangeCB stream_change;613	ReorderBufferStreamMessageCB stream_message;614	ReorderBufferStreamTruncateCB stream_truncate;615 616	/*617	 * Callback to be called when updating progress during sending data of a618	 * transaction (and its subtransactions) to the output plugin.619	 */620	ReorderBufferUpdateProgressTxnCB update_progress_txn;621 622	/*623	 * Pointer that will be passed untouched to the callbacks.624	 */625	void	   *private_data;626 627	/*628	 * Saved output plugin option629	 */630	bool		output_rewrites;631 632	/*633	 * Private memory context.634	 */635	MemoryContext context;636 637	/*638	 * Memory contexts for specific types objects639	 */640	MemoryContext change_context;641	MemoryContext txn_context;642	MemoryContext tup_context;643 644	XLogRecPtr	current_restart_decoding_lsn;645 646	/* buffer for disk<->memory conversions */647	char	   *outbuf;648	Size		outbufsize;649 650	/* memory accounting */651	Size		size;652 653	/*654	 * Statistics about transactions spilled to disk.655	 *656	 * A single transaction may be spilled repeatedly, which is why we keep657	 * two different counters. For spilling, the transaction counter includes658	 * both toplevel transactions and subtransactions.659	 */660	int64		spillTxns;		/* number of transactions spilled to disk */661	int64		spillCount;		/* spill-to-disk invocation counter */662	int64		spillBytes;		/* amount of data spilled to disk */663 664	/* Statistics about transactions streamed to the decoding output plugin */665	int64		streamTxns;		/* number of transactions streamed */666	int64		streamCount;	/* streaming invocation counter */667	int64		streamBytes;	/* amount of data decoded */668 669	/*670	 * Statistics about all the transactions sent to the decoding output671	 * plugin672	 */673	int64		totalTxns;		/* total number of transactions sent */674	int64		totalBytes;		/* total amount of data decoded */675};676 677 678extern ReorderBuffer *ReorderBufferAllocate(void);679extern void ReorderBufferFree(ReorderBuffer *rb);680 681extern ReorderBufferTupleBuf *ReorderBufferGetTupleBuf(ReorderBuffer *rb,682													   Size tuple_len);683extern void ReorderBufferReturnTupleBuf(ReorderBuffer *rb,684										ReorderBufferTupleBuf *tuple);685extern ReorderBufferChange *ReorderBufferGetChange(ReorderBuffer *rb);686extern void ReorderBufferReturnChange(ReorderBuffer *rb,687									  ReorderBufferChange *change, bool upd_mem);688 689extern Oid *ReorderBufferGetRelids(ReorderBuffer *rb, int nrelids);690extern void ReorderBufferReturnRelids(ReorderBuffer *rb, Oid *relids);691 692extern void ReorderBufferQueueChange(ReorderBuffer *rb, TransactionId xid,693									 XLogRecPtr lsn, ReorderBufferChange *change,694									 bool toast_insert);695extern void ReorderBufferQueueMessage(ReorderBuffer *rb, TransactionId xid,696									  Snapshot snap, XLogRecPtr lsn,697									  bool transactional, const char *prefix,698									  Size message_size, const char *message);699extern void ReorderBufferCommit(ReorderBuffer *rb, TransactionId xid,700								XLogRecPtr commit_lsn, XLogRecPtr end_lsn,701								TimestampTz commit_time, RepOriginId origin_id, XLogRecPtr origin_lsn);702extern void ReorderBufferFinishPrepared(ReorderBuffer *rb, TransactionId xid,703										XLogRecPtr commit_lsn, XLogRecPtr end_lsn,704										XLogRecPtr two_phase_at,705										TimestampTz commit_time,706										RepOriginId origin_id, XLogRecPtr origin_lsn,707										char *gid, bool is_commit);708extern void ReorderBufferAssignChild(ReorderBuffer *rb, TransactionId xid,709									 TransactionId subxid, XLogRecPtr lsn);710extern void ReorderBufferCommitChild(ReorderBuffer *rb, TransactionId xid,711									 TransactionId subxid, XLogRecPtr commit_lsn,712									 XLogRecPtr end_lsn);713extern void ReorderBufferAbort(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn,714							   TimestampTz abort_time);715extern void ReorderBufferAbortOld(ReorderBuffer *rb, TransactionId oldestRunningXid);716extern void ReorderBufferForget(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn);717extern void ReorderBufferInvalidate(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn);718 719extern void ReorderBufferSetBaseSnapshot(ReorderBuffer *rb, TransactionId xid,720										 XLogRecPtr lsn, Snapshot snap);721extern void ReorderBufferAddSnapshot(ReorderBuffer *rb, TransactionId xid,722									 XLogRecPtr lsn, Snapshot snap);723extern void ReorderBufferAddNewCommandId(ReorderBuffer *rb, TransactionId xid,724										 XLogRecPtr lsn, CommandId cid);725extern void ReorderBufferAddNewTupleCids(ReorderBuffer *rb, TransactionId xid,726										 XLogRecPtr lsn, RelFileLocator locator,727										 ItemPointerData tid,728										 CommandId cmin, CommandId cmax, CommandId combocid);729extern void ReorderBufferAddInvalidations(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn,730										  Size nmsgs, SharedInvalidationMessage *msgs);731extern void ReorderBufferImmediateInvalidation(ReorderBuffer *rb, uint32 ninvalidations,732											   SharedInvalidationMessage *invalidations);733extern void ReorderBufferProcessXid(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn);734 735extern void ReorderBufferXidSetCatalogChanges(ReorderBuffer *rb, TransactionId xid, XLogRecPtr lsn);736extern bool ReorderBufferXidHasCatalogChanges(ReorderBuffer *rb, TransactionId xid);737extern bool ReorderBufferXidHasBaseSnapshot(ReorderBuffer *rb, TransactionId xid);738 739extern bool ReorderBufferRememberPrepareInfo(ReorderBuffer *rb, TransactionId xid,740											 XLogRecPtr prepare_lsn, XLogRecPtr end_lsn,741											 TimestampTz prepare_time,742											 RepOriginId origin_id, XLogRecPtr origin_lsn);743extern void ReorderBufferSkipPrepare(ReorderBuffer *rb, TransactionId xid);744extern void ReorderBufferPrepare(ReorderBuffer *rb, TransactionId xid, char *gid);745extern ReorderBufferTXN *ReorderBufferGetOldestTXN(ReorderBuffer *rb);746extern TransactionId ReorderBufferGetOldestXmin(ReorderBuffer *rb);747extern TransactionId *ReorderBufferGetCatalogChangesXacts(ReorderBuffer *rb);748 749extern void ReorderBufferSetRestartPoint(ReorderBuffer *rb, XLogRecPtr ptr);750 751extern void StartupReorderBuffer(void);752 753#endif754 
codekingpro/portable-devtools · Team Ai