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

Commit248c3a9

Browse files
committed
Clean up error handling in pg_basebackup's walmethods.c.
The error handling here was a mess, as a result of a fundamentallybad design (relying on errno to keep its value much longer than issafe to assume) as well as a lot of just plain sloppiness, both asto noticing errors at all and as to reporting the correct errno.Moreover, the recent addition of LZ4 compression broke thingscompletely, because liblz4 doesn't use errno to report errors.To improve matters, keep the error state in the DirectoryMethodData orTarMethodData struct, and add a string field so we can handle casesthat don't set errno. (The tar methods already had a version of this,but it can be done more efficiently since all these cases use aconstant error string.) Make the dir and tar methods handle errorsin basically identical ways, which they didn't before.This requires copying errno into the state struct in a lot of places,which is a bit tedious, but it has the virtue that we can get rid ofad-hoc code to save and restore errno in a number of places ... notto mention that it fixes other places that should've saved/restorederrno but neglected to.In passing, fix some pointlessly static buffers to be ordinarylocal variables.There remains an issue about exactly how to handle errors fromfsync(), but that seems like material for its own patch.While the LZ4 problems are new, all the rest of this is fixes forold bugs, so backpatch to v10 where walmethods.c was introduced.Patch by me; thanks to Michael Paquier for review.Discussion:https://postgr.es/m/1343113.1636489231@sss.pgh.pa.us
1 parent3cac2c8 commit248c3a9

File tree

1 file changed

+169
-66
lines changed

1 file changed

+169
-66
lines changed

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp