postgresql/src/backend/commands
Andres Freund 5607e996f4 Flush unlogged table's buffers when copying or moving databases.
CREATE DATABASE and ALTER DATABASE .. SET TABLESPACE copy the source
database directory on the filesystem level. To ensure the on disk
state is consistent they block out users of the affected database and
force a checkpoint to flush out all data to disk. Unfortunately, up to
now, that checkpoint didn't flush out dirty buffers from unlogged
relations.

That bug means there could be leftover dirty buffers in either the
template database, or the database in its old location. Leading to
problems when accessing relations in an inconsistent state; and to
possible problems during shutdown in the SET TABLESPACE case because
buffers belonging files that don't exist anymore are flushed.

This was reported in bug #10675 by Maxim Boguk.

Fix by Pavan Deolasee, modified somewhat by me. Reviewed by MauMau and
Fujii Masao.

Backpatch to 9.1 where unlogged tables were introduced.
2014-10-20 23:45:20 +02:00
..
aggregatecmds.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
alter.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
analyze.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
async.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
cluster.c Don't allow relminmxid to go backwards during VACUUM FULL 2014-06-27 14:43:46 -04:00
collationcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
comment.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
constraint.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
conversioncmds.c Make various variables const (read-only). 2014-01-18 16:04:32 -05:00
copy.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
createas.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
dbcommands.c Flush unlogged table's buffers when copying or moving databases. 2014-10-20 23:45:20 +02:00
define.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
discard.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
dropcmds.c Make DROP IF EXISTS more consistently not fail 2014-01-23 14:40:29 -03:00
event_trigger.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
explain.c Print planning time only in EXPLAIN ANALYZE, not plain EXPLAIN. 2014-10-15 18:50:16 -04:00
extension.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
foreigncmds.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
functioncmds.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
indexcmds.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
lockcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
Makefile Add a materialized view relations. 2013-03-03 18:23:31 -06:00
matview.c Message improvements 2014-10-12 01:02:56 -04:00
opclasscmds.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
operatorcmds.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
portalcmds.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
prepare.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
proclang.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
schemacmds.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
seclabel.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
sequence.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
tablecmds.c Message improvements 2014-10-12 01:02:56 -04:00
tablespace.c Rework 'MOVE ALL' to 'ALTER .. ALL IN TABLESPACE' 2014-08-21 19:12:00 -04:00
trigger.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
tsearchcmds.c Update copyright for 2014 2014-01-07 16:05:30 -05:00
typecmds.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
user.c pgindent run for 9.4 2014-05-06 12:12:18 -04:00
vacuum.c Adjust cutoff points in newly-added sanity tests. 2014-07-21 12:58:44 -04:00
vacuumlazy.c Do all-visible handling in lazy_vacuum_page() outside its critical section. 2014-06-20 11:06:48 +02:00
variable.c Reject out-of-range numeric timezone specifications. 2014-07-21 22:41:23 -04:00
view.c Message improvements 2014-10-12 01:02:56 -04:00