Please find a few comments: 1) ReplicationSlotsDropDBSlots: + bool dropped = false;
We can name 'dropped ' as 'dropped_logical' similar to ReplicationSlotCleanup. 2) ReplicationSlotsDropDBSlots() + + if (dropped && nlogicalslots == 0) + DisableLogicalDecodingIfNecessary(); I could not understand the need of 'nlogicalslots' condition here? Once we increment 'nlogicalslots', there is no way we can skip the loop without dropping the slot with the only exception of ERROR-ing out if active_pid is non NULL. So if the loop has completed and we have reached this sage, won't it essentially mean 'nlogicalslots' is 0 in both cases: a) we actually dropped any slot; b) we did not find any slot to drop. Or am I missing something? Same is the case with ReplicationSlotCleanup(). 3) Few typos: + /* + * Update shmem flags. We don't need to care about the order of setting + * global flag and writing the WAL record this case since writes are not + * allowed yet. + */ this case --> in this case + * This is the authoritative value used by the all process to determine 'used by all the processes' 049_effective_wal_level.pl: 4) Few typos: +# Initialize standby2 ndoe form the backup 'my_backup'. ndoe form --> node from +# Test the race condition between the startup and logical decoding statuc change. statuc --> status 5) +# Promote the standby2 node that has one logical slot. So the logical decoding +# keeps enabled even after the promotion. +$standby2->promote; +test_wal_level($standby2, "replica|logical", + "effective_wal_level keeps 'logical' even after the promotion"); +$standby2->safe_psql('postgres', + qq[select pg_create_logical_replication_slot('standby2_slot2', 'pgoutput')] +); +$standby2->stop; Do we need 'pg_create_logical_replication_slot' here? 6) +test_wal_level($primary, "replica|replica", + "effective_wal_level got decreased to 'replica' on primary"); +test_wal_level($standby3, "logical|replica", + "effective_wal_level got decreased to 'replica' on standby"); +test_wal_level($cascade, "replica|replica", + "effective_wal_level got decreased to 'logical' on standby"); + Last one should also say: decreased to 'replica' (instead of logical) thanks Shveta