Re: open database on read only file system

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: xujian <jamesxu(at)outlook(dot)com>
Cc: Whitney Scott <scott(at)journyx(dot)com>, "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: open database on read only file system
Date: 2016-10-07 22:06:21
Message-ID: CAKFQuwY2JmpawvodaqaRxdVZY41e4=5voAUDD=etJpBMWXR1qA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Fri, Oct 7, 2016 at 2:46 PM, xujian <jamesxu(at)outlook(dot)com> wrote:

> Thanks Scott. Do you know if there is any way to support read-only FS? for
> instance patch or extension.
>
> I noticed the error is from file md.c
> ========
> /*
> * mdopen() -- Open the specified relation.
> *
> * Note we only open the first segment, when there are multiple segments.
> *
> * If first segment is not present, either ereport or return NULL according
> * to "behavior". We treat EXTENSION_CREATE the same as EXTENSION_FAIL;
> * EXTENSION_CREATE means it's OK to extend an existing relation, not to
> * invent one out of whole cloth.
> */
> static MdfdVec *
> mdopen(SMgrRelation reln, ForkNumber forknum, int behavior)
> ========
>
> so I changed the file open mode from O_RDWR to O_RDONLY
> fd = PathNameOpenFile(path, O_RDONLY | PG_BINARY, 0600);
>
> and it works. I can open the user database, and query table now. Do you
> think if there is any potential problem of this change?
> I just need to open database on read-only file system, and no need any
> changes on the cluster. thanks
>
>
​For some definition of "work" something like this might give you
satisfactory results. You'd likely get more reliable answers if you
explain exactly what your intended usage pattern is.

In short - the software has not been designed to operate in production on a
read-only file system and likely few people, if anyone, is going to be able
to give any kind of assurance that the system won't crash if operated in
such a manner.

​You will need to ensure that you have at least one read/write file system
setup as a tablespace in the cluster so that large queries can make use of
temporary result areas.​

David J. ​

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Whitney 2016-10-07 23:54:55 Re: open database on read only file system
Previous Message xujian 2016-10-07 21:46:02 Re: open database on read only file system