From 2de7b6ef4f74170b9f593b9fbe1e7524f4cf76da Mon Sep 17 00:00:00 2001 From: Shlok Kyal Date: Tue, 20 Feb 2024 14:53:55 +0530 Subject: [PATCH v24 13/18] Consider temporary slot to check max_replication_slots in primary While checking for max_replication_slots in primary we should consider the temporary slot as well. --- src/bin/pg_basebackup/pg_createsubscriber.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c index 26ce91f58b..4a28dfb81c 100644 --- a/src/bin/pg_basebackup/pg_createsubscriber.c +++ b/src/bin/pg_basebackup/pg_createsubscriber.c @@ -698,7 +698,8 @@ check_publisher(LogicalRepInfo *dbinfo) * we should check it to make sure it won't fail. * * - wal_level = logical - * - max_replication_slots >= current + number of dbs to be converted + * - max_replication_slots >= current + number of dbs to be converted + + * temporary slot to be created * - max_wal_senders >= current + number of dbs to be converted * ----------------------------------------------------------------------- */ @@ -786,12 +787,12 @@ check_publisher(LogicalRepInfo *dbinfo) return false; } - if (max_repslots - cur_repslots < num_dbs) + if (max_repslots - cur_repslots < num_dbs + 1) { pg_log_error("publisher requires %d replication slots, but only %d remain", - num_dbs, max_repslots - cur_repslots); + num_dbs + 1, max_repslots - cur_repslots); pg_log_error_hint("Consider increasing max_replication_slots to at least %d.", - cur_repslots + num_dbs); + cur_repslots + num_dbs + 1); return false; } -- 2.43.0