mirror of
https://github.com/postgres/postgres.git
synced 2025-10-24 01:29:19 +03:00
Arrange to recycle old XLOG log segment files as new segment files,
rather than deleting them only to have to create more. Steady state is 2*CHECKPOINT_SEGMENTS + WAL_FILES + 1 segment files, which will simply be renamed rather than constantly deleted and recreated. To make this safe, added current XLOG file/offset number to page header of XLOG pages, so that an un-overwritten page from an old incarnation of a logfile can be reliably told from a valid page. This change means that if you try to restart postmaster in a CVS-tip database after installing the change, you'll get a complaint about bad XLOG page magic number. If you don't want to initdb, run contrib/pg_resetxlog (and be sure you shut down the old postmaster cleanly).
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: xlog.h,v 1.23 2001/03/22 04:00:32 momjian Exp $
|
||||
* $Id: xlog.h,v 1.24 2001/07/19 02:12:35 tgl Exp $
|
||||
*/
|
||||
#ifndef XLOG_H
|
||||
#define XLOG_H
|
||||
@@ -109,13 +109,14 @@ typedef struct XLogContRecord
|
||||
/*
|
||||
* Each page of XLOG file has a header like this:
|
||||
*/
|
||||
#define XLOG_PAGE_MAGIC 0xD058 /* can be used as WAL version indicator */
|
||||
#define XLOG_PAGE_MAGIC 0xD059 /* can be used as WAL version indicator */
|
||||
|
||||
typedef struct XLogPageHeaderData
|
||||
{
|
||||
uint16 xlp_magic; /* magic value for correctness checks */
|
||||
uint16 xlp_info; /* flag bits, see below */
|
||||
StartUpID xlp_sui; /* StartUpID of first record on page */
|
||||
XLogRecPtr xlp_pageaddr; /* XLOG address of this page */
|
||||
} XLogPageHeaderData;
|
||||
|
||||
#define SizeOfXLogPHD MAXALIGN(sizeof(XLogPageHeaderData))
|
||||
|
||||
Reference in New Issue
Block a user