Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bsf0C-0005gK-QS for pgsql-admin@arkaria.postgresql.org; Fri, 07 Oct 2016 23:56:33 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bsf0C-0004rC-Cr for pgsql-admin@arkaria.postgresql.org; Fri, 07 Oct 2016 23:56:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bsf0B-0004nQ-6e for pgsql-admin@postgresql.org; Fri, 07 Oct 2016 23:56:31 +0000 Received: from mail-by2nam03on0051.outbound.protection.outlook.com ([104.47.42.51] helo=NAM03-BY2-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bsf06-00025p-8e for pgsql-admin@postgresql.org; Fri, 07 Oct 2016 23:56:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=journyx.onmicrosoft.com; s=selector1-journyx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=DnZhIYyyvavrzwpMWt+G86d92IJGjjtCHwiF3Qm9GN0=; b=dJqVnMQwqTf4EfmPqgg0a8ED+JsOUeKbt3y5ZYIMgpImzKQdIEkSpOIciJfE9nggz7B8ilAzSPi5KP2xWHRn3EoduiwS1reXbeGRCAKm9e5XEhbFVcAIKM4YfgdBCpelW5W/5eZZ0Z1D6H4m1e7HzQ4E/KVcotb1xMpc1hs9b0E= Received: from BY1PR11MB0390.namprd11.prod.outlook.com (10.162.146.14) by BY1PR11MB0390.namprd11.prod.outlook.com (10.162.146.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.649.16; Fri, 7 Oct 2016 23:56:21 +0000 Received: from BY1PR11MB0390.namprd11.prod.outlook.com ([10.162.146.14]) by BY1PR11MB0390.namprd11.prod.outlook.com ([10.162.146.14]) with mapi id 15.01.0649.024; Fri, 7 Oct 2016 23:56:21 +0000 From: Scott Whitney To: "David G. Johnston" , xujian CC: "pgsql-admin@postgresql.org" Subject: Re: open database on read only file system Thread-Topic: [ADMIN] open database on read only file system Thread-Index: AQHSINNYee79D28WnEKNDEntslyHsaCdaqJvgAAcHACAAAWtgIAAHrz0 Date: Fri, 7 Oct 2016 23:56:21 +0000 Message-ID: References: , In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=scott@journyx.com; x-originating-ip: [70.112.92.197] x-ms-office365-filtering-correlation-id: 38b566b8-5cb1-4109-55d4-08d3ef0d8a03 x-microsoft-exchange-diagnostics: 1;BY1PR11MB0390;7:wC03vQE3t0pMaGgGX5KIPo2E+TJmbknDSSIOwl83bhmqntq6cEgJKe46rAXOiszUEEAZRs2/x/YqQT8c829yj0ZFcr8BCOe3tSageoT0vkvIdnom2K82Ds667LNUIpBWVOQeRT63xsNUwl5BN0kCyCzL5JY10olNjVd5qz3+gMQZkRGYYiv0YMwzJgacTCa6ttrE8Q4pwxNca/3WTIvNWlSwpoFO1qIbNKc6jK8HKRkMEeJEzolJ1wuUEpZf/mQDZzeZSQkr6RtjCfL8ZuetYWwWTjyG7hhizelH8DvGp1B9S2Cm2EEsuqiEstUp9ani2gD4Q6x4kZdELTsSaj8ohg== x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR11MB0390; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(189930954265078); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6043046)(6042046);SRVR:BY1PR11MB0390;BCL:0;PCL:0;RULEID:;SRVR:BY1PR11MB0390; x-forefront-prvs: 0088C92887 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(7916002)(199003)(189002)(377454003)(24454002)(97736004)(81156014)(81166006)(8676002)(8936002)(5660300001)(2900100001)(63666004)(92566002)(9686002)(15975445007)(3280700002)(16236675004)(7736002)(7846002)(77096005)(6116002)(586003)(4326007)(2906002)(101416001)(3846002)(93886004)(102836003)(87936001)(68736007)(33646002)(122556002)(15974865002)(2950100002)(50986999)(106356001)(99286002)(54356999)(105586002)(76176999)(3660700001)(19580405001)(106116001)(19580395003)(95246002)(189998001)(10400500002)(66066001)(11100500001)(5001770100001)(86362001)(5002640100001)(51650200001);DIR:OUT;SFP:1101;SCL:1;SRVR:BY1PR11MB0390;H:BY1PR11MB0390.namprd11.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; received-spf: None (protection.outlook.com: journyx.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: multipart/alternative; boundary="_000_ex9yvxtxisrvkiatccxfoxp21475884566489emailandroidcom_" MIME-Version: 1.0 X-OriginatorOrg: journyx.com X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Oct 2016 23:56:21.5837 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 83db917a-cb55-44ba-82ef-25aa3e32343f X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR11MB0390 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org --_000_ex9yvxtxisrvkiatccxfoxp21475884566489emailandroidcom_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Yes. This is the proper answer. Mine is shorter, but this is the entire poi= nt. The results you get by enabling PG to run (temporarily) on RO doesn't guara= ntee production results. -------- Original message -------- From: "David G. Johnston" Date: 10/07/2016 5:06 PM (GMT-06:00) To: xujian Cc: Scott Whitney , pgsql-admin@postgresql.org Subject: Re: [ADMIN] open database on read only file system On Fri, Oct 7, 2016 at 2:46 PM, xujian > 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 =3D=3D=3D=3D=3D=3D=3D=3D /* * 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) =3D=3D=3D=3D=3D=3D=3D=3D so I changed the file open mode from O_RDWR to O_RDONLY fd =3D PathNameOpenFile(path, O_RDONLY | PG_BINARY, 0600); and it works. I can open the user database, and query table now. Do you thi= nk if there is any potential problem of this change? I just need to open database on read-only file system, and no need any chan= ges on the cluster. thanks ?For some definition of "work" something like this might give you satisfact= ory 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 abl= e 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. ? Journyx, Inc. 7600 Burnet Road #300 Austin, TX 78757 www.journyx.com p 512.834.8888 f 512-834-8858 Do you receive our promotional emails? You can subscribe or unsubscribe to = those emails at http://go.journyx.com/emailPreference/e/4932/714/ --_000_ex9yvxtxisrvkiatccxfoxp21475884566489emailandroidcom_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Yes. This is the proper answer. Mine is shorter, but this is the entire poi= nt.

The results you get by enabling PG to run (temporarily) on RO doesn't = guarantee production results.


-------- Original message --------
From: "David G. Johnston" <david.g.johnston@gmail.com>
Date: 10/07/2016 5:06 PM (GMT-06:00)
To: xujian <jamesxu@outlook.com>
Cc: Scott Whitney <scott@journyx.com>, pgsql-admin@postgresql.org Subject: Re: [ADMIN] open database on read only file system

On Fri, Oct 7, 2016 at 2:46= PM, xujian <jamesxu@outlook.com&g= t; wrote:
Thanks Scott. Do you know if there is any way to support r= ead-only FS? for instance patch or extension.

I noticed the error is from file md.c
=3D=3D=3D=3D=3D=3D=3D=3D
/*
 * mdopen() -- Open the specified relation.
 *
 * Note we only open the first segment, when there are multiple s= egments.
 *
 * If first segment is not present, either ereport or return NULL= according
 * to "behavior".  We treat EXTENSION_CREATE the s= ame 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)
=3D=3D=3D=3D=3D=3D=3D=3D

so I changed the file open mode from O_RDWR to O_RDONLY
fd =3D PathNameOpenFile(path, O_RDONLY | PG_BINARY, 0600);

and it works. I can open the user database, and query table now. Do yo= u 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 gi= ve you satisfactory results.  You'd likely get more reliable answers i= f 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 abl= e 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 fil= e system setup as a tablespace in the cluster so that large queries can mak= e use of temporary result areas.​

David J. ​



Journyx, Inc.
7600 Burnet Road #300
Austin, TX 78757
www.journyx.com

p 512.834.8888 
f 512-834-8858 

Do you receive our promotional emails? You can subscribe or unsubscrib= e to those emails at http://go.journyx.com/emailPreference/e/4932/714/ = ;
--_000_ex9yvxtxisrvkiatccxfoxp21475884566489emailandroidcom_--