Sync unlogged relations to disk after they have been reset.
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.GA4984@alap3.anarazel.de

Backpatch to 9.1 where unlogged tables were introduced.

Abhijit Menon-Sen and Andres Freund

xinzweb/gpdb,50wu/gpdb,ashwinstar/gpdb,jmcatamney/gpdb,ovr/postgres-xl,Postgres-XL/Postgres-XL,jmcatamney/gpdb,greenplum-db/gpdb,ovr/postgres-xl,xinzweb/gpdb,yazun/postgres-xl,jmcatamney/gpdb,50wu/gpdb,ovr/postgres-xl,oberstet/postgres-xl,lisakowen/gpdb,yazun/postgres-xl,jmcatamney/gpdb,Postgres-XL/Postgres-XL,oberstet/postgres-xl,lisakowen/gpdb,ovr/postgres-xl,greenplum-db/gpdb,pavanvd/postgres-xl,ashwinstar/gpdb,lisakowen/gpdb,zeroae/postgres-xl,lisakowen/gpdb,jmcatamney/gpdb,zeroae/postgres-xl,techdragon/Postgres-XL,greenplum-db/gpdb,xinzweb/gpdb,techdragon/Postgres-XL,xinzweb/gpdb,50wu/gpdb,pavanvd/postgres-xl,ashwinstar/gpdb,oberstet/postgres-xl,ovr/postgres-xl,greenplum-db/gpdb,pavanvd/postgres-xl,Postgres-XL/Postgres-XL,lisakowen/gpdb,50wu/gpdb,ashwinstar/gpdb,adam8157/gpdb,pavanvd/postgres-xl,zeroae/postgres-xl,xinzweb/gpdb,adam8157/gpdb,pavanvd/postgres-xl,techdragon/Postgres-XL,50wu/gpdb,zeroae/postgres-xl,yazun/postgres-xl,jmcatamney/gpdb,adam8157/gpdb,lisakowen/gpdb,yazun/postgres-xl,greenplum-db/gpdb,adam8157/gpdb,Postgres-XL/Postgres-XL,50wu/gpdb,oberstet/postgres-xl,oberstet/postgres-xl,lisakowen/gpdb,adam8157/gpdb,ashwinstar/gpdb,zeroae/postgres-xl,jmcatamney/gpdb,jmcatamney/gpdb,ashwinstar/gpdb,ashwinstar/gpdb,greenplum-db/gpdb,yazun/postgres-xl,techdragon/Postgres-XL,xinzweb/gpdb,xinzweb/gpdb,ashwinstar/gpdb,Postgres-XL/Postgres-XL,50wu/gpdb,xinzweb/gpdb,greenplum-db/gpdb,adam8157/gpdb,techdragon/Postgres-XL,greenplum-db/gpdb,50wu/gpdb,adam8157/gpdb,lisakowen/gpdb,adam8157/gpdb