Hi Yash, Thank you for taking the time to study and test the patch, and for reproducing the crash with test_sync_handler. You're right: Before this patch every handler lived in core, so a NULL optional callback could never be reached, and now an extension can register one. A NULL check before each optional callback is worth adding, and I'd gladly take your incremental patch.
Since the patch turns syncsw[] from a static array into one an extension can extend, I also measured what that costs at run time. I compared master at 009ea1b08d7 with and without 0001, both built with meson's release settings (-O3, GCC 14.2.0) on a 6-vCPU KVM guest: - Checkpoints with 2001 fsync dispatches each, on tmpfs: Timed with a uprobe, ProcessSyncRequests() took 6868.4 us per call stock and 6882.2 us patched (1.0020), with a 1.9% spread between runs of the same build. The checkpointer's instruction count under perf stat differed by 0.02%, against a 0.07% spread. - Checkpoints after 500 tables were dropped and recreated: SyncPostCheckpoint() took 1931.3 us and 1932.2 us per call (1.0005), with a 1.6% spread. - pgbench TPC-B on tmpfs: 11122 and 11166 tps, inside a 6.7% spread. Nothing was measurable in either direction. The smallest difference this setup could have detected was about 65 ns per dispatched file, and the measured one was about 7 ns. With the client on the same vCPUs of a shared VM, I'd read that as "not measurable here" rather than zero. The generated code agrees, and it sharpens what I said about it before. The per-file dispatch sequence is unchanged and each of the three functions keeps its instruction count, at -O3 and at -O2. In ProcessSyncRequests() the load of the table pointer replaces an address computation rather than adding an instruction. SyncPostCheckpoint() runs 2 more instructions per call when unlinks are pending. In RememberSyncRequest() the change sits only in the SYNC_FILTER_REQUEST branch that DROP DATABASE uses, where the patched loop is slightly shorter; that path wasn't measured at run time. I also owe the thread a correction. My first message said Lamstore's storage manager works today against stock PostgreSQL and Percona Server for PostgreSQL 18. That holds on Percona, which provides smgr_register(), but not on stock PostgreSQL, which gives an extension no way to register a storage manager. Regards, Greg
