forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit923e8de
committed
Add defenses against pre-crash files to BufFileOpenShared().
Crash restarts currently don't clean up temporary files, as a debugging aid.If a left-over file happens to have the same name as a segment file we'retrying to create, we'll just truncate and reuse it, but there is a problem:BufFileOpenShared() determines how many segment files exist by trying to open.0, .1, .2, ... until it finds no more files. It might be confused by a junkfile that has the next segment number. To defend against that, make sure wealways create a gap after the end file by unlinking the following name if itexists. Also make it an error to try to open a BufFile that doesn't exist(has no segment 0), so as not to encourage the development of client codethat depends on an interface that we can't reliably provide.Author: Thomas MunroReviewed-By: Andres FreundDiscussion:https://postgr.es/m/CAEepm%3D2jhCbC_GFQJaaDhWxLB4EXtT3vVd5czuRNaqF5CWSTog%40mail.gmail.com1 parent884a608 commit923e8de
1 file changed
+13
-1
lines changedLines changed: 13 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
211 | 211 |
| |
212 | 212 |
| |
213 | 213 |
| |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
214 | 224 |
| |
215 | 225 |
| |
216 | 226 |
| |
| |||
303 | 313 |
| |
304 | 314 |
| |
305 | 315 |
| |
306 |
| - | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
307 | 319 |
| |
308 | 320 |
| |
309 | 321 |
| |
|
0 commit comments
Comments
(0)