1999-09-27 17:48:12 +02:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* xlog.h
|
|
|
|
*
|
|
|
|
* Postgres transaction log manager
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#ifndef XLOG_H
|
|
|
|
#define XLOG_H
|
|
|
|
|
|
|
|
#include "access/rmgr.h"
|
|
|
|
#include "access/transam.h"
|
|
|
|
|
|
|
|
typedef struct XLogRecPtr
|
|
|
|
{
|
2000-04-12 19:17:23 +02:00
|
|
|
uint32 xlogid; /* log file #, 0 based */
|
|
|
|
uint32 xrecoff; /* offset of record in log file */
|
1999-09-27 17:48:12 +02:00
|
|
|
} XLogRecPtr;
|
|
|
|
|
|
|
|
typedef struct XLogRecord
|
|
|
|
{
|
2000-04-12 19:17:23 +02:00
|
|
|
XLogRecPtr xl_prev; /* ptr to previous record in log */
|
|
|
|
XLogRecPtr xl_xact_prev; /* ptr to previous record of this xact */
|
|
|
|
TransactionId xl_xid; /* xact id */
|
|
|
|
uint16 xl_len; /* len of record on this page */
|
|
|
|
uint8 xl_info;
|
|
|
|
RmgrId xl_rmid; /* resource manager inserted this record */
|
1999-09-27 17:48:12 +02:00
|
|
|
|
|
|
|
/* ACTUAL LOG DATA FOLLOWS AT END OF STRUCT */
|
|
|
|
|
|
|
|
} XLogRecord;
|
|
|
|
|
2000-04-12 19:17:23 +02:00
|
|
|
#define SizeOfXLogRecord DOUBLEALIGN(sizeof(XLogRecord))
|
|
|
|
#define MAXLOGRECSZ (2 * BLCKSZ)
|
1999-09-27 17:48:12 +02:00
|
|
|
/*
|
|
|
|
* When there is no space on current page we continue on the next
|
|
|
|
* page with subrecord.
|
|
|
|
*/
|
|
|
|
typedef struct XLogSubRecord
|
|
|
|
{
|
2000-04-12 19:17:23 +02:00
|
|
|
uint16 xl_len;
|
|
|
|
uint8 xl_info;
|
1999-09-27 17:48:12 +02:00
|
|
|
|
|
|
|
/* ACTUAL LOG DATA FOLLOWS AT END OF STRUCT */
|
|
|
|
|
|
|
|
} XLogSubRecord;
|
|
|
|
|
2000-04-12 19:17:23 +02:00
|
|
|
#define SizeOfXLogSubRecord DOUBLEALIGN(sizeof(XLogSubRecord))
|
1999-09-27 17:48:12 +02:00
|
|
|
|
2000-04-12 19:17:23 +02:00
|
|
|
#define XLR_TO_BE_CONTINUED 0x01
|
1999-09-27 17:48:12 +02:00
|
|
|
|
2000-04-12 19:17:23 +02:00
|
|
|
#define XLOG_PAGE_MAGIC 0x17345168
|
1999-09-27 17:48:12 +02:00
|
|
|
|
|
|
|
typedef struct XLogPageHeaderData
|
|
|
|
{
|
|
|
|
uint32 xlp_magic;
|
|
|
|
uint16 xlp_info;
|
|
|
|
} XLogPageHeaderData;
|
|
|
|
|
2000-04-12 19:17:23 +02:00
|
|
|
#define SizeOfXLogPHD DOUBLEALIGN(sizeof(XLogPageHeaderData))
|
1999-09-27 17:48:12 +02:00
|
|
|
|
|
|
|
typedef XLogPageHeaderData *XLogPageHeader;
|
|
|
|
|
2000-04-12 19:17:23 +02:00
|
|
|
#define XLP_FIRST_IS_SUBRECORD 0x0001
|
1999-09-27 17:48:12 +02:00
|
|
|
|
2000-04-12 19:17:23 +02:00
|
|
|
extern XLogRecPtr XLogInsert(RmgrId rmid, char *hdr, uint32 hdrlen,
|
|
|
|
char *buf, uint32 buflen);
|
|
|
|
extern void XLogFlush(XLogRecPtr RecPtr);
|
1999-09-27 17:48:12 +02:00
|
|
|
|
2000-04-12 19:17:23 +02:00
|
|
|
#endif /* XLOG_H */
|