Josh Berkus <josh@agliodbs.com> writes:
>> (a) and (d) are probably simple, if by "reprovisioning" you mean
>> "rm -rf $PGDATA; initdb".
> Exactly. Followed by "scp database_image". Or heck, just replacing the
> whole VM.
Right, that would work. I don't think you really need to implement that
inside Postgres. I would envision having the startup script do it, ie
rm -rf $PGDATA
cp -pr prepared-database-image $PGDATA
# this loop exits when postmaster exits normally
while ! postmaster ...
do
rm -rf $PGDATA
cp -pr prepared-database-image $PGDATA
done
Then all you need is a tweak to make the postmaster exit(1) after
a crash instead of trying to launch recovery.
regards, tom lane