Re: Improve pg_sync_replication_slots() to wait for primary to advance
| От | Japin Li |
|---|---|
| Тема | Re: Improve pg_sync_replication_slots() to wait for primary to advance |
| Дата | |
| Msg-id | MEAPR01MB30314AE414C23401A233F418B6D9A@MEAPR01MB3031.ausprd01.prod.outlook.com обсуждение исходный текст |
| Список | pgsql-hackers |
On Tue, 02 Dec 2025 at 19:27, Ajin Cherian <itsajin@gmail.com> wrote: > On Fri, Nov 28, 2025 at 5:03 PM Japin Li <japinli@hotmail.com> wrote: >> >> 1. >> Initialize slot_persistence_pending to false (to avoid uninitialized values, or >> initialize to true by mistaken) in update_and_persist_local_synced_slot(). This >> aligns with the handling of found_consistent_snapshot and remote_slot_precedes >> in update_local_synced_slot(). >> >> diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c >> index 20eada3393..c55ba11f17 100644 >> --- a/src/backend/replication/logical/slotsync.c >> +++ b/src/backend/replication/logical/slotsync.c >> @@ -617,6 +617,9 @@ update_and_persist_local_synced_slot(RemoteSlot *remote_slot, Oid remote_dbid, >> bool found_consistent_snapshot = false; >> bool remote_slot_precedes = false; >> >> + if (slot_persistence_pending) >> + *slot_persistence_pending = false; >> + >> /* Slotsync skip stats are handled in function update_local_synced_slot() */ >> (void) update_local_synced_slot(remote_slot, remote_dbid, >> &found_consistent_snapshot, >> > > I don't understand what the comment is here. I mean, we should always set the slot_persistence_pending variable to false immediately when entering the update_and_persist_local_synced_slot() function. For example: bool slot_persistence_pending = true; update_and_persist_local_synced_slot(..., &slot_persistence_pending); /* Here the slot_persistence_pending is always true, is this expected? */ -- Regards, Japin Li ChengDu WenWu Information Technology Co., Ltd.
В списке pgsql-hackers по дате отправления: