Skip site navigation (1) Skip section navigation (2)

Re: initdb change

From: David Fetter <david(at)fetter(dot)org>
To: Joshua Drake <jd(at)commandprompt(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: initdb change
Date: 2008-08-25 17:12:03
Message-ID: 20080825171203.GX32546@fetter.org (view raw or flat)
Thread:
Lists: pgsql-hackers
On Mon, Aug 25, 2008 at 09:54:26AM -0700, Joshua D. Drake wrote:
> On Mon, 25 Aug 2008 09:42:21 -0700
> David Fetter <david(at)fetter(dot)org> wrote:
> 
> > > We either need to provide a way to initialize it at initdb, allow
> > > xlogs to be in table space or add a GUC for the location.
> > 
> > There's already a way to specify where xlogs should be via
> > -X/--xlogdir. 
> 
> Sorry should have checked 8.3 initdb instead of 8.2.
> 
> > What that doesn't do is put the xlogdir where a DBA
> > would naturally expect to find it.  When that DBA doesn't find it in
> > the place they expect, very bad knock-on decisions are likely to
> > result.
> 
> O.k. when using 8.3 I did this:
> 
> initdb -D /tmp/foo -X /tmp/xlogs
> 
> And I got:
> 
> /tmp/foo/pg_xlog which is a link to /tmp/xlogs

Oops.  Well, this isn't quite the foot-gun I'd previously thought :P

> That seems perfectly logical. If I (without removing the old initdb) do
> this:
> 
> /usr/lib/postgresql/8.3/bin/initdb -D /tmp/bar -X /tmp/xlog
> 
> I get:
> 
> initdb: directory "/tmp/xlog" exists but is not empty
> If you want to store the transaction log there, either
> remove or empty the directory "/tmp/xlog".
> initdb: removing data directory "/tmp/bar"
> 
> I just reread your original message a little slower and see that what
> you want is if:
> 
> /var/lib/pgsql/data/ exists but is empty you can initdb within that
> directory. However if there is anything in it you can not. You are
> asking that if pg_xlog exists but is empty that we still be able to use
> the DATADIR and you can pass existing so that it will also use pg_xlog
> if it is empty.
> 
> My take would be to not add a new flag. Instead to implicitly allow it.
> If initdb finds that DATADIR and pg_xlog is empty it will use both. 

Is there some reason why initdb shouldn't just Do The Right Thing™
when it finds an empty extant $PGDATA/pg_xlog directory that passes
the same tests an empty extant $PGDATA would?

Cheers,
David.
-- 
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate

In response to

Responses

pgsql-hackers by date

Next:From: Joshua DrakeDate: 2008-08-25 17:26:15
Subject: Re: initdb change
Previous:From: Andrew DunstanDate: 2008-08-25 17:09:56
Subject: Re: initdb change

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group