From 8579de3b2557355008ddac13ce05663942eedddf Mon Sep 17 00:00:00 2001 From: Euler Taveira Date: Fri, 20 Sep 2024 13:14:07 -0300 Subject: [PATCH] failover is not supported There was an oversight in commit de737f787e7 that enables failover option if the version is 17. An existing code checks if there is a function named pg_create_logical_replication_slot with an argument "failover". There wasn't such function in Postgres until 17 so it never adds the "failover" option. Remove this test for Postgres. --- pglogical_sync.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pglogical_sync.c b/pglogical_sync.c index 6934094..c7ee4d4 100644 --- a/pglogical_sync.c +++ b/pglogical_sync.c @@ -305,15 +305,9 @@ ensure_replication_slot_snapshot(PGconn *sql_conn, PGconn *repl_conn, retry: initStringInfo(&query); -#if PG_VERSION_NUM >= 170000 - appendStringInfo(&query, "CREATE_REPLICATION_SLOT \"%s\" LOGICAL %s%s", - slot_name, "pglogical_output", - use_failover_slot ? " (FAILOVER)" : ""); -#else appendStringInfo(&query, "CREATE_REPLICATION_SLOT \"%s\" LOGICAL %s%s", slot_name, "pglogical_output", use_failover_slot ? " FAILOVER" : ""); -#endif res = PQexec(repl_conn, query.data); @@ -889,7 +883,7 @@ pglogical_sync_subscription(PGLogicalSubscription *sub) PGconn *origin_conn_repl; RepOriginId originid; char *snapshot; - bool use_failover_slot; + bool use_failover_slot = false; elog(INFO, "initializing subscriber %s", sub->name); @@ -897,11 +891,13 @@ pglogical_sync_subscription(PGLogicalSubscription *sub) sub->name, "snap"); /* 2QPG9.6 and 2QPG11 support failover slots */ +#if defined(SECONDQ_VERSION_NUM) && PG_VERSION_NUM < 120000 use_failover_slot = pglogical_remote_function_exists(origin_conn, "pg_catalog", "pg_create_logical_replication_slot", -1, "failover"); +#endif origin_conn_repl = pglogical_connect_replica(sub->origin_if->dsn, sub->name, "snap");