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

Commitac3aac3

Browse files
committed
reorderbuffer: preserve errno while reporting error
Clobbering errno during cleanup after an error is an oft-repeated, easyto make mistake. Deal with it here as everywhere else, by saving itaside and restoring after cleanup, before ereport'ing.In passing, add a missing errcode declaration in another ereport() callin the same file, which I noticed while skimming the file looking forsimilar problems.Backpatch to 9.4, where this code was introduced.
1 parentc4f1540 commitac3aac3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

‎src/backend/replication/logical/reorderbuffer.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2207,7 +2207,10 @@ ReorderBufferSerializeChange(ReorderBuffer *rb, ReorderBufferTXN *txn,
22072207

22082208
if (write(fd,rb->outbuf,ondisk->size)!=ondisk->size)
22092209
{
2210+
intsave_errno=errno;
2211+
22102212
CloseTransientFile(fd);
2213+
errno=save_errno;
22112214
ereport(ERROR,
22122215
(errcode_for_file_access(),
22132216
errmsg("could not write to data file for XID %u: %m",
@@ -2936,7 +2939,8 @@ ApplyLogicalMappingFile(HTAB *tuplecid_data, Oid relid, const char *fname)
29362939
fd=OpenTransientFile(path,O_RDONLY |PG_BINARY,0);
29372940
if (fd<0)
29382941
ereport(ERROR,
2939-
(errmsg("could not open file \"%s\": %m",path)));
2942+
(errcode_for_file_access(),
2943+
errmsg("could not open file \"%s\": %m",path)));
29402944

29412945
while (true)
29422946
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp