From 75cf7a748dd9392a9d1f5525a8381f1378185772 Mon Sep 17 00:00:00 2001 From: Jelte Fennema Date: Wed, 7 Sep 2022 12:18:39 +0200 Subject: [PATCH] Define symbols required for downgrade from 11.1 (#6301) Since #6300/e29db74 changed the C symbol that our bigint overrides of pg_cancel_backend and pg_terminate_backend called. We needed to do something to continue to make these functions work after downgrading. Recreating the old definition with a downgrade scripts is not really possible, since people are expected to run the downgrade steps when using the new .so file, which does not contain the old symbols. So, the easiest way to solve it was also defining the new symbols in our old Citus versions. Luckily our overrides haven't existed for long, so these symbol definitions only needed to be backported to 11.0. --- .../commands/citus_global_signal.c | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/backend/distributed/commands/citus_global_signal.c b/src/backend/distributed/commands/citus_global_signal.c index 8f33f91b7..74a29a8a9 100644 --- a/src/backend/distributed/commands/citus_global_signal.c +++ b/src/backend/distributed/commands/citus_global_signal.c @@ -24,6 +24,8 @@ static bool CitusSignalBackend(uint64 globalPID, uint64 timeout, int sig); PG_FUNCTION_INFO_V1(pg_cancel_backend); PG_FUNCTION_INFO_V1(pg_terminate_backend); +PG_FUNCTION_INFO_V1(citus_cancel_backend); +PG_FUNCTION_INFO_V1(citus_terminate_backend); /* * pg_cancel_backend overrides the Postgres' pg_cancel_backend to cancel @@ -48,6 +50,18 @@ pg_cancel_backend(PG_FUNCTION_ARGS) } +/* + * citus_cancel_backend is needed to make the pg_cancel_backend SQL function + * still work after downgrading from 11.1, which changed its definition to call + * a different symbol. See #6300/e29db74 for details. + */ +Datum +citus_cancel_backend(PG_FUNCTION_ARGS) +{ + return pg_cancel_backend(fcinfo); +} + + /* * pg_terminate_backend overrides the Postgres' pg_terminate_backend to terminate * a query with a global pid so a query can be terminated from another node. @@ -71,6 +85,18 @@ pg_terminate_backend(PG_FUNCTION_ARGS) } +/* + * citus_terminate_backend is needed to make the pg_terminate_backend SQL + * function still work after downgrading from 11.1, which changed its + * definition to call a different symbol. See #6300/e29db74 for details + */ +Datum +citus_terminate_backend(PG_FUNCTION_ARGS) +{ + return pg_terminate_backend(fcinfo); +} + + /* * CitusSignalBackend gets a global pid and and ends the original query with the global pid * that might have started in another node by connecting to that node and running either