Force a checkpoint in CREATE DATABASE before starting to copy the files,

Heikki Linnakangas <heikki.linnakangas@iki.fi>

Commit: 95f3c355bd0c2f6d4bbd4314cdf14b8019d03892
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2008-10-09T10:34:22Z
Releases: 8.3.5
Force a checkpoint in CREATE DATABASE before starting to copy the files,
to process any pending unlinks for the source database.

Before, if you dropped a relation in the template database just before
CREATE DATABASE, and a checkpoint happened during copydir(), the checkpoint
might delete a file that we're just about to copy, causing lstat() in
copydir() to fail with ENOENT.

Backpatch to 8.3, where the pending unlinks were introduced.

Per report by Matthew Wakeling and analysis by Tom Lane.

Files

PathChange+/−
src/backend/commands/dbcommands.c modified +9 −4