Skip to content

Commit 8579de3

Browse files
committed
failover is not supported
There was an oversight in commit de737f7 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.
1 parent c3507a8 commit 8579de3

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

pglogical_sync.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -305,15 +305,9 @@ ensure_replication_slot_snapshot(PGconn *sql_conn, PGconn *repl_conn,
305305
retry:
306306
initStringInfo(&query);
307307

308-
#if PG_VERSION_NUM >= 170000
309-
appendStringInfo(&query, "CREATE_REPLICATION_SLOT \"%s\" LOGICAL %s%s",
310-
slot_name, "pglogical_output",
311-
use_failover_slot ? " (FAILOVER)" : "");
312-
#else
313308
appendStringInfo(&query, "CREATE_REPLICATION_SLOT \"%s\" LOGICAL %s%s",
314309
slot_name, "pglogical_output",
315310
use_failover_slot ? " FAILOVER" : "");
316-
#endif
317311

318312

319313
res = PQexec(repl_conn, query.data);
@@ -889,19 +883,21 @@ pglogical_sync_subscription(PGLogicalSubscription *sub)
889883
PGconn *origin_conn_repl;
890884
RepOriginId originid;
891885
char *snapshot;
892-
bool use_failover_slot;
886+
bool use_failover_slot = false;
893887

894888
elog(INFO, "initializing subscriber %s", sub->name);
895889

896890
origin_conn = pglogical_connect(sub->origin_if->dsn,
897891
sub->name, "snap");
898892

899893
/* 2QPG9.6 and 2QPG11 support failover slots */
894+
#if defined(SECONDQ_VERSION_NUM) && PG_VERSION_NUM < 120000
900895
use_failover_slot =
901896
pglogical_remote_function_exists(origin_conn, "pg_catalog",
902897
"pg_create_logical_replication_slot",
903898
-1,
904899
"failover");
900+
#endif
905901
origin_conn_repl = pglogical_connect_replica(sub->origin_if->dsn,
906902
sub->name, "snap");
907903

0 commit comments

Comments
 (0)