forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit81f3d3b
committed
Fix fsync-at-startup code to not treat errors as fatal.
Commit2ce439f introduced a rather seriousregression, namely that if its scan of the data directory came across anyun-fsync-able files, it would fail and thereby prevent database startup.Worse yet, symlinks to such files also caused the problem, which meant thatcrash restart was guaranteed to fail on certain common installations suchas older Debian.After discussion, we agreed that (1) failure to start is worse than anyconsequence of not fsync'ing is likely to be, therefore treat all errorsin this code as nonfatal; (2) we should not chase symlinks other thanthose that are expected to exist, namely pg_xlog/ and tablespace linksunder pg_tblspc/. The latter restriction avoids possibly fsync'ing amuch larger part of the filesystem than intended, if the user has leftrandom symlinks hanging about in the data directory.This commit takes care of that and also does some code beautification,mainly moving the relevant code into fd.c, which seems a much better placefor it than xlog.c, and making sure that the conditional compilation forthe pre_sync_fname pass has something to do with whether pg_flush_dataworks.I also relocated the call site in xlog.c down a few lines; it seems abit silly to be doing this before ValidateXLOGDirectoryStructure().The similar logic in initdb.c ought to be made to match this, but thatchange is noncritical and will be dealt with separately.Back-patch to all active branches, like the prior commit.Abhijit Menon-Sen and Tom Lane1 parent27bae8d commit81f3d3b
3 files changed
+254
-111
lines changedLines changed: 12 additions & 42 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
696 | 696 |
| |
697 | 697 |
| |
698 | 698 |
| |
699 |
| - | |
700 |
| - | |
701 | 699 |
| |
702 | 700 |
| |
703 | 701 |
| |
| |||
5015 | 5013 |
| |
5016 | 5014 |
| |
5017 | 5015 |
| |
5018 |
| - | |
5019 |
| - | |
5020 |
| - | |
5021 |
| - | |
5022 |
| - | |
5023 |
| - | |
5024 |
| - | |
5025 |
| - | |
5026 |
| - | |
5027 |
| - | |
5028 |
| - | |
5029 |
| - | |
5030 | 5016 |
| |
5031 | 5017 |
| |
5032 | 5018 |
| |
| |||
5050 | 5036 |
| |
5051 | 5037 |
| |
5052 | 5038 |
| |
| 5039 | + | |
| 5040 | + | |
| 5041 | + | |
| 5042 | + | |
| 5043 | + | |
| 5044 | + | |
| 5045 | + | |
| 5046 | + | |
| 5047 | + | |
| 5048 | + | |
| 5049 | + | |
| 5050 | + | |
5053 | 5051 |
| |
5054 | 5052 |
| |
5055 | 5053 |
| |
| |||
10193 | 10191 |
| |
10194 | 10192 |
| |
10195 | 10193 |
| |
10196 |
| - | |
10197 |
| - | |
10198 |
| - | |
10199 |
| - | |
10200 |
| - | |
10201 |
| - | |
10202 |
| - | |
10203 |
| - | |
10204 |
| - | |
10205 |
| - | |
10206 |
| - | |
10207 |
| - | |
10208 |
| - | |
10209 |
| - | |
10210 |
| - | |
10211 |
| - | |
10212 |
| - | |
10213 |
| - | |
10214 |
| - | |
10215 |
| - | |
10216 |
| - | |
10217 |
| - | |
10218 |
| - | |
10219 |
| - | |
10220 |
| - | |
10221 |
| - | |
10222 |
| - | |
10223 |
| - |
0 commit comments
Comments
(0)