Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hw5w4-0000Wg-Fi for pgsql-general@arkaria.postgresql.org; Fri, 09 Aug 2019 14:32:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hw5w2-0006Lu-RE for pgsql-general@arkaria.postgresql.org; Fri, 09 Aug 2019 14:32:02 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1hw5w2-0006KB-HP for pgsql-general@lists.postgresql.org; Fri, 09 Aug 2019 14:32:02 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hw5vz-0006Md-EU for pgsql-general@postgresql.org; Fri, 09 Aug 2019 14:32:01 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x79EVuYe004821; Fri, 9 Aug 2019 10:31:56 -0400 From: Tom Lane To: =?utf-8?B?0J7Qu9C10LMg0KHQsNC80L7QudC70L7Qsg==?= cc: PostgreSQL mailing lists Subject: Re: PostgreSQL lock file In-reply-to: <3E45AB93-A701-485D-9E46-44EEB7D04662@ya.ru> References: <3E45AB93-A701-485D-9E46-44EEB7D04662@ya.ru> Comments: In-reply-to =?utf-8?B?0J7Qu9C10LMg0KHQsNC80L7QudC70L7Qsg==?= message dated "Fri, 09 Aug 2019 16:56:07 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <4819.1565361116.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Fri, 09 Aug 2019 10:31:56 -0400 Message-ID: <4820.1565361116@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =3D?utf-8?B?0J7Qu9C10LMg0KHQsNC80L7QudC70L7Qsg=3D=3D?=3D wr= ites: > I have a task to create HA PostgreSQL cross datacenter cluster. I create= d a test bed on VirtualBox and I simulate different failures and disastrou= s in loops. And got one of funny bug of the Postgresql (11.4). One of the = clusters has two instances of PostgreSQL on port 5433 and 5434. After simu= lating unexpected power off of the node the lock files of PostgreSQL still= exist in /tmp directory. And on recovery the first instance on port 5433 = starts without problem, but the second instance sometimes not. The reason = is that the PID in /tmp/.s.PGSQL.5434.lock sometimes point to the one of p= rocess of PostgereSQL on port 5433, for instance the logger. Best practice for this sort of thing is considered to be to run the two Postgres instances under different user IDs. That avoids them thinking that the other one's lock files are relevant, and it provides an extra layer of security against possible conflicts between the two instances. regards, tom lane