Dear Amit, Sawada-san, > I think Kuroda-San wants to emit a WARNING at the time of CREATE > SUBSCRIPTION. But it won't be possible to emit a WARNING at the time > of ALTER SUBSCRIPTION. Also, as you say if the user later changes the > value of max_slot_wal_keep_size, then even if we issue LOG/WARNING in > walsender, it may go unnoticed. If we really want to give WARNING for > this then we can probably give it as soon as user has set non-default > value of min_send_delay to indicate that this can lead to retaining > WAL on the publisher and they should consider setting > max_slot_wal_keep_size.
Yeah, my motivation is to emit WARNING at CREATE SUBSCRIPTION, but I have not noticed that the approach has not covered ALTER SUBSCRIPTION. > Having said that, I think users can always tune max_slot_wal_keep_size > and min_send_delay (as none of these requires restart) if they see any > indication of unexpected WAL size growth. There could be multiple ways > to check it but I think one can refer wal_status in > pg_replication_slots, the extended value can be an indicator of this. Yeah, min_send_delay and max_slots_wal_keep_size should be easily tunable because the appropriate value depends on the enviroment and workload. However, pg_replication_slots.pg_replication_slots cannot show the exact amout of WALs, so it may not suitable for tuning. I think user can compare the value pg_replication_slots.restart_lsn (or pg_stat_replication.sent_lsn) and pg_current_wal_lsn() to calclate number of WALs to be delayed, like ``` postgres=# select pg_current_wal_lsn() - pg_replication_slots.restart_lsn as delayed from pg_replication_slots; delayed ------------ 1689153760 (1 row) ``` > I think it would be better to tell about this in the docs along with > the 'min_send_delay' description. The key point is whether this would > be an acceptable trade-off for users who want to use this feature. I > think it can harm only if users use this without understanding the > corresponding trade-off. As we kept the default to no delay, it is > expected from users using this have an understanding of the trade-off. Yes, the trade-off should be emphasized. Best Regards, Hayato Kuroda FUJITSU LIMITED