initdb should create a warning message [was Re: [ADMIN] Size on Disk]

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-docs(at)postgresql(dot)org
Subject: initdb should create a warning message [was Re: [ADMIN] Size on Disk]
Date: 2003-11-30 22:29:35
Message-ID: 1070231374.7719.2654.camel@linda.lfix.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-docs pgsql-hackers

On Wed, 2003-11-26 at 05:53, Tom Lane wrote:
> Grzegorz Dostatni <dostatnig(at)yahoo(dot)com> writes:
> > Currently the datase is roughly 80 Megs. About half of
> > the size is stored in pg_xlog directory. I managed to
> > figure out that those files are transaction log files?
> > How can I delete them safely?
>
> You can NOT. Don't even think about going there.
>
> What you can do, if you intend only low-update-volume usage,
> is reduce checkpoint_segments to reduce the number of WAL files
> the system wants to keep around.

The use of the word "log" in the directory name does tend to invite this
error, and some have acted on it without asking first. I think initdb
should put a README.IMPORTANT file in $PGDATA to say,

pg_xlog and pg_clog are crucial to the preservation of your
data. They do not contain standard log files. Do not even think
about deleting them to save space; you would destroy your
database.

The cost is only one disk block per cluster, and it might deflect some
of the weaponry pointed at hapless feet...

Patch for initdb.c attached

I notice that pg_clog and pg_xlog are not mentioned in the index to the
documentation, which makes it more difficult for people to find out what
they are. I therefore also attach a doc patch to add index entries for
those two files.

--
Oliver Elphick Oliver(dot)Elphick(at)lfix(dot)co(dot)uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"Who shall ascend into the hill of the LORD? or who
shall stand in his holy place? He that hath clean
hands, and a pure heart..." Psalms 24:3,4

Attachment Content-Type Size
initdb.patch text/x-patch 1.8 KB
pg_xlog.doc.patch text/x-patch 2.6 KB

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Neil Conway 2003-11-30 23:18:54 Re: [HACKERS] initdb should create a warning message [was Re:
Previous Message Christopher Browne 2003-11-30 00:32:04 Re: pg_restore and transaction id wraparound

Browse pgsql-docs by date

  From Date Subject
Next Message Neil Conway 2003-11-30 23:18:54 Re: [HACKERS] initdb should create a warning message [was Re:
Previous Message Randolf Richardson 2003-11-29 21:06:00 Re: 7.4 official docs : Fonts?

Browse pgsql-hackers by date

  From Date Subject
Next Message Alex Satrapa 2003-11-30 22:38:06 Re: Was: Triggers, Stored Procedures, PHP
Previous Message Joe Conway 2003-11-30 20:59:45 Re: Patch queue