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

Commit6f79ae7

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 parenta859e64 commit6f79ae7

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
@@ -2317,7 +2317,10 @@ ReorderBufferSerializeChange(ReorderBuffer *rb, ReorderBufferTXN *txn,
23172317

23182318
if (write(fd,rb->outbuf,ondisk->size)!=ondisk->size)
23192319
{
2320+
intsave_errno=errno;
2321+
23202322
CloseTransientFile(fd);
2323+
errno=save_errno;
23212324
ereport(ERROR,
23222325
(errcode_for_file_access(),
23232326
errmsg("could not write to data file for XID %u: %m",
@@ -3070,7 +3073,8 @@ ApplyLogicalMappingFile(HTAB *tuplecid_data, Oid relid, const char *fname)
30703073
fd=OpenTransientFile(path,O_RDONLY |PG_BINARY,0);
30713074
if (fd<0)
30723075
ereport(ERROR,
3073-
(errmsg("could not open file \"%s\": %m",path)));
3076+
(errcode_for_file_access(),
3077+
errmsg("could not open file \"%s\": %m",path)));
30743078

30753079
while (true)
30763080
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp