diff options
author | Andres Freund <andres@anarazel.de> | 2017-12-13 12:51:32 -0800 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2017-12-13 13:27:41 -0800 |
commit | 923e8dee88ada071fe41541e83f121ead4baf7f8 (patch) | |
tree | bfffa54011b27a7b6eba176826e99e697a593d44 /src/backend/executor/execProcnode.c | |
parent | 884a60840cd684dd7925e7a4f9bf10288c37694d (diff) | |
download | postgresql-923e8dee88ada071fe41541e83f121ead4baf7f8.tar.gz postgresql-923e8dee88ada071fe41541e83f121ead4baf7f8.zip |
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're
trying 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 junk
file that has the next segment number. To defend against that, make sure we
always create a gap after the end file by unlinking the following name if it
exists. 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 code
that depends on an interface that we can't reliably provide.
Author: Thomas Munro
Reviewed-By: Andres Freund
Discussion: https://postgr.es/m/CAEepm%3D2jhCbC_GFQJaaDhWxLB4EXtT3vVd5czuRNaqF5CWSTog%40mail.gmail.com
Diffstat (limited to 'src/backend/executor/execProcnode.c')
0 files changed, 0 insertions, 0 deletions