Re: pgsql: Implement pg_wal_replay_wait() stored procedure
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Alexander Korotkov <aekorotkov@gmail.com>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>, Pavel Borisov <pashkin.elfe@gmail.com>, Peter Eisentraut <peter@eisentraut.org>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2024-11-04T06:04:09Z
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 →
-
Revert pg_wal_replay_wait() stored procedure
- 3a7ae6b3d91e 18.0 landed
-
Add 'no_error' argument to pg_wal_replay_wait()
- e546989a269d 18.0 landed
-
Refactor WaitForLSNReplay() to return the result of waiting
- 73da6b8d1b3e 18.0 landed
-
Make WaitForLSNReplay() issue FATAL on postmaster death
- 6cfebfe88b9a 18.0 landed
-
Move LSN waiting declarations and definitions to better place
- 5035172e4ab5 18.0 landed
-
Update oid for pg_wal_replay_wait() procedure
- e658038772f5 18.0 landed
-
Move pg_wal_replay_wait() to xlogfuncs.c
- 014f9f34d252 18.0 landed
-
Implement pg_wal_replay_wait() stored procedure
- 3c5db1d6b016 18.0 cited
On Mon, Nov 04, 2024 at 06:29:42AM +0200, Alexander Korotkov wrote: > The attached patchset contains patch 0001, which improves handling of > not in recovery state by usage of PromoteIsTriggered(). When > (PromoteIsTriggered() == false), last replay LSN is not accepted and > not reported in errdetail(). > > 0002 contains patch finishing implicit transaction in default > isolation level REPEATABLE READ or higher with revised commit message. I was just catching up with this thread, and I'm still confused about the state of things. There are two things that are out of order for me, at least, after skimming through the code on HEAD (I suspect there is more): - WaitForLSNReplay() uses an initial set of checks that are duplicated in the main loop. This is still overcomplicated, no? Wouldn't it be simpler to eliminate the first of checks or just have a goto block with addLSNWaiter() called after the first round of checks? - pg_wal_replay_wait_status() returns a status based on a static variable that can only be accessed with the same backend as the one that has called the wait function. That's.. Err.. Unfriendly. Why being sticky with one backend for the job? Using output parameters in a procedure is something I did not recall. Based on your point about not using a function due your argument based on the snapshots, let's just use that and forget about the status function entirely (please?). Based on the latest set of issues reported, it does not feel like this is really baked and ready for prime day, either. Perhaps it would be less confusing to just revert the whole and repost a more complete and structured implementation with an extra round of reviews? There's still time in this release cycle. -- Michael