Re: Exit walsender before confirming remote flush in logical replication
Kyotaro Horiguchi <horikyota.ntt@gmail.com>
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: kuroda.hayato@fujitsu.com
Cc: amit.kapila16@gmail.com, dilipbalaut@gmail.com,
pgsql-hackers@postgresql.org
Date: 2023-01-16T01:28:23Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add wal_sender_shutdown_timeout GUC to limit shutdown wait for replication
- a8f45dee9176 19 (unreleased) landed
-
pg_upgrade: Add --copy option
- 746915c68669 16.0 cited
-
Prevent possibility of panics during shutdown checkpoint.
- c6c333436491 10.0 cited
-
Support clean switchover.
- 985bd7d49726 9.4.0 cited
At Wed, 28 Dec 2022 09:15:41 +0000, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com> wrote in > > Another thing we can investigate here why do we need to ensure that > > there is no pending send before shutdown. > > I have not done yet about it, will continue next year. > It seems that walsenders have been sending all data before shutting down since ea5516, > e0b581 and 754baa. > There were many threads related with streaming replication, so I could not pin > the specific message that written in the commit message of ea5516. > > I have also checked some wiki pages [1][2], but I could not find any design about it. > > [1]: https://wiki.postgresql.org/wiki/Streaming_Replication > [2]: https://wiki.postgresql.org/wiki/Synchronous_Replication_9/2010_Proposal If I'm grabbing the discussion here correctly, in my memory, it is because: physical replication needs all records that have written on primary are written on standby for switchover to succeed. It is annoying that normal shutdown occasionally leads to switchover failure. Thus WalSndDone explicitly waits for remote flush/write regardless of the setting of synchronous_commit. Thus apply delay doesn't affect shutdown (AFAICS), and that is sufficient since all the records will be applied at the next startup. In logical replication apply preceeds write and flush so we have no indication whether a record is "replicated" to standby by other than apply LSN. On the other hand, logical recplication doesn't have a business with switchover so that assurarance is useless. Thus I think we can (practically) ignore apply_lsn at shutdown. It seems subtly irregular, though. regards. -- Kyotaro Horiguchi NTT Open Source Software Center