1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-28 18:48:04 +03:00

Move description of libpqwalreceiver hooks out of the replication's README

src/backend/replication/README includes since 32bc08b a basic
description of the WAL receiver hooks available in walreceiver.h for a
module like libpqwalreceiver, but the README has never been updated to
reflect changes done to the hooks, so the contents of the README have
rotten with the time.  This commit moves the description from the README
to walreceiver.h, where it will be hard to miss that a description
update or addition is needed depending on the modifications done to the
hooks.

Each hook now includes a description of what it does in walreceiver.h,
and the replication's README mentions walreceiver.h.

Thanks also to Amit Kapila for the discussion.

Author: Michael Paquier
Reviewed-by: Peter Eisentraut
Discussion: https://postgr.es/m/20200502024606.GA471944@paquier.xyz
This commit is contained in:
Michael Paquier
2020-07-02 13:57:03 +09:00
parent 4315e8c23b
commit 641dd167a3
2 changed files with 132 additions and 33 deletions

View File

@@ -8,33 +8,8 @@ the primary server, receiving WAL files and sending messages, is loaded
dynamically to avoid having to link the main server binary with libpq.
The dynamically loaded module is in libpqwalreceiver subdirectory.
The dynamically loaded module implements four functions:
bool walrcv_connect(char *conninfo, XLogRecPtr startpoint)
Establish connection to the primary, and starts streaming from 'startpoint'.
Returns true on success.
int walrcv_receive(char **buffer, pgsocket *wait_fd)
Retrieve any message available without blocking through the
connection. If a message was successfully read, returns its
length. If the connection is closed, returns -1. Otherwise returns 0
to indicate that no data is available, and sets *wait_fd to a socket
descriptor which can be waited on before trying again. On success, a
pointer to the message payload is stored in *buffer. The returned
buffer is valid until the next call to walrcv_* functions, and the
caller should not attempt to free it.
void walrcv_send(const char *buffer, int nbytes)
Send a message to XLOG stream.
void walrcv_disconnect(void);
Disconnect.
The dynamically loaded module implements a set of functions with details
about each one of them provided in src/include/replication/walreceiver.h.
This API should be considered internal at the moment, but we could open it
up for 3rd party replacements of libpqwalreceiver in the future, allowing