| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | #ifndef MULTIXACT_H |
| | #define MULTIXACT_H |
| |
|
| | #include "access/xlogreader.h" |
| | #include "lib/stringinfo.h" |
| | #include "storage/sync.h" |
| |
|
| |
|
| | |
| | |
| | |
| | |
| | |
| | #define InvalidMultiXactId ((MultiXactId) 0) |
| | #define FirstMultiXactId ((MultiXactId) 1) |
| | #define MaxMultiXactId ((MultiXactId) 0xFFFFFFFF) |
| |
|
| | #define MultiXactIdIsValid(multi) ((multi) != InvalidMultiXactId) |
| |
|
| | #define MaxMultiXactOffset ((MultiXactOffset) 0xFFFFFFFF) |
| |
|
| | |
| | |
| | |
| | |
| | |
| | typedef enum |
| | { |
| | MultiXactStatusForKeyShare = 0x00, |
| | MultiXactStatusForShare = 0x01, |
| | MultiXactStatusForNoKeyUpdate = 0x02, |
| | MultiXactStatusForUpdate = 0x03, |
| | |
| | MultiXactStatusNoKeyUpdate = 0x04, |
| | |
| | MultiXactStatusUpdate = 0x05, |
| | } MultiXactStatus; |
| |
|
| | #define MaxMultiXactStatus MultiXactStatusUpdate |
| |
|
| | |
| | #define ISUPDATE_from_mxstatus(status) \ |
| | ((status) > MultiXactStatusForUpdate) |
| |
|
| |
|
| | typedef struct MultiXactMember |
| | { |
| | TransactionId xid; |
| | MultiXactStatus status; |
| | } MultiXactMember; |
| |
|
| |
|
| | |
| | |
| | |
| | |
| |
|
| | #define XLOG_MULTIXACT_ZERO_OFF_PAGE 0x00 |
| | #define XLOG_MULTIXACT_ZERO_MEM_PAGE 0x10 |
| | #define XLOG_MULTIXACT_CREATE_ID 0x20 |
| | #define XLOG_MULTIXACT_TRUNCATE_ID 0x30 |
| |
|
| | typedef struct xl_multixact_create |
| | { |
| | MultiXactId mid; |
| | MultiXactOffset moff; |
| | int32 nmembers; |
| | MultiXactMember members[FLEXIBLE_ARRAY_MEMBER]; |
| | } xl_multixact_create; |
| |
|
| | #define SizeOfMultiXactCreate (offsetof(xl_multixact_create, members)) |
| |
|
| | typedef struct xl_multixact_truncate |
| | { |
| | Oid oldestMultiDB; |
| |
|
| | |
| | MultiXactId startTruncOff; |
| | MultiXactId endTruncOff; |
| |
|
| | |
| | MultiXactOffset startTruncMemb; |
| | MultiXactOffset endTruncMemb; |
| | } xl_multixact_truncate; |
| |
|
| | #define SizeOfMultiXactTruncate (sizeof(xl_multixact_truncate)) |
| |
|
| |
|
| | extern MultiXactId MultiXactIdCreate(TransactionId xid1, |
| | MultiXactStatus status1, TransactionId xid2, |
| | MultiXactStatus status2); |
| | extern MultiXactId MultiXactIdExpand(MultiXactId multi, TransactionId xid, |
| | MultiXactStatus status); |
| | extern MultiXactId MultiXactIdCreateFromMembers(int nmembers, |
| | MultiXactMember *members); |
| |
|
| | extern MultiXactId ReadNextMultiXactId(void); |
| | extern void ReadMultiXactIdRange(MultiXactId *oldest, MultiXactId *next); |
| | extern bool MultiXactIdIsRunning(MultiXactId multi, bool isLockOnly); |
| | extern void MultiXactIdSetOldestMember(void); |
| | extern int GetMultiXactIdMembers(MultiXactId multi, MultiXactMember **members, |
| | bool from_pgupgrade, bool isLockOnly); |
| | extern bool MultiXactIdPrecedes(MultiXactId multi1, MultiXactId multi2); |
| | extern bool MultiXactIdPrecedesOrEquals(MultiXactId multi1, |
| | MultiXactId multi2); |
| |
|
| | extern int multixactoffsetssyncfiletag(const FileTag *ftag, char *path); |
| | extern int multixactmemberssyncfiletag(const FileTag *ftag, char *path); |
| |
|
| | extern void AtEOXact_MultiXact(void); |
| | extern void AtPrepare_MultiXact(void); |
| | extern void PostPrepare_MultiXact(TransactionId xid); |
| |
|
| | extern Size MultiXactShmemSize(void); |
| | extern void MultiXactShmemInit(void); |
| | extern void BootStrapMultiXact(void); |
| | extern void StartupMultiXact(void); |
| | extern void TrimMultiXact(void); |
| | extern void SetMultiXactIdLimit(MultiXactId oldest_datminmxid, |
| | Oid oldest_datoid, |
| | bool is_startup); |
| | extern void MultiXactGetCheckptMulti(bool is_shutdown, |
| | MultiXactId *nextMulti, |
| | MultiXactOffset *nextMultiOffset, |
| | MultiXactId *oldestMulti, |
| | Oid *oldestMultiDB); |
| | extern void CheckPointMultiXact(void); |
| | extern MultiXactId GetOldestMultiXactId(void); |
| | extern void TruncateMultiXact(MultiXactId newOldestMulti, |
| | Oid newOldestMultiDB); |
| | extern void MultiXactSetNextMXact(MultiXactId nextMulti, |
| | MultiXactOffset nextMultiOffset); |
| | extern void MultiXactAdvanceNextMXact(MultiXactId minMulti, |
| | MultiXactOffset minMultiOffset); |
| | extern void MultiXactAdvanceOldest(MultiXactId oldestMulti, Oid oldestMultiDB); |
| | extern int MultiXactMemberFreezeThreshold(void); |
| |
|
| | extern void multixact_twophase_recover(TransactionId xid, uint16 info, |
| | void *recdata, uint32 len); |
| | extern void multixact_twophase_postcommit(TransactionId xid, uint16 info, |
| | void *recdata, uint32 len); |
| | extern void multixact_twophase_postabort(TransactionId xid, uint16 info, |
| | void *recdata, uint32 len); |
| |
|
| | extern void multixact_redo(XLogReaderState *record); |
| | extern void multixact_desc(StringInfo buf, XLogReaderState *record); |
| | extern const char *multixact_identify(uint8 info); |
| | extern char *mxid_to_string(MultiXactId multi, int nmembers, |
| | MultiXactMember *members); |
| |
|
| | #endif |
| |
|