Hi Jakub, > There's even third thing that surpised me: I've noticed there's new code from > PG 19 onwards (WAIT FOR LSN), and this seems to be (?) slowing us down too > potentially (by how much I don't haven't measured from last version PG18 vs > PG19), but we seem to do now 3x separate pg_atomic_read_membarrier_u64() > from the main redo loop (PerformWalRecovery()), so quick attempted to do just > one read barrier read seems to work and there gives some boost too. But I > haven't tested this on like ARM (where without such barriers CPUs are more > free to reoder stuff - right?), so I just hope it's safe (it's first time > for me to play with barrier(s), maybe better one could be used there, dunno). > Other interesting thing (not pursued covered in patch) is perhaps why do > we even check for the WaitLSNWakeups() in case of doing pure (closed) crash > recovery (when DB is inaccessible, way before anything could issue register > to be waiting for anything)?
Thanks for your observation. This has been raised and disussed before, but not tackled yet [1][2]. I think we also need to move the new helper inside ApplyWalRecord() as Heikki suggested. [1] https://www.postgresql.org/message-id/CAPpHfdvu7bPzP1p3eZW3t6QgF39stTce=oyobyn6n2j+zc5...@mail.gmail.com [2] https://www.postgresql.org/message-id/CABPTF7UkddAnG=6x0jlheovwo-xog3xyxgc1uwhbjj5ehrj...@mail.gmail.com -- Regards, Xuneng Zhou HighGo Software Co., Ltd.
