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

Commit396e4af

Browse files
committed
Better error messages for short reads/writes in SLRU
This avoids getting a Could not read from file ...: Success.for a short read or write (since errno is not set in that case).Instead, report a more specific error messages.Reviewed-by: Michael Paquier <michael@paquier.xyz>Discussion:https://www.postgresql.org/message-id/flat/5de61b6b-8be9-7771-0048-860328efe027%402ndquadrant.com
1 parent4e72a8e commit396e4af

File tree

1 file changed

+21
-10
lines changed
  • src/backend/access/transam

1 file changed

+21
-10
lines changed

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

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -920,18 +920,29 @@ SlruReportIOError(SlruCtl ctl, int pageno, TransactionId xid)
920920
path,offset)));
921921
break;
922922
caseSLRU_READ_FAILED:
923-
ereport(ERROR,
924-
(errcode_for_file_access(),
925-
errmsg("could not access status of transaction %u",xid),
926-
errdetail("Could not read from file \"%s\" at offset %u: %m.",
927-
path,offset)));
923+
if (errno)
924+
ereport(ERROR,
925+
(errcode_for_file_access(),
926+
errmsg("could not access status of transaction %u",xid),
927+
errdetail("Could not read from file \"%s\" at offset %u: %m.",
928+
path,offset)));
929+
else
930+
ereport(ERROR,
931+
(errmsg("could not access status of transaction %u",xid),
932+
errdetail("Could not read from file \"%s\" at offset %u: read too few bytes.",path,offset)));
928933
break;
929934
caseSLRU_WRITE_FAILED:
930-
ereport(ERROR,
931-
(errcode_for_file_access(),
932-
errmsg("could not access status of transaction %u",xid),
933-
errdetail("Could not write to file \"%s\" at offset %u: %m.",
934-
path,offset)));
935+
if (errno)
936+
ereport(ERROR,
937+
(errcode_for_file_access(),
938+
errmsg("could not access status of transaction %u",xid),
939+
errdetail("Could not write to file \"%s\" at offset %u: %m.",
940+
path,offset)));
941+
else
942+
ereport(ERROR,
943+
(errmsg("could not access status of transaction %u",xid),
944+
errdetail("Could not write to file \"%s\" at offset %u: wrote too few bytes.",
945+
path,offset)));
935946
break;
936947
caseSLRU_FSYNC_FAILED:
937948
ereport(data_sync_elevel(ERROR),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp