Bug 174020 - databases/postgresql92-server: initdb will not run on a mounted FS with a snapshot directory
Summary: databases/postgresql92-server: initdb will not run on a mounted FS with a sna...
Status: Closed Feedback Timeout
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: VK
URL:
Keywords: needs-patch, needs-qa, patch
Depends on:
Blocks:
 
Reported: 2012-11-30 18:10 UTC by landsidel.allen
Modified: 2016-12-12 02:21 UTC (History)
2 users (show)

See Also:


Attachments
file.diff (559 bytes, patch)
2012-11-30 18:10 UTC, landsidel.allen
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description landsidel.allen 2012-11-30 18:10:00 UTC
The PostGreSQL initdb utility checks that the target data directory
specified with -D is empty, and fails if it is not, with no option to
override.  This causes initdb to fail when used on a data directory
that is a filesystem mount point if it contains a dump snapshot
directory (".snap" directory).

Adding initdb options is well beyond the scope of a port patch.  I
thought this simple workaround may be acceptable.

Fix: Tell initdb to ignore the ".snap" directory as it does for "." and ".."
already.

OR

Add an option to initdb that allows it to run on a data directory that is not empty.

For the first option, this simple patch to pgcheckdir.c does the trick:

--------------- cut
How-To-Repeat: Create a fresh filesystem, mount it at /usr/local/pgsql, and attempt to
run initdb.
Comment 1 Tilman Keskinoz freebsd_committer freebsd_triage 2012-12-17 16:49:47 UTC
Responsible Changed
From-To: freebsd-ports-bugs->pgsql

over to port-specific list
Comment 2 koobs 2013-02-06 20:29:59 UTC
I had a chat with a couple of the folks on IRC (#PostgreSQL/FreeNode)
to get their feedback, and seanc passed it on to the upstream mailing
lists with a slightly more refined version of the patch ignoring all
dot dirs. The thread is here for reference:

http://www.postgresql.org/message-id/A37DC83F-75AA-4850-8261-AD16B104F044@chittenden.org
Comment 3 landsidel.allen 2013-02-06 20:47:18 UTC
Forgive the top-reply.

After reading the discussion, I'm in favor of the "philosophically 
correct" approach rather than the usually-technically-correct approach.  
That is, display the warning, but let the sysadmin/dba do what they 
need/want to do and trust that, most of the time, they know what they're 
doing.

As the most interesting man might say, I don't always have PGDATA as a 
mount point for another filesystem, but when I do...

On 2/6/2013 15:29, Kubilay Kocak wrote:
> I had a chat with a couple of the folks on IRC (#PostgreSQL/FreeNode)
> to get their feedback, and seanc passed it on to the upstream mailing
> lists with a slightly more refined version of the patch ignoring all
> dot dirs. The thread is here for reference:
>
> http://www.postgresql.org/message-id/A37DC83F-75AA-4850-8261-AD16B104F044@chittenden.org
>
Comment 4 Jason Helfman freebsd_committer freebsd_triage 2013-02-17 01:50:24 UTC
this was updated upstream here:
http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=17f15239325a88581bb4f9cf91d38005f1f52d69
and can be tested in the next release that includes this change

-jgh

-- 
Jason Helfman
FreeBSD Committer | http://people.freebsd.org/~jgh | The Power To Serve
Comment 5 Carlo Strub freebsd_committer freebsd_triage 2014-09-11 20:10:02 UTC
Is this PR still relevant?
Comment 6 VK freebsd_triage 2016-12-12 02:21:42 UTC
Guessing this was about PostgreSQL 9.2. Closing for lack of feedback. If the problem still exists, please reopen or file a new report against adequate version.