Dear Vignesh, Thank you for making the PoC!
> Here is a patch which checks that there are no WAL records other than > CHECKPOINT_SHUTDOWN WAL record to be consumed based on the discussion > from [1]. Basically I agreed your approach. Thanks! > Patch 0001 and 0002 is same as the patch posted by Kuroda-san, Patch > 0003 exposes pg_get_wal_records_content to get the WAL records along > with the WAL record type between start and end lsn. pg_walinspect > contrib module already exposes a function for this requirement, I have > moved this functionality to be exposed from the backend. Patch 0004 > has slight change in check function to check that there are no other > records other than CHECKPOINT_SHUTDOWN to be consumed. The attached > patch has the changes for the same. > Thoughts? > > [1] - > https://www.postgresql.org/message-id/CAA4eK1Kem-J5NM7GJCgyKP84pEN6 > RsG6JWo%3D6pSn1E%2BiexL1Fw%40mail.gmail.com Few comments: * Per comment from Amit [1], I used pg_get_wal_record_info() instead of pg_get_wal_records_info(). This function extract a next available WAL record, which can avoid huge scan if the confirmed_flush is much behind. * According to cfbot and my analysis, the 0001 cannot pass the test on macOS. So I revived Julien's patch [2] as 0002 once. AFAIS the 0001 is not so welcomed. Next patch will be available soon. [1]: https://www.postgresql.org/message-id/CAA4eK1LWKkoyy-p-SAT0JTWa%3D6kXiMd%3Da6ZcArY9eU4a3g4TZg%40mail.gmail.com [2]: https://www.postgresql.org/message-id/20230414061248.vdsxz2febjo3re6h%40jrouhaud Best Regards, Hayato Kuroda FUJITSU LIMITED