]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Ensure unlogged tables are reset even if crash recovery errors out.
authorAndres Freund <andres@anarazel.de>
Fri, 14 Nov 2014 17:20:59 +0000 (18:20 +0100)
committerAndres Freund <andres@anarazel.de>
Sat, 15 Nov 2014 00:21:02 +0000 (01:21 +0100)
commit672b43e68b41d405143e5a474acf882ed7c154f3
treee445115d570bbd3925f34e294a90c73de450ace8
parentc7299d32f64d09cfc1f586bdb7902b02259ff202
Ensure unlogged tables are reset even if crash recovery errors out.

Unlogged relations are reset at the end of crash recovery as they're
only synced to disk during a proper shutdown. Unfortunately that and
later steps can fail, e.g. due to running out of space. This reset
was, up to now performed after marking the database as having finished
crash recovery successfully. As out of space errors trigger a crash
restart that could lead to the situation that not all unlogged
relations are reset.

Once that happend usage of unlogged relations could yield errors like
"could not open file "...": No such file or directory". Luckily
clusters that show the problem can be fixed by performing a immediate
shutdown, and starting the database again.

To fix, just call ResetUnloggedRelations(UNLOGGED_RELATION_INIT)
earlier, before marking the database as having successfully recovered.

Discussion: 20140912112246.GA4984@alap3.anarazel.de

Backpatch to 9.1 where unlogged tables were introduced.

Abhijit Menon-Sen and Andres Freund
src/backend/access/transam/xlog.c