Re: why not using a mountpoint as PGDATA?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Luca Ferrari <fluca1978(at)gmail(dot)com>
Cc: Julien Rouhaud <rjuju123(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: why not using a mountpoint as PGDATA?
Date: 2019-02-27 15:42:12
Message-ID: 14944.1551282132@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Luca Ferrari <fluca1978(at)gmail(dot)com> writes:
> On Wed, Feb 27, 2019 at 12:33 PM Julien Rouhaud <rjuju123(at)gmail(dot)com> wrote:
>> You can see most obvious reasons at
>> https://bugzilla.redhat.com/show_bug.cgi?id=1247477

> Thanks, I didn't see the lost+found problem because I'm on UFS (I'm
> wondering if this applies also to ZFS datasetes with mount point).
> Same story for the accidentally umount, since FreeBSD seems enough
> friendly to avoid umount while the database is running, but it could
> definetely happen with some brute force or on another operating
> system.

The case that I can recall most clearly was actually in the other
direction: during system bootup, some NFS volume that was being abused
this way (mount point == data dir) was slow to mount. Compounding the
problem, postgres was being started through some init script that would
helpfully run initdb if it saw the specified data directory was empty.
So, rather than failing like a properly paranoid DBA would wish, it
ran initdb and then started the postmaster. A bit later, the NFS volume
came online, replacing the mount-point directory, and now the postmaster
had a devil's brew of open files on the local volume containing the mount
point and open files on the NFS volume. It didn't take long for that to
translate into hopeless catalog corruption. I don't think they ever got
their data back.

The true value of data-dir-at-least-one-level-down is so that it will
fail to be there at all if the file system isn't mounted. You need that,
and you do *not* want automated attempts to "repair" that.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2019-02-27 15:51:05 Re: Why can I not get lexemes for Hebrew but can get them for Armenian?
Previous Message Edson Carlos Ericksson Richter 2019-02-27 15:19:52 Re: Barman disaster recovery solution