Restart after power outage: createdb - Mailing list pgsql-general

From Jon Lapham
Subject Restart after power outage: createdb
Date
Msg-id 451909AD.4080503@jandr.org
Whole thread Raw
Responses Re: Restart after power outage: createdb  (Jim Nasby <jim@nasby.net>)
List pgsql-general
While trying to reproduce power outage restart problem I reported
earlier, I have found something odd when pulling the plug on a VM during
a createdb operation.

If I run...
sleep 3; echo starting; createdb bar
...and power off the VM while the "createdb bar" is running.

Upon restart, about 50% of the time I can reproduce the following error
message:

[lapham@localhost ~]$ psql bar
psql: FATAL:  database "bar" does not exist
[lapham@localhost ~]$ createdb bar
createdb: database creation failed: ERROR: could not create directory
"base/65536": File exists
[lapham@localhost ~]$ createdb bar
CREATE DATABASE

So, running "createdb bar" a second time works.  This is probably not a
bug, but I thought I'd mention it anyway as it could potentially cause
problems for people running scripts.

--
-**-*-*---*-*---*-*---*-----*-*-----*---*-*---*-----*-----*-*-----*---
  Jon Lapham  <lapham@jandr.org>                Rio de Janeiro, Brasil
  Personal: http://www.jandr.org/
***-*--*----*-------*------------*--------------------*---------------


pgsql-general by date:

Previous
From: Florian Weimer
Date:
Subject: Re: Deadlock when one process opens two separate connections?
Next
From: "Harald Armin Massa"
Date:
Subject: Re: Restart after poweroutage