Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7d4d5c0

Browse files
committed
Arrange to recycle old XLOG log segment files as new segment files,
rather than deleting them only to have to create more. Steady stateis 2*CHECKPOINT_SEGMENTS + WAL_FILES + 1 segment files, which willsimply be renamed rather than constantly deleted and recreated.To make this safe, added current XLOG file/offset number to pageheader of XLOG pages, so that an un-overwritten page from an oldincarnation of a logfile can be reliably told from a valid page.This change means that if you try to restart postmaster in a CVS-tipdatabase after installing the change, you'll get a complaint aboutbad XLOG page magic number. If you don't want to initdb, runcontrib/pg_resetxlog (and be sure you shut down the old postmastercleanly).
1 parent8b77efd commit7d4d5c0

File tree

3 files changed

+198
-73
lines changed

3 files changed

+198
-73
lines changed

‎contrib/pg_resetxlog/pg_resetxlog.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
2424
* Portions Copyright (c) 1994, Regents of the University of California
2525
*
26-
* $Header: /cvsroot/pgsql/contrib/pg_resetxlog/Attic/pg_resetxlog.c,v 1.5 2001/06/06 17:07:38 tgl Exp $
26+
* $Header: /cvsroot/pgsql/contrib/pg_resetxlog/Attic/pg_resetxlog.c,v 1.6 2001/07/19 02:12:34 tgl Exp $
2727
*
2828
*-------------------------------------------------------------------------
2929
*/
@@ -857,6 +857,10 @@ WriteEmptyXLOG(void)
857857
page->xlp_magic=XLOG_PAGE_MAGIC;
858858
page->xlp_info=0;
859859
page->xlp_sui=ControlFile.checkPointCopy.ThisStartUpID;
860+
page->xlp_pageaddr.xlogid=
861+
ControlFile.checkPointCopy.redo.xlogid;
862+
page->xlp_pageaddr.xrecoff=
863+
ControlFile.checkPointCopy.redo.xrecoff-SizeOfXLogPHD;
860864
record= (XLogRecord*) ((char*)page+SizeOfXLogPHD);
861865
record->xl_prev.xlogid=0;
862866
record->xl_prev.xrecoff=0;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp