pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Recursively fsync() the data directory after a crash.
19+ messages / 7 participants
[nested] [flat]

* pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-04 18:23  Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 19+ messages in thread

From: Robert Haas @ 2015-05-04 18:23 UTC (permalink / raw)
  To: pgsql-committers

Recursively fsync() the data directory after a crash.

Otherwise, if there's another crash, some writes from after the first
crash might make it to disk while writes from before the crash fail
to make it to disk.  This could lead to data corruption.

Back-patch to all supported versions.

Abhijit Menon-Sen, reviewed by Andres Freund and slightly revised
by me.

Branch
------
REL9_0_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/30ba0d0c21a825bc9c0565ea331be98068536b0e

Modified Files
--------------
src/backend/access/transam/xlog.c |   41 +++++++++++++
src/backend/storage/file/fd.c     |  115 +++++++++++++++++++++++++++++++++++++
src/backend/utils/misc/guc.c      |    2 +-
src/include/storage/fd.h          |    2 +
src/include/utils/guc.h           |    1 +
5 files changed, 160 insertions(+), 1 deletion(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 19+ messages in thread

* pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-04 18:23  Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 19+ messages in thread

From: Robert Haas @ 2015-05-04 18:23 UTC (permalink / raw)
  To: pgsql-committers

Recursively fsync() the data directory after a crash.

Otherwise, if there's another crash, some writes from after the first
crash might make it to disk while writes from before the crash fail
to make it to disk.  This could lead to data corruption.

Back-patch to all supported versions.

Abhijit Menon-Sen, reviewed by Andres Freund and slightly revised
by me.

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/2bc3397168580a28a1f072bec46d395f4eb54c08

Modified Files
--------------
src/backend/access/transam/xlog.c |   41 +++++++++++++
src/backend/storage/file/fd.c     |  115 +++++++++++++++++++++++++++++++++++++
src/include/storage/fd.h          |    2 +
3 files changed, 158 insertions(+)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 19+ messages in thread

* pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-04 18:23  Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 19+ messages in thread

From: Robert Haas @ 2015-05-04 18:23 UTC (permalink / raw)
  To: pgsql-committers

Recursively fsync() the data directory after a crash.

Otherwise, if there's another crash, some writes from after the first
crash might make it to disk while writes from before the crash fail
to make it to disk.  This could lead to data corruption.

Back-patch to all supported versions.

Abhijit Menon-Sen, reviewed by Andres Freund and slightly revised
by me.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/d8ac77ab178ddb2ae043b8c463cd30c031e793d0

Modified Files
--------------
src/backend/access/transam/xlog.c |   42 ++++++++++++++
src/backend/storage/file/fd.c     |  115 +++++++++++++++++++++++++++++++++++++
src/include/storage/fd.h          |    2 +
3 files changed, 159 insertions(+)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 19+ messages in thread

* pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-04 18:23  Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 19+ messages in thread

From: Robert Haas @ 2015-05-04 18:23 UTC (permalink / raw)
  To: pgsql-committers

Recursively fsync() the data directory after a crash.

Otherwise, if there's another crash, some writes from after the first
crash might make it to disk while writes from before the crash fail
to make it to disk.  This could lead to data corruption.

Back-patch to all supported versions.

Abhijit Menon-Sen, reviewed by Andres Freund and slightly revised
by me.

Branch
------
REL9_1_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/4b71d28d586fa9af55713a0652614e64027789a7

Modified Files
--------------
src/backend/access/transam/xlog.c |   41 +++++++++++++
src/backend/storage/file/fd.c     |  115 +++++++++++++++++++++++++++++++++++++
src/include/storage/fd.h          |    2 +
3 files changed, 158 insertions(+)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 19+ messages in thread

* pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-04 18:23  Robert Haas <rhaas@postgresql.org>
  0 siblings, 0 replies; 19+ messages in thread

From: Robert Haas @ 2015-05-04 18:23 UTC (permalink / raw)
  To: pgsql-committers

Recursively fsync() the data directory after a crash.

Otherwise, if there's another crash, some writes from after the first
crash might make it to disk while writes from before the crash fail
to make it to disk.  This could lead to data corruption.

Back-patch to all supported versions.

Abhijit Menon-Sen, reviewed by Andres Freund and slightly revised
by me.

Branch
------
REL9_3_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/14de825dee324cb6b1e8298ee845e1134edcc33e

Modified Files
--------------
src/backend/access/transam/xlog.c |   42 ++++++++++++++
src/backend/storage/file/fd.c     |  115 +++++++++++++++++++++++++++++++++++++
src/include/storage/fd.h          |    2 +
3 files changed, 159 insertions(+)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 19+ messages in thread

* pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-04 18:23  Robert Haas <rhaas@postgresql.org>
  0 siblings, 2 replies; 19+ messages in thread

From: Robert Haas @ 2015-05-04 18:23 UTC (permalink / raw)
  To: pgsql-committers

Recursively fsync() the data directory after a crash.

Otherwise, if there's another crash, some writes from after the first
crash might make it to disk while writes from before the crash fail
to make it to disk.  This could lead to data corruption.

Back-patch to all supported versions.

Abhijit Menon-Sen, reviewed by Andres Freund and slightly revised
by me.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/2ce439f3379aed857517c8ce207485655000fc8e

Modified Files
--------------
src/backend/access/transam/xlog.c |   42 ++++++++++++++
src/backend/storage/file/fd.c     |  115 +++++++++++++++++++++++++++++++++++++
src/include/storage/fd.h          |    2 +
3 files changed, 159 insertions(+)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 19+ messages in thread

* Re: pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-05 03:37  Andrew Dunstan <andrew@dunslane.net>
  parent: Robert Haas <rhaas@postgresql.org>
  1 sibling, 1 reply; 19+ messages in thread

From: Andrew Dunstan @ 2015-05-05 03:37 UTC (permalink / raw)
  To: Robert Haas <rhaas@postgresql.org>; pgsql-committers


On 05/04/2015 02:23 PM, Robert Haas wrote:
> Recursively fsync() the data directory after a crash.
>
> Otherwise, if there's another crash, some writes from after the first
> crash might make it to disk while writes from before the crash fail
> to make it to disk.  This could lead to data corruption.
>
> Back-patch to all supported versions.
>

This appears to have broken Windows builds. At least it's broken by 
using the two argument form of open instead of the three argument form, 
for which we have a #define in the win32 case, and pg_win32_is_junction 
is a typo - the first _ should not be there.

cheers

andrew


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 19+ messages in thread

* Re: pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-05 13:17  Robert Haas <robertmhaas@gmail.com>
  parent: Andrew Dunstan <andrew@dunslane.net>
  0 siblings, 0 replies; 19+ messages in thread

From: Robert Haas @ 2015-05-05 13:17 UTC (permalink / raw)
  To: Andrew Dunstan <andrew@dunslane.net>; +Cc: pgsql-committers

On Mon, May 4, 2015 at 11:37 PM, Andrew Dunstan <andrew@dunslane.net> wrote:
> On 05/04/2015 02:23 PM, Robert Haas wrote:
>> Recursively fsync() the data directory after a crash.
>>
>> Otherwise, if there's another crash, some writes from after the first
>> crash might make it to disk while writes from before the crash fail
>> to make it to disk.  This could lead to data corruption.
>>
>> Back-patch to all supported versions.
>>
>
> This appears to have broken Windows builds. At least it's broken by using
> the two argument form of open instead of the three argument form, for which
> we have a #define in the win32 case, and pg_win32_is_junction is a typo -
> the first _ should not be there.

Sorry about that.  Working on it now.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 19+ messages in thread

* Re: pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-18 01:44  Peter Eisentraut <peter_e@gmx.net>
  parent: Robert Haas <rhaas@postgresql.org>
  1 sibling, 1 reply; 19+ messages in thread

From: Peter Eisentraut @ 2015-05-18 01:44 UTC (permalink / raw)
  To: Robert Haas <rhaas@postgresql.org>; pgsql-committers

On 5/4/15 2:23 PM, Robert Haas wrote:
> Recursively fsync() the data directory after a crash.
> 
> Otherwise, if there's another crash, some writes from after the first
> crash might make it to disk while writes from before the crash fail
> to make it to disk.  This could lead to data corruption.

If there a reason why in pre_sync_fname(), the error message does not
contain a %m?



-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 19+ messages in thread

* Re: pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-18 12:01  Robert Haas <robertmhaas@gmail.com>
  parent: Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 1 reply; 19+ messages in thread

From: Robert Haas @ 2015-05-18 12:01 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-committers

On Sun, May 17, 2015 at 9:44 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
> On 5/4/15 2:23 PM, Robert Haas wrote:
>> Recursively fsync() the data directory after a crash.
>>
>> Otherwise, if there's another crash, some writes from after the first
>> crash might make it to disk while writes from before the crash fail
>> to make it to disk.  This could lead to data corruption.
>
> If there a reason why in pre_sync_fname(), the error message does not
> contain a %m?

For consistency with the rest of the file, I suppose.  Not sure why
it's like that, but all the functions in the file do it that way.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 19+ messages in thread

* Re: pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-18 15:04  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 19+ messages in thread

From: Tom Lane @ 2015-05-18 15:04 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Peter Eisentraut <peter_e@gmx.net>; pgsql-committers

Robert Haas <robertmhaas@gmail.com> writes:
> On Sun, May 17, 2015 at 9:44 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
>> If there a reason why in pre_sync_fname(), the error message does not
>> contain a %m?

> For consistency with the rest of the file, I suppose.  Not sure why
> it's like that, but all the functions in the file do it that way.

Huh?  All the ones that are reporting kernel call failures certainly
have %m.

			regards, tom lane


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 19+ messages in thread

* Re: pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-18 16:04  Robert Haas <robertmhaas@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 19+ messages in thread

From: Robert Haas @ 2015-05-18 16:04 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Peter Eisentraut <peter_e@gmx.net>; pgsql-committers

On Mon, May 18, 2015 at 11:04 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> On Sun, May 17, 2015 at 9:44 PM, Peter Eisentraut <peter_e@gmx.net> wrote:
>>> If there a reason why in pre_sync_fname(), the error message does not
>>> contain a %m?
>
>> For consistency with the rest of the file, I suppose.  Not sure why
>> it's like that, but all the functions in the file do it that way.
>
> Huh?  All the ones that are reporting kernel call failures certainly
> have %m.

Oops, you're right.  I was looking at the wrong code.  Yeah, that
should probably be fixed.  I'm not sure it's a good idea to do that
right now though.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 19+ messages in thread

* Re: pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-18 16:15  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 19+ messages in thread

From: Tom Lane @ 2015-05-18 16:15 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: pgsql-committers

Robert Haas <robertmhaas@gmail.com> writes:
> On Mon, May 18, 2015 at 11:04 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Huh?  All the ones that are reporting kernel call failures certainly
>> have %m.

> Oops, you're right.  I was looking at the wrong code.  Yeah, that
> should probably be fixed.  I'm not sure it's a good idea to do that
> right now though.

It's a trivial enough change that I wouldn't see a problem with doing it
now.  But if you do, please get it in by say 2PM EDT.

			regards, tom lane


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 19+ messages in thread

* Re: pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-18 16:22  Bruce Momjian <bruce@momjian.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 19+ messages in thread

From: Bruce Momjian @ 2015-05-18 16:22 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Robert Haas <robertmhaas@gmail.com>; pgsql-committers

On Mon, May 18, 2015 at 12:15:03PM -0400, Tom Lane wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
> > On Mon, May 18, 2015 at 11:04 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> Huh?  All the ones that are reporting kernel call failures certainly
> >> have %m.
> 
> > Oops, you're right.  I was looking at the wrong code.  Yeah, that
> > should probably be fixed.  I'm not sure it's a good idea to do that
> > right now though.
> 
> It's a trivial enough change that I wouldn't see a problem with doing it
> now.  But if you do, please get it in by say 2PM EDT.

Uh, doesn't that change the translated strings?  Is that a problem?

-- 
  Bruce Momjian  <bruce@momjian.us>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + Everyone has their own god. +


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 19+ messages in thread

* Re: pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-18 16:39  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 19+ messages in thread

From: Tom Lane @ 2015-05-18 16:39 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; +Cc: Robert Haas <robertmhaas@gmail.com>; pgsql-committers

Bruce Momjian <bruce@momjian.us> writes:
> On Mon, May 18, 2015 at 12:15:03PM -0400, Tom Lane wrote:
>> It's a trivial enough change that I wouldn't see a problem with doing it
>> now.  But if you do, please get it in by say 2PM EDT.

> Uh, doesn't that change the translated strings?  Is that a problem?

Better an untranslated message than a translated one that lacks critical
info.  But anyway, there are likely other instances of that same string
*with* %m ...

			regards, tom lane


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 19+ messages in thread

* Re: pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-18 16:43  Robert Haas <robertmhaas@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 19+ messages in thread

From: Robert Haas @ 2015-05-18 16:43 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Bruce Momjian <bruce@momjian.us>; pgsql-committers

On Mon, May 18, 2015 at 12:39 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Bruce Momjian <bruce@momjian.us> writes:
>> On Mon, May 18, 2015 at 12:15:03PM -0400, Tom Lane wrote:
>>> It's a trivial enough change that I wouldn't see a problem with doing it
>>> now.  But if you do, please get it in by say 2PM EDT.
>
>> Uh, doesn't that change the translated strings?  Is that a problem?
>
> Better an untranslated message than a translated one that lacks critical
> info.  But anyway, there are likely other instances of that same string
> *with* %m ...

Probably not, because of the way the message is worded.  But we could do this:

inline patch 1: src/backend/storage/file/fd.c (+0/-1 lines) download inline-1.patchdiff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c index 6fa75d1..bed8478 100644 --- a/src/backend/storage/file/fd.c +++ b/src/backend/storage/file/fd.c @@ -2461,7 +2461,7 @@ pre_sync_fname(char *fname, bool isdir) if (fd < 0) ereport(FATAL, - (errmsg("could not open file \"%s\"
before fsync", + (errmsg("could not open file \"%s\": %m", fname))); pg_flush_data(fd, 0, 0); Does that sound good? -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 19+ messages in thread

* Re: pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-18 16:51  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Robert Haas <robertmhaas@gmail.com>
  1 sibling, 0 replies; 19+ messages in thread

From: Tom Lane @ 2015-05-18 16:51 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Bruce Momjian <bruce@momjian.us>; pgsql-committers

Robert Haas <robertmhaas@gmail.com> writes:
> On Mon, May 18, 2015 at 12:39 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Better an untranslated message than a translated one that lacks critical
>> info.  But anyway, there are likely other instances of that same string
>> *with* %m ...

> Probably not, because of the way the message is worded.  But we could do this:

> diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
> index 6fa75d1..bed8478 100644
> --- a/src/backend/storage/file/fd.c
> +++ b/src/backend/storage/file/fd.c
> @@ -2461,7 +2461,7 @@ pre_sync_fname(char *fname, bool isdir)

>         if (fd < 0)
>                 ereport(FATAL,
> -                               (errmsg("could not open file \"%s\"
> before fsync",
> +                               (errmsg("could not open file \"%s\": %m",
>                                                 fname)));

>         pg_flush_data(fd, 0, 0);

> Does that sound good?

Works for me.  The file/line info for the message would provide the
"before fsync" context anyway, if someone needed it.

			regards, tom lane


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 19+ messages in thread

* Re: pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-18 17:00  Alvaro Herrera <alvherre@2ndquadrant.com>
  parent: Robert Haas <robertmhaas@gmail.com>
  1 sibling, 1 reply; 19+ messages in thread

From: Alvaro Herrera @ 2015-05-18 17:00 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Bruce Momjian <bruce@momjian.us>; pgsql-committers

Robert Haas wrote:
> On Mon, May 18, 2015 at 12:39 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> >> Uh, doesn't that change the translated strings?  Is that a problem?
> >
> > Better an untranslated message than a translated one that lacks critical
> > info.  But anyway, there are likely other instances of that same string
> > *with* %m ...
> 
> Probably not, because of the way the message is worded.  But we could do this:
> 
> diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
> index 6fa75d1..bed8478 100644
> --- a/src/backend/storage/file/fd.c
> +++ b/src/backend/storage/file/fd.c
> @@ -2461,7 +2461,7 @@ pre_sync_fname(char *fname, bool isdir)
> 
>         if (fd < 0)
>                 ereport(FATAL,
> -                               (errmsg("could not open file \"%s\"
> before fsync",
> +                               (errmsg("could not open file \"%s\": %m",
>                                                 fname)));
> 
>         pg_flush_data(fd, 0, 0);
> 
> Does that sound good?

+1.  It's not like the extra two words of context would be of much use
anyway.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 19+ messages in thread

* Re: pgsql: Recursively fsync() the data directory after a crash.
@ 2015-05-18 17:18  Robert Haas <robertmhaas@gmail.com>
  parent: Alvaro Herrera <alvherre@2ndquadrant.com>
  0 siblings, 0 replies; 19+ messages in thread

From: Robert Haas @ 2015-05-18 17:18 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Bruce Momjian <bruce@momjian.us>; pgsql-committers

On Mon, May 18, 2015 at 1:00 PM, Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:
> Robert Haas wrote:
>> On Mon, May 18, 2015 at 12:39 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
>> >> Uh, doesn't that change the translated strings?  Is that a problem?
>> >
>> > Better an untranslated message than a translated one that lacks critical
>> > info.  But anyway, there are likely other instances of that same string
>> > *with* %m ...
>>
>> Probably not, because of the way the message is worded.  But we could do this:
>>
>> diff --git a/src/backend/storage/file/fd.c b/src/backend/storage/file/fd.c
>> index 6fa75d1..bed8478 100644
>> --- a/src/backend/storage/file/fd.c
>> +++ b/src/backend/storage/file/fd.c
>> @@ -2461,7 +2461,7 @@ pre_sync_fname(char *fname, bool isdir)
>>
>>         if (fd < 0)
>>                 ereport(FATAL,
>> -                               (errmsg("could not open file \"%s\"
>> before fsync",
>> +                               (errmsg("could not open file \"%s\": %m",
>>                                                 fname)));
>>
>>         pg_flush_data(fd, 0, 0);
>>
>> Does that sound good?
>
> +1.  It's not like the extra two words of context would be of much use
> anyway.

Done.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 19+ messages in thread


end of thread, other threads:[~2015-05-18 17:18 UTC | newest]

Thread overview: 19+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-05-04 18:23 pgsql: Recursively fsync() the data directory after a crash. Robert Haas <rhaas@postgresql.org>
2015-05-05 03:37 ` Andrew Dunstan <andrew@dunslane.net>
2015-05-05 13:17   ` Robert Haas <robertmhaas@gmail.com>
2015-05-18 01:44 ` Peter Eisentraut <peter_e@gmx.net>
2015-05-18 12:01   ` Robert Haas <robertmhaas@gmail.com>
2015-05-18 15:04     ` Tom Lane <tgl@sss.pgh.pa.us>
2015-05-18 16:04       ` Robert Haas <robertmhaas@gmail.com>
2015-05-18 16:15         ` Tom Lane <tgl@sss.pgh.pa.us>
2015-05-18 16:22           ` Bruce Momjian <bruce@momjian.us>
2015-05-18 16:39             ` Tom Lane <tgl@sss.pgh.pa.us>
2015-05-18 16:43               ` Robert Haas <robertmhaas@gmail.com>
2015-05-18 16:51                 ` Tom Lane <tgl@sss.pgh.pa.us>
2015-05-18 17:00                 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2015-05-18 17:18                   ` Robert Haas <robertmhaas@gmail.com>
2015-05-04 18:23 pgsql: Recursively fsync() the data directory after a crash. Robert Haas <rhaas@postgresql.org>
2015-05-04 18:23 pgsql: Recursively fsync() the data directory after a crash. Robert Haas <rhaas@postgresql.org>
2015-05-04 18:23 pgsql: Recursively fsync() the data directory after a crash. Robert Haas <rhaas@postgresql.org>
2015-05-04 18:23 pgsql: Recursively fsync() the data directory after a crash. Robert Haas <rhaas@postgresql.org>
2015-05-04 18:23 pgsql: Recursively fsync() the data directory after a crash. Robert Haas <rhaas@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox