Re: [HACKERS] Adding hook in BufferSync for backup purposes - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Adding hook in BufferSync for backup purposes
Date
Msg-id 21401.1502113050@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Adding hook in BufferSync for backup purposes  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: [HACKERS] Adding hook in BufferSync for backup purposes  (Andrey Borodin <x4mmm@yandex-team.ru>)
List pgsql-hackers
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> I suppose your hook idea lets you implement the LSN fork in an
> extension, rather than having it be part of core.  The idea of hooking
> onto BufferSync makes me uneasy, though -- like it's not the correct
> place to do it.

Yeah.  Keep in mind that if the extension does anything at all that could
possibly throw an error, and if that error condition persists across
multiple tries, you will have broken the database completely: it will
be impossible to complete a checkpoint, and your WAL segment pool will
grow until it exhausts disk.  So the idea of doing something that involves
unspecified extension behavior, especially possible interaction with
an external backup agent, right there is pretty terrifying.

Other problems with the proposed patch: it misses coverage of
BgBufferSync, and I don't like exposing an ad-hoc structure like
CkptTsStatus as part of an extension API.  The algorithm used by
BufferSync to schedule buffer writes has changed multiple times
before and doubtless will again; if we're going to have a hook
here it should depend as little as possible on those details.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] Subscription code improvements
Next
From: Robins Tharakan
Date:
Subject: Re: [HACKERS] Patch: Add --no-comments to skip COMMENTs with pg_dump