Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit56df07b

Browse files
committed
Make more consistent some error messages for file-related operations
Some error messages which report something about a file operation useas well context which is already provided within the path being workedon, making things rather duplicated. This creates more work fortranslators, and does not actually bring clarity.More could be done, however in a lot of cases the context used isactually useful, still that patch gets down things with a good cut.Author: Michael PaquierReviewed-by: Kyotaro Horiguchi, Tom LaneDiscussion:https://postgr.es/m/20180718044711.GA8565@paquier.xyz
1 parent6b4d860 commit56df07b

File tree

3 files changed

+39
-34
lines changed

3 files changed

+39
-34
lines changed

‎contrib/pg_stat_statements/pg_stat_statements.c

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -642,19 +642,19 @@ pgss_shmem_startup(void)
642642
read_error:
643643
ereport(LOG,
644644
(errcode_for_file_access(),
645-
errmsg("could not readpg_stat_statementfile \"%s\": %m",
645+
errmsg("could not read file \"%s\": %m",
646646
PGSS_DUMP_FILE)));
647647
gotofail;
648648
data_error:
649649
ereport(LOG,
650650
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
651-
errmsg("ignoring invalid data inpg_stat_statementfile \"%s\"",
651+
errmsg("ignoring invalid data in file \"%s\"",
652652
PGSS_DUMP_FILE)));
653653
gotofail;
654654
write_error:
655655
ereport(LOG,
656656
(errcode_for_file_access(),
657-
errmsg("could not writepg_stat_statementfile \"%s\": %m",
657+
errmsg("could not write file \"%s\": %m",
658658
PGSS_TEXT_FILE)));
659659
fail:
660660
if (buffer)
@@ -761,7 +761,7 @@ pgss_shmem_shutdown(int code, Datum arg)
761761
error:
762762
ereport(LOG,
763763
(errcode_for_file_access(),
764-
errmsg("could not writepg_stat_statementfile \"%s\": %m",
764+
errmsg("could not write file \"%s\": %m",
765765
PGSS_DUMP_FILE".tmp")));
766766
if (qbuffer)
767767
free(qbuffer);
@@ -1871,7 +1871,7 @@ qtext_store(const char *query, int query_len,
18711871
error:
18721872
ereport(LOG,
18731873
(errcode_for_file_access(),
1874-
errmsg("could not writepg_stat_statementfile \"%s\": %m",
1874+
errmsg("could not write file \"%s\": %m",
18751875
PGSS_TEXT_FILE)));
18761876

18771877
if (fd >=0)
@@ -1913,7 +1913,7 @@ qtext_load_file(Size *buffer_size)
19131913
if (errno!=ENOENT)
19141914
ereport(LOG,
19151915
(errcode_for_file_access(),
1916-
errmsg("could not readpg_stat_statementfile \"%s\": %m",
1916+
errmsg("could not read file \"%s\": %m",
19171917
PGSS_TEXT_FILE)));
19181918
returnNULL;
19191919
}
@@ -1923,7 +1923,7 @@ qtext_load_file(Size *buffer_size)
19231923
{
19241924
ereport(LOG,
19251925
(errcode_for_file_access(),
1926-
errmsg("could not statpg_stat_statementfile \"%s\": %m",
1926+
errmsg("could not stat file \"%s\": %m",
19271927
PGSS_TEXT_FILE)));
19281928
CloseTransientFile(fd);
19291929
returnNULL;
@@ -1939,7 +1939,7 @@ qtext_load_file(Size *buffer_size)
19391939
ereport(LOG,
19401940
(errcode(ERRCODE_OUT_OF_MEMORY),
19411941
errmsg("out of memory"),
1942-
errdetail("Could not allocate enough memory to readpg_stat_statementfile \"%s\".",
1942+
errdetail("Could not allocate enough memory to read file \"%s\".",
19431943
PGSS_TEXT_FILE)));
19441944
CloseTransientFile(fd);
19451945
returnNULL;
@@ -1958,7 +1958,7 @@ qtext_load_file(Size *buffer_size)
19581958
if (errno)
19591959
ereport(LOG,
19601960
(errcode_for_file_access(),
1961-
errmsg("could not readpg_stat_statementfile \"%s\": %m",
1961+
errmsg("could not read file \"%s\": %m",
19621962
PGSS_TEXT_FILE)));
19631963
free(buf);
19641964
CloseTransientFile(fd);
@@ -2088,7 +2088,7 @@ gc_qtexts(void)
20882088
{
20892089
ereport(LOG,
20902090
(errcode_for_file_access(),
2091-
errmsg("could not writepg_stat_statementfile \"%s\": %m",
2091+
errmsg("could not write file \"%s\": %m",
20922092
PGSS_TEXT_FILE)));
20932093
gotogc_fail;
20942094
}
@@ -2118,7 +2118,7 @@ gc_qtexts(void)
21182118
{
21192119
ereport(LOG,
21202120
(errcode_for_file_access(),
2121-
errmsg("could not writepg_stat_statementfile \"%s\": %m",
2121+
errmsg("could not write file \"%s\": %m",
21222122
PGSS_TEXT_FILE)));
21232123
hash_seq_term(&hash_seq);
21242124
gotogc_fail;
@@ -2136,14 +2136,14 @@ gc_qtexts(void)
21362136
if (ftruncate(fileno(qfile),extent)!=0)
21372137
ereport(LOG,
21382138
(errcode_for_file_access(),
2139-
errmsg("could not truncatepg_stat_statementfile \"%s\": %m",
2139+
errmsg("could not truncate file \"%s\": %m",
21402140
PGSS_TEXT_FILE)));
21412141

21422142
if (FreeFile(qfile))
21432143
{
21442144
ereport(LOG,
21452145
(errcode_for_file_access(),
2146-
errmsg("could not writepg_stat_statementfile \"%s\": %m",
2146+
errmsg("could not write file \"%s\": %m",
21472147
PGSS_TEXT_FILE)));
21482148
qfile=NULL;
21492149
gotogc_fail;
@@ -2203,7 +2203,7 @@ gc_qtexts(void)
22032203
if (qfile==NULL)
22042204
ereport(LOG,
22052205
(errcode_for_file_access(),
2206-
errmsg("could notwrite new pg_stat_statement file \"%s\": %m",
2206+
errmsg("could notrecreate file \"%s\": %m",
22072207
PGSS_TEXT_FILE)));
22082208
else
22092209
FreeFile(qfile);
@@ -2255,7 +2255,7 @@ entry_reset(void)
22552255
{
22562256
ereport(LOG,
22572257
(errcode_for_file_access(),
2258-
errmsg("could not createpg_stat_statementfile \"%s\": %m",
2258+
errmsg("could not create file \"%s\": %m",
22592259
PGSS_TEXT_FILE)));
22602260
gotodone;
22612261
}
@@ -2264,7 +2264,7 @@ entry_reset(void)
22642264
if (ftruncate(fileno(qfile),0)!=0)
22652265
ereport(LOG,
22662266
(errcode_for_file_access(),
2267-
errmsg("could not truncatepg_stat_statementfile \"%s\": %m",
2267+
errmsg("could not truncate file \"%s\": %m",
22682268
PGSS_TEXT_FILE)));
22692269

22702270
FreeFile(qfile);

‎src/backend/access/transam/xlog.c

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3569,7 +3569,7 @@ XLogFileOpen(XLogSegNo segno)
35693569
if (fd<0)
35703570
ereport(PANIC,
35713571
(errcode_for_file_access(),
3572-
errmsg("could not openwrite-ahead logfile \"%s\": %m",path)));
3572+
errmsg("could not open file \"%s\": %m",path)));
35733573

35743574
returnfd;
35753575
}
@@ -3758,7 +3758,7 @@ XLogFileClose(void)
37583758
if (close(openLogFile))
37593759
ereport(PANIC,
37603760
(errcode_for_file_access(),
3761-
errmsg("could not closelogfile%s: %m",
3761+
errmsg("could not close file\"%s\": %m",
37623762
XLogFileNameP(ThisTimeLineID,openLogSegNo))));
37633763
openLogFile=-1;
37643764
}
@@ -4092,7 +4092,7 @@ RemoveXlogFile(const char *segname, XLogRecPtr PriorRedoPtr, XLogRecPtr endptr)
40924092
{
40934093
ereport(LOG,
40944094
(errcode_for_file_access(),
4095-
errmsg("could not renameold write-ahead logfile \"%s\": %m",
4095+
errmsg("could not rename file \"%s\": %m",
40964096
path)));
40974097
return;
40984098
}
@@ -4502,7 +4502,7 @@ WriteControlFile(void)
45024502
if (fd<0)
45034503
ereport(PANIC,
45044504
(errcode_for_file_access(),
4505-
errmsg("could not createcontrolfile \"%s\": %m",
4505+
errmsg("could not create file \"%s\": %m",
45064506
XLOG_CONTROL_FILE)));
45074507

45084508
errno=0;
@@ -4514,21 +4514,24 @@ WriteControlFile(void)
45144514
errno=ENOSPC;
45154515
ereport(PANIC,
45164516
(errcode_for_file_access(),
4517-
errmsg("could not write to control file: %m")));
4517+
errmsg("could not write to file \"%s\": %m",
4518+
XLOG_CONTROL_FILE)));
45184519
}
45194520
pgstat_report_wait_end();
45204521

45214522
pgstat_report_wait_start(WAIT_EVENT_CONTROL_FILE_SYNC);
45224523
if (pg_fsync(fd)!=0)
45234524
ereport(PANIC,
45244525
(errcode_for_file_access(),
4525-
errmsg("could not fsync control file: %m")));
4526+
errmsg("could not fsync file \"%s\": %m",
4527+
XLOG_CONTROL_FILE)));
45264528
pgstat_report_wait_end();
45274529

45284530
if (close(fd))
45294531
ereport(PANIC,
45304532
(errcode_for_file_access(),
4531-
errmsg("could not close control file: %m")));
4533+
errmsg("could not close file \"%s\": %m",
4534+
XLOG_CONTROL_FILE)));
45324535
}
45334536

45344537
staticvoid
@@ -4758,8 +4761,7 @@ UpdateControlFile(void)
47584761
if (fd<0)
47594762
ereport(PANIC,
47604763
(errcode_for_file_access(),
4761-
errmsg("could not open control file \"%s\": %m",
4762-
XLOG_CONTROL_FILE)));
4764+
errmsg("could not open file \"%s\": %m",XLOG_CONTROL_FILE)));
47634765

47644766
errno=0;
47654767
pgstat_report_wait_start(WAIT_EVENT_CONTROL_FILE_WRITE_UPDATE);
@@ -4770,21 +4772,24 @@ UpdateControlFile(void)
47704772
errno=ENOSPC;
47714773
ereport(PANIC,
47724774
(errcode_for_file_access(),
4773-
errmsg("could not write to control file: %m")));
4775+
errmsg("could not write to file \"%s\": %m",
4776+
XLOG_CONTROL_FILE)));
47744777
}
47754778
pgstat_report_wait_end();
47764779

47774780
pgstat_report_wait_start(WAIT_EVENT_CONTROL_FILE_SYNC_UPDATE);
47784781
if (pg_fsync(fd)!=0)
47794782
ereport(PANIC,
47804783
(errcode_for_file_access(),
4781-
errmsg("could not fsync control file: %m")));
4784+
errmsg("could not fsync file \"%s\": %m",
4785+
XLOG_CONTROL_FILE)));
47824786
pgstat_report_wait_end();
47834787

47844788
if (close(fd))
47854789
ereport(PANIC,
47864790
(errcode_for_file_access(),
4787-
errmsg("could not close control file: %m")));
4791+
errmsg("could not close file \"%s\": %m",
4792+
XLOG_CONTROL_FILE)));
47884793
}
47894794

47904795
/*
@@ -5684,7 +5689,7 @@ exitArchiveRecovery(TimeLineID endTLI, XLogRecPtr endOfLog)
56845689
if (close(fd))
56855690
ereport(ERROR,
56865691
(errcode_for_file_access(),
5687-
errmsg("could not closelogfile%s: %m",
5692+
errmsg("could not close file\"%s\": %m",
56885693
XLogFileNameP(ThisTimeLineID,startLogSegNo))));
56895694
}
56905695

@@ -10250,7 +10255,7 @@ assign_xlog_sync_method(int new_sync_method, void *extra)
1025010255
if (pg_fsync(openLogFile)!=0)
1025110256
ereport(PANIC,
1025210257
(errcode_for_file_access(),
10253-
errmsg("could not fsynclog segment %s: %m",
10258+
errmsg("could not fsyncfile \"%s\": %m",
1025410259
XLogFileNameP(ThisTimeLineID,openLogSegNo))));
1025510260
pgstat_report_wait_end();
1025610261
if (get_sync_bit(sync_method)!=get_sync_bit(new_sync_method))
@@ -10276,15 +10281,15 @@ issue_xlog_fsync(int fd, XLogSegNo segno)
1027610281
if (pg_fsync_no_writethrough(fd)!=0)
1027710282
ereport(PANIC,
1027810283
(errcode_for_file_access(),
10279-
errmsg("could not fsynclogfile%s: %m",
10284+
errmsg("could not fsync file\"%s\": %m",
1028010285
XLogFileNameP(ThisTimeLineID,segno))));
1028110286
break;
1028210287
#ifdefHAVE_FSYNC_WRITETHROUGH
1028310288
caseSYNC_METHOD_FSYNC_WRITETHROUGH:
1028410289
if (pg_fsync_writethrough(fd)!=0)
1028510290
ereport(PANIC,
1028610291
(errcode_for_file_access(),
10287-
errmsg("could not fsync write-throughlogfile%s: %m",
10292+
errmsg("could not fsync write-through file\"%s\": %m",
1028810293
XLogFileNameP(ThisTimeLineID,segno))));
1028910294
break;
1029010295
#endif
@@ -10293,7 +10298,7 @@ issue_xlog_fsync(int fd, XLogSegNo segno)
1029310298
if (pg_fdatasync(fd)!=0)
1029410299
ereport(PANIC,
1029510300
(errcode_for_file_access(),
10296-
errmsg("could not fdatasynclogfile%s: %m",
10301+
errmsg("could not fdatasync file\"%s\": %m",
1029710302
XLogFileNameP(ThisTimeLineID,segno))));
1029810303
break;
1029910304
#endif

‎src/bin/pg_basebackup/pg_recvlogical.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ OutputFsync(TimestampTz now)
197197
if (fsync(outfd)!=0)
198198
{
199199
fprintf(stderr,
200-
_("%s: could not fsynclogfile \"%s\": %s\n"),
200+
_("%s: could not fsync file \"%s\": %s\n"),
201201
progname,outfile,strerror(errno));
202202
return false;
203203
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp