Re: Minimal logical decoding on standbys
Andres Freund <andres@anarazel.de>
Commits
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Reduce the log level in 035_standby_logical_decoding.pl.
- 3034dc56ef4b 16.0 landed
-
035_standby_logical_decoding: Add missing waits for replication
- 57411c82ce86 16.0 landed
-
For cascading replication, wake physical and logical walsenders separately
- e101dfac3a53 16.0 landed
-
Handle logical slot conflicts on standby
- 26669757b6a7 16.0 landed
-
Support invalidating replication slots due to horizon and wal_level
- be87200efd93 16.0 landed
-
Prevent use of invalidated logical slot in CreateDecodingContext()
- 4397abd0a2af 16.0 landed
-
Replace replication slot's invalidated_at LSN with an enum
- 15f8203a5975 16.0 landed
-
Pass down table relation into more index relation functions
- 61b313e47eb9 16.0 landed
-
Assert only valid flag bits are passed to visibilitymap_set()
- a88a18b1250b 16.0 landed
-
Remove unused _bt_delitems_delete() argument.
- dc43492e46c7 14.0 cited
-
Add xl_btree_delete optimization.
- d2e5e20e5711 13.0 cited
Hi, On 2021-08-02 16:45:23 +0200, Drouvot, Bertrand wrote: > On 7/27/21 7:22 PM, Andres Freund wrote: > > On 2021-07-27 09:23:48 +0200, Drouvot, Bertrand wrote: > > > Thanks for the warning, rebase done and new v21 version attached. > > Did you have a go at fixing the walsender race conditions I > > (re-)discovered? Without fixing those I don't see this patch going in... > > Those new patches should be addressing all your previous code and TAP tests > remarks, except those 2 for which I would need your input: > > 1. The first one is linked to your remarks: > " > > > While working on this I found a, somewhat substantial, issue: > > > > When the primary is idle, on the standby logical decoding via walsender > > will typically not process the records until further WAL writes come in > > from the primary, or until a 10s lapsed. > > > > The problem is that WalSndWaitForWal() waits for the *replay* LSN to > > increase, but gets woken up by walreceiver when new WAL has been > > flushed. Which means that typically walsenders will get woken up at the > > same time that the startup process will be - which means that by the > > time the logical walsender checks GetXLogReplayRecPtr() it's unlikely > > that the startup process already replayed the record and updated > > XLogCtl->lastReplayedEndRecPtr. > > > > I think fixing this would require too invasive changes at this point. I > > think we might be able to live with 10s delay issue for one release, but > > it sure is ugly :(. > > This is indeed pretty painful. It's a lot more regularly occuring if you > either have a slot disk, or you switch around the order of > WakeupRecovery() and WalSndWakeup() XLogWalRcvFlush(). > > " > > Is that what you are referring to as the “walsender race conditions”? Yes. > If so, do you already have in mind a way to handle this? (I thought you > already had in mind a way to handle it so the question) Yes. I think we need to add a condition variable to be able to wait for WAL positions to change. Either multiple condition variables (one for the flush position, one for the replay position), or one that just changes more often. That way one can wait for apply without a race condition. > 2. The second one is linked to your remark: > > "There's also no test for a recovery conflict due to row removal" > > Don't you think that the "vacuum full" conflict test is enough? It's not. It'll cause conflicts due to exclusive locks etc. > if not, what kind of additional tests would you like to see? A few catalog rows being removed (e.g. due to DELETE and then VACUUM *without* full) and a standby without hot_standby_feedback catching that. Greetings, Andres Freund