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

Commitee4ac46

Browse files
committed
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
1 parentf595117 commitee4ac46

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

‎src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ static char *libpqrcv_create_slot(WalReceiverConn *conn,
7474
booltemporary,
7575
CRSSnapshotActionsnapshot_action,
7676
XLogRecPtr*lsn);
77+
staticpid_tlibpqrcv_get_backend_pid(WalReceiverConn*conn);
7778
staticWalRcvExecResult*libpqrcv_exec(WalReceiverConn*conn,
7879
constchar*query,
7980
constintnRetTypes,
@@ -93,6 +94,7 @@ static WalReceiverFunctionsType PQWalReceiverFunctions = {
9394
libpqrcv_receive,
9495
libpqrcv_send,
9596
libpqrcv_create_slot,
97+
libpqrcv_get_backend_pid,
9698
libpqrcv_exec,
9799
libpqrcv_disconnect
98100
};
@@ -858,6 +860,15 @@ libpqrcv_create_slot(WalReceiverConn *conn, const char *slotname,
858860
returnsnapshot;
859861
}
860862

863+
/*
864+
* Return PID of remote backend process.
865+
*/
866+
staticpid_t
867+
libpqrcv_get_backend_pid(WalReceiverConn*conn)
868+
{
869+
returnPQbackendPID(conn->streamConn);
870+
}
871+
861872
/*
862873
* Convert tuple query result to tuplestore.
863874
*/

‎src/include/replication/walreceiver.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ typedef char *(*walrcv_create_slot_fn) (WalReceiverConn *conn,
226226
constchar*slotname,booltemporary,
227227
CRSSnapshotActionsnapshot_action,
228228
XLogRecPtr*lsn);
229+
typedefpid_t (*walrcv_get_backend_pid_fn) (WalReceiverConn*conn);
229230
typedefWalRcvExecResult*(*walrcv_exec_fn) (WalReceiverConn*conn,
230231
constchar*query,
231232
constintnRetTypes,
@@ -246,6 +247,7 @@ typedef struct WalReceiverFunctionsType
246247
walrcv_receive_fnwalrcv_receive;
247248
walrcv_send_fnwalrcv_send;
248249
walrcv_create_slot_fnwalrcv_create_slot;
250+
walrcv_get_backend_pid_fnwalrcv_get_backend_pid;
249251
walrcv_exec_fnwalrcv_exec;
250252
walrcv_disconnect_fnwalrcv_disconnect;
251253
}WalReceiverFunctionsType;
@@ -276,6 +278,8 @@ extern PGDLLIMPORT WalReceiverFunctionsType *WalReceiverFunctions;
276278
WalReceiverFunctions->walrcv_send(conn, buffer, nbytes)
277279
#definewalrcv_create_slot(conn,slotname,temporary,snapshot_action,lsn) \
278280
WalReceiverFunctions->walrcv_create_slot(conn, slotname, temporary, snapshot_action, lsn)
281+
#definewalrcv_get_backend_pid(conn) \
282+
WalReceiverFunctions->walrcv_get_backend_pid(conn)
279283
#definewalrcv_exec(conn,exec,nRetTypes,retTypes) \
280284
WalReceiverFunctions->walrcv_exec(conn, exec, nRetTypes, retTypes)
281285
#definewalrcv_disconnect(conn) \

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp