From: | Abhijit Menon-Sen <ams(at)2ndQuadrant(dot)com> |
---|---|
To: | Andres Freund <andres(at)2ndquadrant(dot)com> |
Cc: | Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: initdb -S and tablespaces |
Date: | 2015-01-15 05:32:43 |
Message-ID: | 20150115053243.GA29279@toroid.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
At 2015-01-14 11:59:08 +0100, andres(at)2ndquadrant(dot)com wrote:
>
> > + if (ControlFile->state != DB_SHUTDOWNED &&
> > + ControlFile->state != DB_SHUTDOWNED_IN_RECOVERY)
> > + perform_fsync(data_directory);
> > +
>
> a) Please think of a slightly more descriptive name than perform_fsync
OK. (I just copied the name initdb uses, because at the time I was still
thinking in terms of a later patch moving this to src/common.) What do
you think of fsync_recursively? fsync_pgdata?
I think fsync_recursively(data_directory) reads well.
> b) I think we should check here whether fsync is enabled.
OK, will do.
> c) I'm wondering if we should add fsync to the control file and also
> perform an fsync if the last shutdown was clear, but fsync was
> disabled.
Explain? "Add fsync to the control file" means store the value of the
fsync GUC setting in the control file? And would the fsync you mention
be dependent on the setting, or unconditional?
> > +static void
> > +pre_sync_fname(char *fname, bool isdir)
> > +{
>
> this essentially already exists in the backend inparts. C.f.
> pg_flush_data.
OK, I missed that. I'll rework the patch to use it.
> Theoretically you should also invoke fsync on directories.
OK.
> > + * We need to name the parent of PGDATA. get_parent_directory() isn't
> > + * enough here, because it can result in an empty string.
> > + */
> > + snprintf(pdir, MAXPGPATH, "%s/..", pg_data);
> > + canonicalize_path(pdir);
>
> Hm. Why is this neded? Just syncing . should work?
Not sure, will investigate.
Thanks.
-- Abhijit
From | Date | Subject | |
---|---|---|---|
Next Message | Craig Ringer | 2015-01-15 05:48:54 | Define and document a guaranteed ordering for RETURNING? |
Previous Message | Michael Paquier | 2015-01-15 05:30:00 | Re: pg_rewind in contrib |