mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-08 10:17:26 +08:00
Implement archive_timeout feature to force xlog file switches to occur no more
than N seconds apart. This allows a simple, if not very high performance, means of guaranteeing that a PITR archive is no more than N seconds behind real time. Also make pg_current_xlog_location return the WAL Write pointer, add pg_current_xlog_insert_location to return the Insert pointer, and fix pg_xlogfile_name_offset to return its results as a two-element record instead of a smashed-together string, as per recent discussion. Simon Riggs
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.72 2006/07/13 16:49:19 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/xlog.h,v 1.73 2006/08/17 23:04:08 tgl Exp $
|
||||
*/
|
||||
#ifndef XLOG_H
|
||||
#define XLOG_H
|
||||
@ -139,6 +139,7 @@ extern XLogRecPtr ProcLastRecEnd;
|
||||
extern int CheckPointSegments;
|
||||
extern int XLOGbuffers;
|
||||
extern char *XLogArchiveCommand;
|
||||
extern int XLogArchiveTimeout;
|
||||
extern char *XLOG_sync_method;
|
||||
extern const char XLOG_sync_method_default[];
|
||||
|
||||
|
||||
@ -11,11 +11,13 @@
|
||||
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.15 2006/08/07 16:57:57 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.16 2006/08/17 23:04:08 tgl Exp $
|
||||
*/
|
||||
#ifndef XLOG_INTERNAL_H
|
||||
#define XLOG_INTERNAL_H
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "access/xlog.h"
|
||||
#include "fmgr.h"
|
||||
#include "storage/block.h"
|
||||
@ -237,6 +239,12 @@ typedef struct RmgrData
|
||||
|
||||
extern const RmgrData RmgrTable[];
|
||||
|
||||
/*
|
||||
* Exported to support xlog switching from bgwriter
|
||||
*/
|
||||
extern time_t GetLastSegSwitchTime(void);
|
||||
extern XLogRecPtr RequestXLogSwitch(void);
|
||||
|
||||
/*
|
||||
* These aren't in xlog.h because I'd rather not include fmgr.h there.
|
||||
*/
|
||||
@ -244,6 +252,7 @@ extern Datum pg_start_backup(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_stop_backup(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_switch_xlog(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_current_xlog_location(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_current_xlog_insert_location(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_xlogfile_name_offset(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_xlogfile_name(PG_FUNCTION_ARGS);
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.349 2006/08/12 02:52:06 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/catalog/catversion.h,v 1.350 2006/08/17 23:04:08 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -53,6 +53,6 @@
|
||||
*/
|
||||
|
||||
/* yyyymmddN */
|
||||
#define CATALOG_VERSION_NO 200608101
|
||||
#define CATALOG_VERSION_NO 200608171
|
||||
|
||||
#endif
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.420 2006/08/06 03:53:44 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/include/catalog/pg_proc.h,v 1.421 2006/08/17 23:04:10 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* The script catalog/genbki.sh reads this file and generates .bki
|
||||
@ -3104,8 +3104,10 @@ DESCR("Finish taking an online backup");
|
||||
DATA(insert OID = 2848 ( pg_switch_xlog PGNSP PGUID 12 f f t f v 0 25 "" _null_ _null_ _null_ pg_switch_xlog - _null_ ));
|
||||
DESCR("Switch to new xlog file");
|
||||
DATA(insert OID = 2849 ( pg_current_xlog_location PGNSP PGUID 12 f f t f v 0 25 "" _null_ _null_ _null_ pg_current_xlog_location - _null_ ));
|
||||
DESCR("current xlog location");
|
||||
DATA(insert OID = 2850 ( pg_xlogfile_name_offset PGNSP PGUID 12 f f t f i 1 25 "25" _null_ _null_ _null_ pg_xlogfile_name_offset - _null_ ));
|
||||
DESCR("current xlog write location");
|
||||
DATA(insert OID = 2852 ( pg_current_xlog_insert_location PGNSP PGUID 12 f f t f v 0 25 "" _null_ _null_ _null_ pg_current_xlog_insert_location - _null_ ));
|
||||
DESCR("current xlog insert location");
|
||||
DATA(insert OID = 2850 ( pg_xlogfile_name_offset PGNSP PGUID 12 f f t f i 1 2249 "25" "{25,25,23}" "{i,o,o}" "{wal_location,file_name,file_offset}" pg_xlogfile_name_offset - _null_ ));
|
||||
DESCR("xlog filename and byte offset, given an xlog location");
|
||||
DATA(insert OID = 2851 ( pg_xlogfile_name PGNSP PGUID 12 f f t f i 1 25 "25" _null_ _null_ _null_ pg_xlogfile_name - _null_ ));
|
||||
DESCR("xlog filename, given an xlog location");
|
||||
|
||||
Reference in New Issue
Block a user