I want to propose adding hook in BufferSync.
So that extensions could track pages changed between checkpoints. I think this can allow efficient differential backups taken right after checkpoint. And this functionality can be implemented as an extension.
I propose to add hook inside BufferSync() function it inform extensions that we are going to write pages to disk. Please see patch attached. I pass a timestamp of the checkpoint, but it would be good if we could also pass there number of checkpoint or something like this to ensure that some checkpoints were not lost (this could yield malformed backups).
This is just an idea to discuss, I could not find something like this in pgsql-hackers as for now. Neither I could find similar hooks in the code.
Is this hook sufficient to implement page tracking for differential backups? I’m not sure, but seems like it is.
Is this call enough to gather information about changed pages for backup purposes?
Can we call extensions reliably from checkpointer process?
Can we guaranty that extension won’t miss our call or we will defer BufferSync if extension have failed?
Can we provide more flexibility for this hook?
Any thought will be appreciated.
Best regards, Andrey Borodin, Yandex.