pgsql: Ensure unlogged tables are reset even if crash recovery errors o

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Ensure unlogged tables are reset even if crash recovery errors o
Date: 2014-11-15 00:34:31
Message-ID: E1XpRJv-0002lY-FQ@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(dot)GA4984(at)alap3(dot)anarazel(dot)de

Backpatch to 9.1 where unlogged tables were introduced.

Abhijit Menon-Sen and Andres Freund

Branch
------
REL9_2_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/c5baa708fbae89c6d027d62be480f11660397289

Modified Files
--------------
src/backend/access/transam/xlog.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2014-11-15 00:34:34 pgsql: Sync unlogged relations to disk after they have been reset.
Previous Message Andres Freund 2014-11-15 00:34:27 pgsql: Sync unlogged relations to disk after they have been reset.