1 /*-------------------------------------------------------------------------
4 * Exports from replication/logical/snapbuild.c.
6 * Copyright (c) 2012-2015, PostgreSQL Global Development Group
8 * src/include/replication/snapbuild.h
10 *-------------------------------------------------------------------------
15 #include "access/xlogdefs.h"
16 #include "utils/snapmgr.h"
21 * Initial state, we can't do much yet.
26 * We have collected enough information to decode tuples in transactions
27 * that started after this.
29 * Once we reached this we start to collect changes. We cannot apply them
30 * yet because the might be based on transactions that were still running
31 * when we reached them yet.
33 SNAPBUILD_FULL_SNAPSHOT,
36 * Found a point after hitting built_full_snapshot where all transactions
37 * that were running at that point finished. Till we reach that we hold
38 * off calling any commit callbacks.
43 /* forward declare so we don't have to expose the struct to the public */
45 typedef struct SnapBuild SnapBuild;
47 /* forward declare so we don't have to include reorderbuffer.h */
50 /* forward declare so we don't have to include heapam_xlog.h */
51 struct xl_heap_new_cid;
52 struct xl_running_xacts;
54 extern void CheckPointSnapBuild(void);
56 extern SnapBuild *AllocateSnapshotBuilder(struct ReorderBuffer *cache,
57 TransactionId xmin_horizon, XLogRecPtr start_lsn);
58 extern void FreeSnapshotBuilder(SnapBuild *cache);
60 extern void SnapBuildSnapDecRefcount(Snapshot snap);
62 extern const char *SnapBuildExportSnapshot(SnapBuild *snapstate);
63 extern void SnapBuildClearExportedSnapshot(void);
65 extern SnapBuildState SnapBuildCurrentState(SnapBuild *snapstate);
67 extern bool SnapBuildXactNeedsSkip(SnapBuild *snapstate, XLogRecPtr ptr);
69 extern void SnapBuildCommitTxn(SnapBuild *builder, XLogRecPtr lsn,
70 TransactionId xid, int nsubxacts,
71 TransactionId *subxacts);
72 extern void SnapBuildAbortTxn(SnapBuild *builder, XLogRecPtr lsn,
73 TransactionId xid, int nsubxacts,
74 TransactionId *subxacts);
75 extern bool SnapBuildProcessChange(SnapBuild *builder, TransactionId xid,
77 extern void SnapBuildProcessNewCid(SnapBuild *builder, TransactionId xid,
78 XLogRecPtr lsn, struct xl_heap_new_cid *cid);
79 extern void SnapBuildProcessRunningXacts(SnapBuild *builder, XLogRecPtr lsn,
80 struct xl_running_xacts *running);
81 extern void SnapBuildSerializationPoint(SnapBuild *builder, XLogRecPtr lsn);
83 #endif /* SNAPBUILD_H */