Skip to content

Commit

Permalink
failover is not supported
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
eulerto committed Sep 23, 2024
1 parent c3507a8 commit 8579de3
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions pglogical_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -889,19 +883,21 @@ 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);

origin_conn = pglogical_connect(sub->origin_if->dsn,
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");

Expand Down

0 comments on commit 8579de3

Please # to comment.