2005-04-28 23:47:18 +02:00
|
|
|
/*
|
|
|
|
* multixact.h
|
|
|
|
*
|
|
|
|
* PostgreSQL multi-transaction-log manager
|
|
|
|
*
|
|
|
|
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
|
|
*
|
2005-12-07 00:08:34 +01:00
|
|
|
* $PostgreSQL: pgsql/src/include/access/multixact.h,v 1.8 2005/12/06 23:08:34 tgl Exp $
|
2005-04-28 23:47:18 +02:00
|
|
|
*/
|
|
|
|
#ifndef MULTIXACT_H
|
|
|
|
#define MULTIXACT_H
|
|
|
|
|
2005-06-08 17:50:28 +02:00
|
|
|
#include "access/xlog.h"
|
|
|
|
|
2005-04-28 23:47:18 +02:00
|
|
|
#define InvalidMultiXactId ((MultiXactId) 0)
|
|
|
|
#define FirstMultiXactId ((MultiXactId) 1)
|
|
|
|
|
|
|
|
#define MultiXactIdIsValid(multi) ((multi) != InvalidMultiXactId)
|
|
|
|
|
2005-12-07 00:08:34 +01:00
|
|
|
/* Number of SLRU buffers to use for multixact */
|
|
|
|
#define NUM_MXACTOFFSET_BUFFERS 8
|
|
|
|
#define NUM_MXACTMEMBER_BUFFERS 16
|
|
|
|
|
2005-06-08 17:50:28 +02:00
|
|
|
/* ----------------
|
|
|
|
* multixact-related XLOG entries
|
|
|
|
* ----------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define XLOG_MULTIXACT_ZERO_OFF_PAGE 0x00
|
|
|
|
#define XLOG_MULTIXACT_ZERO_MEM_PAGE 0x10
|
|
|
|
#define XLOG_MULTIXACT_CREATE_ID 0x20
|
|
|
|
|
|
|
|
typedef struct xl_multixact_create
|
|
|
|
{
|
2005-10-15 04:49:52 +02:00
|
|
|
MultiXactId mid; /* new MultiXact's ID */
|
|
|
|
MultiXactOffset moff; /* its starting offset in members file */
|
|
|
|
int32 nxids; /* number of member XIDs */
|
|
|
|
TransactionId xids[1]; /* VARIABLE LENGTH ARRAY */
|
2005-06-08 17:50:28 +02:00
|
|
|
} xl_multixact_create;
|
|
|
|
|
|
|
|
#define MinSizeOfMultiXactCreate offsetof(xl_multixact_create, xids)
|
|
|
|
|
|
|
|
|
2005-05-03 21:42:41 +02:00
|
|
|
extern MultiXactId MultiXactIdCreate(TransactionId xid1, TransactionId xid2);
|
|
|
|
extern MultiXactId MultiXactIdExpand(MultiXactId multi, TransactionId xid);
|
2005-04-28 23:47:18 +02:00
|
|
|
extern bool MultiXactIdIsRunning(MultiXactId multi);
|
2005-05-03 21:42:41 +02:00
|
|
|
extern void MultiXactIdWait(MultiXactId multi);
|
2005-08-01 22:31:16 +02:00
|
|
|
extern bool ConditionalMultiXactIdWait(MultiXactId multi);
|
2005-04-28 23:47:18 +02:00
|
|
|
extern void MultiXactIdSetOldestMember(void);
|
2005-10-15 04:49:52 +02:00
|
|
|
extern int GetMultiXactIdMembers(MultiXactId multi, TransactionId **xids);
|
2005-04-28 23:47:18 +02:00
|
|
|
|
|
|
|
extern void AtEOXact_MultiXact(void);
|
|
|
|
|
2005-08-21 01:26:37 +02:00
|
|
|
extern Size MultiXactShmemSize(void);
|
2005-04-28 23:47:18 +02:00
|
|
|
extern void MultiXactShmemInit(void);
|
|
|
|
extern void BootStrapMultiXact(void);
|
|
|
|
extern void StartupMultiXact(void);
|
|
|
|
extern void ShutdownMultiXact(void);
|
2005-06-08 17:50:28 +02:00
|
|
|
extern void MultiXactGetCheckptMulti(bool is_shutdown,
|
2005-10-15 04:49:52 +02:00
|
|
|
MultiXactId *nextMulti,
|
|
|
|
MultiXactOffset *nextMultiOffset);
|
2005-04-28 23:47:18 +02:00
|
|
|
extern void CheckPointMultiXact(void);
|
2005-06-08 17:50:28 +02:00
|
|
|
extern void MultiXactSetNextMXact(MultiXactId nextMulti,
|
2005-10-15 04:49:52 +02:00
|
|
|
MultiXactOffset nextMultiOffset);
|
2005-06-08 17:50:28 +02:00
|
|
|
extern void MultiXactAdvanceNextMXact(MultiXactId minMulti,
|
2005-10-15 04:49:52 +02:00
|
|
|
MultiXactOffset minMultiOffset);
|
2005-06-08 17:50:28 +02:00
|
|
|
|
|
|
|
extern void multixact_redo(XLogRecPtr lsn, XLogRecord *record);
|
|
|
|
extern void multixact_desc(char *buf, uint8 xl_info, char *rec);
|
2005-04-28 23:47:18 +02:00
|
|
|
|
|
|
|
#endif /* MULTIXACT_H */
|