mirror of
https://github.com/postgres/postgres.git
synced 2025-10-25 13:17:41 +03:00
Introduce Streaming Replication.
This includes two new kinds of postmaster processes, walsenders and walreceiver. Walreceiver is responsible for connecting to the primary server and streaming WAL to disk, while walsender runs in the primary server and streams WAL from disk to the client. Documentation still needs work, but the basics are there. We will probably pull the replication section to a new chapter later on, as well as the sections describing file-based replication. But let's do that as a separate patch, so that it's easier to see what has been added/changed. This patch also adds a new section to the chapter about FE/BE protocol, documenting the protocol used by walsender/walreceivxer. Bump catalog version because of two new functions, pg_last_xlog_receive_location() and pg_last_xlog_replay_location(), for monitoring the progress of replication. Fujii Masao, with additional hacking by me
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.27 2010/01/02 16:58:01 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/access/xlog_internal.h,v 1.28 2010/01/15 09:19:06 heikki Exp $
|
||||
*/
|
||||
#ifndef XLOG_INTERNAL_H
|
||||
#define XLOG_INTERNAL_H
|
||||
@@ -151,6 +151,19 @@ typedef XLogLongPageHeaderData *XLogLongPageHeader;
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Align a record pointer to next page */
|
||||
#define NextLogPage(recptr) \
|
||||
do { \
|
||||
if (recptr.xrecoff % XLOG_BLCKSZ != 0) \
|
||||
recptr.xrecoff += \
|
||||
(XLOG_BLCKSZ - recptr.xrecoff % XLOG_BLCKSZ); \
|
||||
if (recptr.xrecoff >= XLogFileSize) \
|
||||
{ \
|
||||
(recptr.xlogid)++; \
|
||||
recptr.xrecoff = 0; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* Compute ID and segment from an XLogRecPtr.
|
||||
*
|
||||
@@ -253,6 +266,8 @@ 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_last_xlog_receive_location(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_last_xlog_replay_location(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_xlogfile_name_offset(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_xlogfile_name(PG_FUNCTION_ARGS);
|
||||
extern Datum pg_is_in_recovery(PG_FUNCTION_ARGS);
|
||||
|
||||
Reference in New Issue
Block a user