Expose PQbackendPID() through walreceiver API
This will be used by a subsequent patch. Reviewed-by: Masahiko Sawada <masahiko.sawada@2ndquadrant.com> Discussion: https://www.postgresql.org/message-id/CA%2Bfd4k4dM0iEPLxyVyme2RAFsn8SUgrNtBJOu81YqTY4V%2BnqZA%40mail.gmail.com
This commit is contained in:
parent
f595117e24
commit
ee4ac46c8e
@ -74,6 +74,7 @@ static char *libpqrcv_create_slot(WalReceiverConn *conn,
|
||||
bool temporary,
|
||||
CRSSnapshotAction snapshot_action,
|
||||
XLogRecPtr *lsn);
|
||||
static pid_t libpqrcv_get_backend_pid(WalReceiverConn *conn);
|
||||
static WalRcvExecResult *libpqrcv_exec(WalReceiverConn *conn,
|
||||
const char *query,
|
||||
const int nRetTypes,
|
||||
@ -93,6 +94,7 @@ static WalReceiverFunctionsType PQWalReceiverFunctions = {
|
||||
libpqrcv_receive,
|
||||
libpqrcv_send,
|
||||
libpqrcv_create_slot,
|
||||
libpqrcv_get_backend_pid,
|
||||
libpqrcv_exec,
|
||||
libpqrcv_disconnect
|
||||
};
|
||||
@ -858,6 +860,15 @@ libpqrcv_create_slot(WalReceiverConn *conn, const char *slotname,
|
||||
return snapshot;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return PID of remote backend process.
|
||||
*/
|
||||
static pid_t
|
||||
libpqrcv_get_backend_pid(WalReceiverConn *conn)
|
||||
{
|
||||
return PQbackendPID(conn->streamConn);
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert tuple query result to tuplestore.
|
||||
*/
|
||||
|
@ -226,6 +226,7 @@ typedef char *(*walrcv_create_slot_fn) (WalReceiverConn *conn,
|
||||
const char *slotname, bool temporary,
|
||||
CRSSnapshotAction snapshot_action,
|
||||
XLogRecPtr *lsn);
|
||||
typedef pid_t (*walrcv_get_backend_pid_fn) (WalReceiverConn *conn);
|
||||
typedef WalRcvExecResult *(*walrcv_exec_fn) (WalReceiverConn *conn,
|
||||
const char *query,
|
||||
const int nRetTypes,
|
||||
@ -246,6 +247,7 @@ typedef struct WalReceiverFunctionsType
|
||||
walrcv_receive_fn walrcv_receive;
|
||||
walrcv_send_fn walrcv_send;
|
||||
walrcv_create_slot_fn walrcv_create_slot;
|
||||
walrcv_get_backend_pid_fn walrcv_get_backend_pid;
|
||||
walrcv_exec_fn walrcv_exec;
|
||||
walrcv_disconnect_fn walrcv_disconnect;
|
||||
} WalReceiverFunctionsType;
|
||||
@ -276,6 +278,8 @@ extern PGDLLIMPORT WalReceiverFunctionsType *WalReceiverFunctions;
|
||||
WalReceiverFunctions->walrcv_send(conn, buffer, nbytes)
|
||||
#define walrcv_create_slot(conn, slotname, temporary, snapshot_action, lsn) \
|
||||
WalReceiverFunctions->walrcv_create_slot(conn, slotname, temporary, snapshot_action, lsn)
|
||||
#define walrcv_get_backend_pid(conn) \
|
||||
WalReceiverFunctions->walrcv_get_backend_pid(conn)
|
||||
#define walrcv_exec(conn, exec, nRetTypes, retTypes) \
|
||||
WalReceiverFunctions->walrcv_exec(conn, exec, nRetTypes, retTypes)
|
||||
#define walrcv_disconnect(conn) \
|
||||
|
Loading…
x
Reference in New Issue
Block a user