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

Commitfcb9960

Browse files
committed
Replication README updates.
Fujii Masao
1 parent74a09d9 commitfcb9960

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

‎src/backend/replication/README

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,18 @@ Walreceiver - libpqwalreceiver API
44
----------------------------------
55

66
The transport-specific part of walreceiver, responsible for connecting to
7-
the primary server andreceiving WAL files, is loaded dynamically to avoid
8-
having to link the main server binary with libpq. The dynamically loaded
9-
module is in libpqwalreceiver subdirectory.
7+
the primary server,receiving WAL files and sending messages, is loaded
8+
dynamically to avoidhaving to link the main server binary with libpq.
9+
The dynamically loadedmodule is in libpqwalreceiver subdirectory.
1010

11-
The dynamically loaded module implementsthree functions:
11+
The dynamically loaded module implementsfour functions:
1212

1313

1414
bool walrcv_connect(char *conninfo, XLogRecPtr startpoint)
1515

1616
Establish connection to the primary, and starts streaming from 'startpoint'.
1717
Returns true on success.
1818

19-
2019
bool walrcv_receive(int timeout, unsigned char *type, char **buffer, int *len)
2120

2221
Retrieve any message available through the connection, blocking for
@@ -26,6 +25,10 @@ otherwise false. On success, a pointer to the message payload is stored in
2625
returned buffer is valid until the next call to walrcv_* functions, the
2726
caller should not attempt freeing it.
2827

28+
void walrcv_send(const char *buffer, int nbytes)
29+
30+
Send a message to XLOG stream.
31+
2932
void walrcv_disconnect(void);
3033

3134
Disconnect.
@@ -45,11 +48,15 @@ to fetch more WAL (if streaming replication is configured).
4548
Walreceiver is a postmaster subprocess, so the startup process can't fork it
4649
directly. Instead, it sends a signal to postmaster, asking postmaster to launch
4750
it. Before that, however, startup process fills in WalRcvData->conninfo,
48-
and initializes the starting point in WalRcvData->receivedUpto.
51+
and initializes the starting point in WalRcvData->receiveStart.
4952

5053
As walreceiver receives WAL from the master server, and writes and flushes
51-
it to disk (in pg_xlog), it updates WalRcvData->receivedUpto. Startup process
52-
polls that to know how far it can proceed with WAL replay.
54+
it to disk (in pg_xlog), it updates WalRcvData->receivedUpto and signals
55+
the startup process to know how far WAL replay can advance.
56+
57+
Walreceiver sends information about replication progress to the master server
58+
whenever either it writes or flushes new WAL, or the specified interval elapses.
59+
This is used for reporting purpose.
5360

5461
Walsender IPC
5562
-------------
@@ -80,11 +87,9 @@ phase. A walsenders will look like a regular backends until it's done with the
8087
initialization and has marked itself in PMSignal array, and at process
8188
termination, after unmarking the PMSignal slot.
8289

83-
Each walsender allocates an entry from the WalSndCtl array, and advertises
84-
there how far it has streamed WAL already. This is used at checkpoints, to
85-
avoid recycling WAL that hasn't been streamed to a slave yet. However,
86-
that doesn't stop such WAL from being recycled when the connection is not
87-
established.
90+
Each walsender allocates an entry from the WalSndCtl array, and tracks
91+
information about replication progress. User can monitor them via
92+
statistics views.
8893

8994

9095
Walsender - walreceiver protocol

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp