Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsuccessful standby replication on PostgreSQL 17 #485

Closed
esiaero opened this issue Sep 10, 2024 · 1 comment
Closed

Unsuccessful standby replication on PostgreSQL 17 #485

esiaero opened this issue Sep 10, 2024 · 1 comment

Comments

@esiaero
Copy link

esiaero commented Sep 10, 2024

Hi, I tested subscription to a standby with the HEAD of the repo (pglogical 2.4.5, pending release).
I'm noticing pglogical seems to create subscriptions with failover as long as its supported on the node (by checking catalog).

pglogical/pglogical_sync.c

Lines 900 to 904 in c3507a8

use_failover_slot =
pglogical_remote_function_exists(origin_conn, "pg_catalog",
"pg_create_logical_replication_slot",
-1,
"failover");

pglogical/pglogical_sync.c

Lines 308 to 311 in c3507a8

#if PG_VERSION_NUM >= 170000
appendStringInfo(&query, "CREATE_REPLICATION_SLOT \"%s\" LOGICAL %s%s",
slot_name, "pglogical_output",
use_failover_slot ? " (FAILOVER)" : "");

But with PG 17, that isn't supported if its a standby.
https://github.com/postgres/postgres/blob/bccca780eef904002512a1a0b5ce617bcb63507b/src/backend/replication/slot.c#L330-L333

So unlike PG 16, now the subscription cannot succeed, with error messages like

ERROR:  cannot enable failover for a replication slot created on the standby
...
STATEMENT:  CREATE_REPLICATION_SLOT "pgl_postgres_provider_testsub" LOGICAL pglogical_output (FAILOVER)

I was curious if this kind of behavior is expected?

@eulerto
Copy link
Contributor

eulerto commented Sep 23, 2024

Fixed by commit 8579de3.

@eulerto eulerto closed this as completed Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants