1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-03 20:02:46 +03:00

Rethink the way walreceiver is linked into the backend. Instead than shoving

walreceiver as whole into a dynamically loaded module, split the
libpq-specific parts of it into dynamically loaded module and keep the rest
in the main backend binary.

Although Tom fixed the Windows compilation problems with the old walreceiver
module already, this is a cleaner division of labour and makes the code
more readable. There's also the prospect of adding new transport methods
as pluggable modules in the future, which this patch makes easier, though for
now the API between libpqwalreceiver and walreceiver process should be
considered private.

The libpq-specific module is now in src/backend/replication/libpqwalreceiver,
and the part linked with postgres binary is in
src/backend/replication/walreceiver.c.
This commit is contained in:
Heikki Linnakangas
2010-01-20 09:16:24 +00:00
parent eb210ce85a
commit 32bc08b1d4
9 changed files with 441 additions and 326 deletions

View File

@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.256 2010/01/15 09:19:00 heikki Exp $
* $PostgreSQL: pgsql/src/backend/bootstrap/bootstrap.c,v 1.257 2010/01/20 09:16:23 heikki Exp $
*
*-------------------------------------------------------------------------
*/
@ -425,20 +425,7 @@ AuxiliaryProcessMain(int argc, char *argv[])
case WalReceiverProcess:
/* don't set signals, walreceiver has its own agenda */
{
PGFunction WalReceiverMain;
/*
* Walreceiver is not linked directly into the server
* binary because we would then need to link the server
* with libpq. It's compiled as a dynamically loaded module
* to avoid that.
*/
WalReceiverMain = load_external_function("walreceiver",
"WalReceiverMain",
true, NULL);
WalReceiverMain(NULL);
}
WalReceiverMain();
proc_exit(1); /* should never return */
default: