1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-22 14:32:25 +03:00

heap' xlog records

This commit is contained in:
Vadim B. Mikheev
2000-06-02 10:20:27 +00:00
parent 664dd614d9
commit bf1c8f2b3b
5 changed files with 150 additions and 24 deletions

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: htup.h,v 1.29 2000/04/12 17:16:26 momjian Exp $
* $Id: htup.h,v 1.30 2000/06/02 10:20:26 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,6 +44,8 @@ typedef struct HeapTupleHeaderData
uint8 t_hoff; /* sizeof tuple header */
/* ^ - 31 bytes - ^ */
bits8 t_bits[MinHeapTupleBitmapSize / 8];
/* bit map of domains */
@@ -52,6 +54,71 @@ typedef struct HeapTupleHeaderData
typedef HeapTupleHeaderData *HeapTupleHeader;
#ifdef XLOG
/* XLOG stuff */
/*
* XLOG allows to store some information in high 4 bits of log
* record xl_info field
*/
#define XLOG_HEAP_INSERT 0x00
#define XLOG_HEAP_DELETE 0x10
#define XLOG_HEAP_UPDATE 0x20
#define XLOG_HEAP_MOVE 0x30
/*
* All what we need to find changed tuple (14 bytes)
*/
typedef struct xl_heaptid
{
Oid dbId; /* database */
Oid relId; /* relation */
ItemPointerData tid; /* changed tuple id */
} xl_heaptid;
/* This is what we need to know about delete - ALIGN(14) = 16 bytes */
typedef struct xl_heap_delete
{
xl_heaptid dtid; /* deleted tuple id */
} xl_heap_delete;
/* This is what we need to know about insert - 22 + data */
typedef struct xl_heap_insert
{
xl_heaptid itid; /* inserted tuple id */
/* something from tuple header */
int16 t_natts;
Oid t_oid;
uint8 t_hoff;
uint8 mask; /* low 8 bits of t_infomask */
/* TUPLE DATA FOLLOWS AT END OF STRUCT */
} xl_heap_insert;
/* This is what we need to know about update - 28 + data */
typedef struct xl_heap_update
{
xl_heaptid dtid; /* deleted tuple id */
ItemPointerData itid; /* new inserted tuple id */
/* something from header of new tuple version */
int16 t_natts;
uint8 t_hoff;
uint8 mask; /* low 8 bits of t_infomask */
/* NEW TUPLE DATA FOLLOWS AT END OF STRUCT */
} xl_heap_update;
/* This is what we need to know about tuple move - ALIGN(20) = 24 bytes */
typedef struct xl_heap_move
{
xl_heaptid ftid; /* moved from */
ItemPointerData ttid; /* moved to */
} xl_heap_move;
/* end of XLOG stuff */
#endif /* XLOG */
#define MinTupleSize (MAXALIGN(sizeof (PageHeaderData)) + \
MAXALIGN(sizeof(HeapTupleHeaderData)) + \
MAXALIGN(sizeof(char)))

View File

@@ -47,7 +47,12 @@ typedef struct XLogSubRecord
#define SizeOfXLogSubRecord DOUBLEALIGN(sizeof(XLogSubRecord))
/*
* XLOG uses only low 4 bits of xl_info. High 4 bits may be used
* by rmgr...
*/
#define XLR_TO_BE_CONTINUED 0x01
#define XLR_INFO_MASK 0x0F
#define XLOG_PAGE_MAGIC 0x17345168
@@ -63,8 +68,9 @@ typedef XLogPageHeaderData *XLogPageHeader;
#define XLP_FIRST_IS_SUBRECORD 0x0001
extern XLogRecPtr XLogInsert(RmgrId rmid, char *hdr, uint32 hdrlen,
char *buf, uint32 buflen);
extern XLogRecPtr XLogInsert(RmgrId rmid, uint8 info,
char *hdr, uint32 hdrlen,
char *buf, uint32 buflen);
extern void XLogFlush(XLogRecPtr RecPtr);
#endif /* XLOG_H */