Обсуждение: pgsql: Refactor libpqwalreceiver
Refactor libpqwalreceiver The whole walreceiver API is now wrapped into a struct, like most of our other loadable module APIs. The libpq connection is no longer a global variable in libpqwalreceiver. Instead, it is encapsulated into a struct that is passed around the functions. This allows multiple walreceivers to run at the same time. Add some rudimentary support for logical replication connections to libpqwalreceiver. These changes are mostly cosmetic and are going to be useful for the future logical replication patches. From: Petr Jelinek <petr@2ndquadrant.com> Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/78c8c814390f14398e8fd43fe7282cb2e260b50f Modified Files -------------- .../libpqwalreceiver/libpqwalreceiver.c | 266 ++++++++++++--------- src/backend/replication/walreceiver.c | 59 +++-- src/include/replication/walreceiver.h | 83 +++++-- 3 files changed, 235 insertions(+), 173 deletions(-)
Peter Eisentraut <peter_e@gmx.net> writes: > Refactor libpqwalreceiver Buildfarm results indicate this broke the Windows build. regards, tom lane
Tom Lane wrote: > Peter Eisentraut <peter_e@gmx.net> writes: > > Refactor libpqwalreceiver > > Buildfarm results indicate this broke the Windows build. src/backend/replication/walreceiver.c(296): error C2039: 'pgwin32_connect' : is not a member of 'WalReceiverFunctionsType'[c:\prog\bf\root\HEAD\pgsql.build\postgres.vcxproj] c:\prog\bf\root\HEAD\pgsql.build\src\include\replication/walreceiver.h(163) : see declaration of 'WalReceiverFunctionsType' src/backend/replication/walreceiver.c(1152): warning C4003: not enough actual parameters for macro 'send' [c:\prog\bf\root\HEAD\pgsql.build\postgres.vcxproj] src/backend/replication/walreceiver.c(1152): error C2039: 'pgwin32_send' : is not a member of 'WalReceiverFunctionsType'[c:\prog\bf\root\HEAD\pgsql.build\postgres.vcxproj] c:\prog\bf\root\HEAD\pgsql.build\src\include\replication/walreceiver.h(163) : see declaration of 'WalReceiverFunctionsType' src/backend/replication/walreceiver.c(1152): error C2059: syntax error : ')' [c:\prog\bf\root\HEAD\pgsql.build\postgres.vcxproj] src/backend/replication/walreceiver.c(1230): warning C4003: not enough actual parameters for macro 'send' [c:\prog\bf\root\HEAD\pgsql.build\postgres.vcxproj] src/backend/replication/walreceiver.c(1230): error C2039: 'pgwin32_send' : is not a member of 'WalReceiverFunctionsType'[c:\prog\bf\root\HEAD\pgsql.build\postgres.vcxproj] c:\prog\bf\root\HEAD\pgsql.build\src\include\replication/walreceiver.h(163) : see declaration of 'WalReceiverFunctionsType' src/backend/replication/walreceiver.c(1230): error C2059: syntax error : ')' [c:\prog\bf\root\HEAD\pgsql.build\postgres.vcxproj] That's because win32.h has this line: #define connect(s, name, namelen) pgwin32_connect(s, name, namelen) which breaks the use of "connect" as a struct member name (same with send). The easiest fix seems to rename the struct members. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
On 02/12/16 05:17, Alvaro Herrera wrote: > Tom Lane wrote: >> Peter Eisentraut <peter_e@gmx.net> writes: >>> Refactor libpqwalreceiver >> >> Buildfarm results indicate this broke the Windows build. > > src/backend/replication/walreceiver.c(296): error C2039: 'pgwin32_connect' : is not a member of 'WalReceiverFunctionsType'[c:\prog\bf\root\HEAD\pgsql.build\postgres.vcxproj] > c:\prog\bf\root\HEAD\pgsql.build\src\include\replication/walreceiver.h(163) : see declaration of 'WalReceiverFunctionsType' > src/backend/replication/walreceiver.c(1152): warning C4003: not enough actual parameters for macro 'send' [c:\prog\bf\root\HEAD\pgsql.build\postgres.vcxproj] > src/backend/replication/walreceiver.c(1152): error C2039: 'pgwin32_send' : is not a member of 'WalReceiverFunctionsType'[c:\prog\bf\root\HEAD\pgsql.build\postgres.vcxproj] > c:\prog\bf\root\HEAD\pgsql.build\src\include\replication/walreceiver.h(163) : see declaration of 'WalReceiverFunctionsType' > src/backend/replication/walreceiver.c(1152): error C2059: syntax error : ')' [c:\prog\bf\root\HEAD\pgsql.build\postgres.vcxproj] > src/backend/replication/walreceiver.c(1230): warning C4003: not enough actual parameters for macro 'send' [c:\prog\bf\root\HEAD\pgsql.build\postgres.vcxproj] > src/backend/replication/walreceiver.c(1230): error C2039: 'pgwin32_send' : is not a member of 'WalReceiverFunctionsType'[c:\prog\bf\root\HEAD\pgsql.build\postgres.vcxproj] > c:\prog\bf\root\HEAD\pgsql.build\src\include\replication/walreceiver.h(163) : see declaration of 'WalReceiverFunctionsType' > src/backend/replication/walreceiver.c(1230): error C2059: syntax error : ')' [c:\prog\bf\root\HEAD\pgsql.build\postgres.vcxproj] > > That's because win32.h has this line: > > #define connect(s, name, namelen) pgwin32_connect(s, name, namelen) > > which breaks the use of "connect" as a struct member name (same with send). > The easiest fix seems to rename the struct members. > Hi, Yes, that seems to be the case. Something as simple as attached should do. -- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Вложения
Petr Jelinek wrote: > Yes, that seems to be the case. > > Something as simple as attached should do. Pushed. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services