diff options
author | Michael Paquier <michael@paquier.xyz> | 2018-07-23 09:19:12 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2018-07-23 09:19:12 +0900 |
commit | 56df07bb9e50a3ca4d148c537524f00bccc6650e (patch) | |
tree | 956caf698c1e2cfb5f7f88c03c48fa61ad313072 /src/backend/access/transam/xlog.c | |
parent | 6b4d860311e99621681f25db5db82f88348d8ea6 (diff) | |
download | postgresql-56df07bb9e50a3ca4d148c537524f00bccc6650e.tar.gz postgresql-56df07bb9e50a3ca4d148c537524f00bccc6650e.zip |
Make more consistent some error messages for file-related operations
Some error messages which report something about a file operation use
as well context which is already provided within the path being worked
on, making things rather duplicated. This creates more work for
translators, and does not actually bring clarity.
More could be done, however in a lot of cases the context used is
actually useful, still that patch gets down things with a good cut.
Author: Michael Paquier
Reviewed-by: Kyotaro Horiguchi, Tom Lane
Discussion: https://postgr.es/m/20180718044711.GA8565@paquier.xyz
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r-- | src/backend/access/transam/xlog.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 3ee6d5c4676..9f8ae9dc756 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -3569,7 +3569,7 @@ XLogFileOpen(XLogSegNo segno) if (fd < 0) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not open write-ahead log file \"%s\": %m", path))); + errmsg("could not open file \"%s\": %m", path))); return fd; } @@ -3758,7 +3758,7 @@ XLogFileClose(void) if (close(openLogFile)) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not close log file %s: %m", + errmsg("could not close file \"%s\": %m", XLogFileNameP(ThisTimeLineID, openLogSegNo)))); openLogFile = -1; } @@ -4092,7 +4092,7 @@ RemoveXlogFile(const char *segname, XLogRecPtr PriorRedoPtr, XLogRecPtr endptr) { ereport(LOG, (errcode_for_file_access(), - errmsg("could not rename old write-ahead log file \"%s\": %m", + errmsg("could not rename file \"%s\": %m", path))); return; } @@ -4502,7 +4502,7 @@ WriteControlFile(void) if (fd < 0) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not create control file \"%s\": %m", + errmsg("could not create file \"%s\": %m", XLOG_CONTROL_FILE))); errno = 0; @@ -4514,7 +4514,8 @@ WriteControlFile(void) errno = ENOSPC; ereport(PANIC, (errcode_for_file_access(), - errmsg("could not write to control file: %m"))); + errmsg("could not write to file \"%s\": %m", + XLOG_CONTROL_FILE))); } pgstat_report_wait_end(); @@ -4522,13 +4523,15 @@ WriteControlFile(void) if (pg_fsync(fd) != 0) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not fsync control file: %m"))); + errmsg("could not fsync file \"%s\": %m", + XLOG_CONTROL_FILE))); pgstat_report_wait_end(); if (close(fd)) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not close control file: %m"))); + errmsg("could not close file \"%s\": %m", + XLOG_CONTROL_FILE))); } static void @@ -4758,8 +4761,7 @@ UpdateControlFile(void) if (fd < 0) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not open control file \"%s\": %m", - XLOG_CONTROL_FILE))); + errmsg("could not open file \"%s\": %m", XLOG_CONTROL_FILE))); errno = 0; pgstat_report_wait_start(WAIT_EVENT_CONTROL_FILE_WRITE_UPDATE); @@ -4770,7 +4772,8 @@ UpdateControlFile(void) errno = ENOSPC; ereport(PANIC, (errcode_for_file_access(), - errmsg("could not write to control file: %m"))); + errmsg("could not write to file \"%s\": %m", + XLOG_CONTROL_FILE))); } pgstat_report_wait_end(); @@ -4778,13 +4781,15 @@ UpdateControlFile(void) if (pg_fsync(fd) != 0) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not fsync control file: %m"))); + errmsg("could not fsync file \"%s\": %m", + XLOG_CONTROL_FILE))); pgstat_report_wait_end(); if (close(fd)) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not close control file: %m"))); + errmsg("could not close file \"%s\": %m", + XLOG_CONTROL_FILE))); } /* @@ -5684,7 +5689,7 @@ exitArchiveRecovery(TimeLineID endTLI, XLogRecPtr endOfLog) if (close(fd)) ereport(ERROR, (errcode_for_file_access(), - errmsg("could not close log file %s: %m", + errmsg("could not close file \"%s\": %m", XLogFileNameP(ThisTimeLineID, startLogSegNo)))); } @@ -10250,7 +10255,7 @@ assign_xlog_sync_method(int new_sync_method, void *extra) if (pg_fsync(openLogFile) != 0) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not fsync log segment %s: %m", + errmsg("could not fsync file \"%s\": %m", XLogFileNameP(ThisTimeLineID, openLogSegNo)))); pgstat_report_wait_end(); if (get_sync_bit(sync_method) != get_sync_bit(new_sync_method)) @@ -10276,7 +10281,7 @@ issue_xlog_fsync(int fd, XLogSegNo segno) if (pg_fsync_no_writethrough(fd) != 0) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not fsync log file %s: %m", + errmsg("could not fsync file \"%s\": %m", XLogFileNameP(ThisTimeLineID, segno)))); break; #ifdef HAVE_FSYNC_WRITETHROUGH @@ -10284,7 +10289,7 @@ issue_xlog_fsync(int fd, XLogSegNo segno) if (pg_fsync_writethrough(fd) != 0) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not fsync write-through log file %s: %m", + errmsg("could not fsync write-through file \"%s\": %m", XLogFileNameP(ThisTimeLineID, segno)))); break; #endif @@ -10293,7 +10298,7 @@ issue_xlog_fsync(int fd, XLogSegNo segno) if (pg_fdatasync(fd) != 0) ereport(PANIC, (errcode_for_file_access(), - errmsg("could not fdatasync log file %s: %m", + errmsg("could not fdatasync file \"%s\": %m", XLogFileNameP(ThisTimeLineID, segno)))); break; #endif |