Re: Proposing pg_hibernate
Gurjeet Singh <gurjeet@singh.im>
From: Gurjeet Singh <gurjeet@singh.im>
To: Josh Kupershmidt <schmiddy@gmail.com>
Cc: PGSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2014-06-02T21:49:37Z
Lists: pgsql-hackers
Attachments
- pg_hibernator.v2.tgz (application/x-gzip)
On Fri, May 30, 2014 at 5:33 PM, Josh Kupershmidt <schmiddy@gmail.com> wrote: > On Tue, May 27, 2014 at 10:01 PM, Gurjeet Singh <gurjeet@singh.im> wrote: > >> When the Postgres server is being stopped/shut down, the `Buffer >> Saver` scans the >> shared-buffers of Postgres, and stores the unique block identifiers of >> each cached >> block to the disk. This information is saved under the `$PGDATA/pg_hibernator/` >> directory. For each of the database whose blocks are resident in shared buffers, >> one file is created; for eg.: `$PGDATA/pg_hibernator/2.postgres.save`. > > This file-naming convention seems a bit fragile. For example, on my > filesystem (HFS) if I create a database named "foo / bar", I'll get a > complaint like: > > ERROR: could not open "pg_hibernator/5.foo / bar.save": No such file > or directory > > during shutdown. Thanks for the report. I have reworked the file naming, and now the save-file name is simply '<integer>.save', so the name of a database does not affect the file name on disk. Instead, the null-terminated database name is now written in the file, and read back for use when restoring the buffers. Attached is the new version of pg_hibernator, with updated code and README. Just a heads up for anyone who might have read/reviewed previous version's code, there's some unrelated trivial code and Makefile changes as well in this version, which can be easily spotted by a `diff -r`. Best regards, -- Gurjeet Singh http://gurjeet.singh.im/ EDB www.EnterpriseDB.com