mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-10 05:17:31 +08:00
WAL
This commit is contained in:
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: transam.h,v 1.24 2000/01/26 05:57:51 momjian Exp $
|
||||
* $Id: transam.h,v 1.25 2000/10/28 16:20:59 vadim Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Transaction System Version 101 now support proper oid
|
||||
@ -67,7 +67,11 @@ typedef unsigned char XidStatus;/* (2 bits) */
|
||||
* transaction page definitions
|
||||
* ----------------
|
||||
*/
|
||||
#ifdef XLOG
|
||||
#define TP_DataSize (BLCKSZ - sizeof(XLogRecPtr))
|
||||
#else
|
||||
#define TP_DataSize BLCKSZ
|
||||
#endif
|
||||
#define TP_NumXidStatusPerBlock (TP_DataSize * 4)
|
||||
|
||||
/* ----------------
|
||||
@ -84,6 +88,10 @@ typedef unsigned char XidStatus;/* (2 bits) */
|
||||
*/
|
||||
typedef struct LogRelationContentsData
|
||||
{
|
||||
#ifdef XLOG
|
||||
XLogRecPtr LSN; /* temp hack: LSN is member of any block */
|
||||
/* so should be described in bufmgr */
|
||||
#endif
|
||||
int TransSystemVersion;
|
||||
} LogRelationContentsData;
|
||||
|
||||
@ -107,6 +115,9 @@ typedef LogRelationContentsData *LogRelationContents;
|
||||
*/
|
||||
typedef struct VariableRelationContentsData
|
||||
{
|
||||
#ifdef XLOG
|
||||
XLogRecPtr LSN;
|
||||
#endif
|
||||
int TransSystemVersion;
|
||||
TransactionId nextXidData;
|
||||
TransactionId lastXidData; /* unused */
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: xact.h,v 1.28 2000/10/20 11:01:14 vadim Exp $
|
||||
* $Id: xact.h,v 1.29 2000/10/28 16:20:59 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -135,6 +135,8 @@ extern bool IsTransactionBlock(void);
|
||||
extern void UserAbortTransactionBlock(void);
|
||||
extern void AbortOutOfAnyTransaction(void);
|
||||
|
||||
extern void RecordTransactionCommit(void);
|
||||
|
||||
extern TransactionId DisabledTransactionId;
|
||||
|
||||
extern void XactPushRollback(void (*func) (void *), void* data);
|
||||
|
||||
@ -10,12 +10,7 @@
|
||||
|
||||
#include "access/rmgr.h"
|
||||
#include "access/transam.h"
|
||||
|
||||
typedef struct XLogRecPtr
|
||||
{
|
||||
uint32 xlogid; /* log file #, 0 based */
|
||||
uint32 xrecoff; /* offset of record in log file */
|
||||
} XLogRecPtr;
|
||||
#include "access/xlogdefs.h"
|
||||
|
||||
typedef struct XLogRecord
|
||||
{
|
||||
@ -83,12 +78,7 @@ typedef XLogPageHeaderData *XLogPageHeader;
|
||||
#define XLByteEQ(left, right) \
|
||||
(right.xlogid == left.xlogid && right.xrecoff == left.xrecoff)
|
||||
|
||||
/*
|
||||
* StartUpID (SUI) - system startups counter.
|
||||
* It's to allow removing pg_log after shutdown.
|
||||
*/
|
||||
typedef uint32 StartUpID;
|
||||
extern StartUpID ThisStartUpID;
|
||||
extern StartUpID ThisStartUpID; /* current SUI */
|
||||
extern bool InRecovery;
|
||||
extern XLogRecPtr MyLastRecPtr;
|
||||
|
||||
|
||||
24
src/include/access/xlogdefs.h
Normal file
24
src/include/access/xlogdefs.h
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
*
|
||||
* xlogdefs.h
|
||||
*
|
||||
* Postgres transaction log manager record pointer and
|
||||
* system stratup number definitions
|
||||
*
|
||||
*/
|
||||
#ifndef XLOG_DEFS_H
|
||||
#define XLOG_DEFS_H
|
||||
|
||||
typedef struct XLogRecPtr
|
||||
{
|
||||
uint32 xlogid; /* log file #, 0 based */
|
||||
uint32 xrecoff; /* offset of record in log file */
|
||||
} XLogRecPtr;
|
||||
|
||||
/*
|
||||
* StartUpID (SUI) - system startups counter. It's to allow removing
|
||||
* pg_log after shutdown, in future.
|
||||
*/
|
||||
typedef uint32 StartUpID;
|
||||
|
||||
#endif /* XLOG_DEFS_H */
|
||||
@ -9,8 +9,10 @@ extern bool XLogIsValidTuple(RelFileNode hnode, ItemPointer iptr);
|
||||
|
||||
extern void XLogOpenLogRelation(void);
|
||||
|
||||
extern Buffer XLogReadBuffer(bool extend, Relation reln, BlockNumber blkno);
|
||||
extern void XLogInitRelationCache(void);
|
||||
extern void XLogCloseRelationCache(void);
|
||||
|
||||
extern Relation XLogOpenRelation(bool redo, RmgrId rmid, RelFileNode rnode);
|
||||
extern Buffer XLogReadBuffer(bool extend, Relation reln, BlockNumber blkno);
|
||||
|
||||
#endif
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: buf_internals.h,v 1.41 2000/10/23 04:10:14 vadim Exp $
|
||||
* $Id: buf_internals.h,v 1.42 2000/10/28 16:21:00 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -109,6 +109,10 @@ typedef struct sbufdesc
|
||||
bool ri_lock; /* read-intent lock */
|
||||
bool w_lock; /* context exclusively locked */
|
||||
|
||||
#ifdef XLOG
|
||||
bool cntxDirty; /* new way to mark block as dirty */
|
||||
#endif
|
||||
|
||||
BufferBlindId blind; /* was used to support blind write */
|
||||
|
||||
/*
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: bufmgr.h,v 1.41 2000/10/20 11:01:21 vadim Exp $
|
||||
* $Id: bufmgr.h,v 1.42 2000/10/28 16:21:00 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -15,7 +15,7 @@
|
||||
#define BUFMGR_H
|
||||
|
||||
#include "storage/buf_internals.h"
|
||||
|
||||
#include "access/xlogdefs.h"
|
||||
|
||||
typedef void *Block;
|
||||
|
||||
@ -177,4 +177,9 @@ extern void AbortBufferIO(void);
|
||||
extern bool BufferIsUpdatable(Buffer buffer);
|
||||
extern void MarkBufferForCleanup(Buffer buffer, void (*CleanupFunc)(Buffer));
|
||||
|
||||
#ifdef XLOG
|
||||
extern void BufmgrCommit(void);
|
||||
extern void BufferSync(void);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: bufpage.h,v 1.34 2000/10/21 15:43:36 vadim Exp $
|
||||
* $Id: bufpage.h,v 1.35 2000/10/28 16:21:00 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -118,7 +118,8 @@ typedef OpaqueData *Opaque;
|
||||
*/
|
||||
typedef struct PageHeaderData
|
||||
{
|
||||
#ifdef XLOG
|
||||
#ifdef XLOG /* XXX LSN is member of *any* block, not */
|
||||
/* only page-organized - 'll change later */
|
||||
XLogRecPtr pd_lsn; /* LSN: next byte after last byte of xlog */
|
||||
/* record for last change of this page */
|
||||
StartUpID pd_sui; /* SUI of last changes (currently it's */
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: smgr.h,v 1.22 2000/10/16 14:52:28 vadim Exp $
|
||||
* $Id: smgr.h,v 1.23 2000/10/28 16:21:00 vadim Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -36,26 +36,19 @@ extern int smgrwrite(int16 which, Relation reln, BlockNumber blocknum,
|
||||
char *buffer);
|
||||
extern int smgrflush(int16 which, Relation reln, BlockNumber blocknum,
|
||||
char *buffer);
|
||||
#ifdef OLD_FILE_NAMING
|
||||
extern int smgrblindwrt(int16 which, char *dbname, char *relname,
|
||||
Oid dbid, Oid relid,
|
||||
BlockNumber blkno, char *buffer,
|
||||
bool dofsync);
|
||||
extern int smgrblindmarkdirty(int16 which, char *dbname, char *relname,
|
||||
Oid dbid, Oid relid,
|
||||
BlockNumber blkno);
|
||||
#else
|
||||
extern int smgrblindwrt(int16 which, RelFileNode rnode,
|
||||
BlockNumber blkno, char *buffer, bool dofsync);
|
||||
extern int smgrblindmarkdirty(int16 which, RelFileNode rnode,
|
||||
BlockNumber blkno);
|
||||
#endif
|
||||
extern int smgrmarkdirty(int16 which, Relation reln, BlockNumber blkno);
|
||||
extern int smgrnblocks(int16 which, Relation reln);
|
||||
extern int smgrtruncate(int16 which, Relation reln, int nblocks);
|
||||
extern int smgrcommit(void);
|
||||
extern int smgrabort(void);
|
||||
|
||||
#ifdef XLOG
|
||||
extern int smgrsync(void);
|
||||
#endif
|
||||
|
||||
|
||||
/* internals: move me elsewhere -- ay 7/94 */
|
||||
@ -71,22 +64,18 @@ extern int mdread(Relation reln, BlockNumber blocknum, char *buffer);
|
||||
extern int mdwrite(Relation reln, BlockNumber blocknum, char *buffer);
|
||||
extern int mdflush(Relation reln, BlockNumber blocknum, char *buffer);
|
||||
extern int mdmarkdirty(Relation reln, BlockNumber blkno);
|
||||
#ifdef OLD_FILE_NAMING
|
||||
extern int mdblindwrt(char *dbname, char *relname, Oid dbid, Oid relid,
|
||||
BlockNumber blkno, char *buffer,
|
||||
bool dofsync);
|
||||
extern int mdblindmarkdirty(char *dbname, char *relname, Oid dbid, Oid relid,
|
||||
BlockNumber blkno);
|
||||
#else
|
||||
extern int mdblindwrt(RelFileNode rnode, BlockNumber blkno,
|
||||
char *buffer, bool dofsync);
|
||||
extern int mdblindmarkdirty(RelFileNode rnode, BlockNumber blkno);
|
||||
#endif
|
||||
extern int mdnblocks(Relation reln);
|
||||
extern int mdtruncate(Relation reln, int nblocks);
|
||||
extern int mdcommit(void);
|
||||
extern int mdabort(void);
|
||||
|
||||
#ifdef XLOG
|
||||
extern int mdsync(void);
|
||||
#endif
|
||||
|
||||
/* mm.c */
|
||||
extern SPINLOCK MMCacheLock;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user