pgsql: Sync unlogged relations to disk after they have been reset.

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Sync unlogged relations to disk after they have been reset.
Date: 2014-11-15 00:34:22
Message-ID: E1XpRJm-0002k2-KN@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Sync unlogged relations to disk after they have been reset.

Unlogged relations are only reset when performing a unclean
restart. That means they have to be synced to disk during clean
shutdowns. During normal processing that's achieved by registering a
buffer's file to be fsynced at the next checkpoint when flushed. But
ResetUnloggedRelations() doesn't go through the buffer manager, so
nothing will force reset relations to disk before the next shutdown
checkpoint.

So just make ResetUnloggedRelations() fsync the newly created main
forks to disk.

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_4_STABLE

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

Modified Files
--------------
src/backend/storage/file/reinit.c | 47 +++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2014-11-15 00:34:27 pgsql: Backport "Expose fsync_fname as a public API".
Previous Message Andres Freund 2014-11-15 00:34:19 pgsql: Sync unlogged relations to disk after they have been reset.