Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jIpoq-0001m6-Ab for pgsql-general@arkaria.postgresql.org; Mon, 30 Mar 2020 08:30:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jIpon-0004Wa-MS for pgsql-general@arkaria.postgresql.org; Mon, 30 Mar 2020 08:30:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jIpon-0004Ud-9W for pgsql-general@lists.postgresql.org; Mon, 30 Mar 2020 08:30:49 +0000 Received: from mail-wr1-x441.google.com ([2a00:1450:4864:20::441]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jIpok-00039k-DY for pgsql-general@postgresql.org; Mon, 30 Mar 2020 08:30:47 +0000 Received: by mail-wr1-x441.google.com with SMTP id s1so20462950wrv.5 for ; Mon, 30 Mar 2020 01:30:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=tGpzU5o0uO8y71NWjHVB6CRdcSTAyjwpCkCTtUxTZig=; b=mx2JgkdLfL2Rnqih23AjWB9hnS25vy7+6jRmyOJOXN5zNyqqOO0F1j+jwhpn2nVv3w y+1yh7pSnEEGe0x7MgDtM6QPP6EMBzAENy9TYsjDApIBEf1IQahUE2ztg3IqmiOjFkEi y6iXqyVIeiQ/N6fH+x5mVdzrP9d1ck5CQIhmaQ+JQzZfriGMNssbJZFd/umDpzx6Qej8 6Xxkf6Tv2nUQDEV0YbqGxU7PYXUBpy5sZguH7deS4GwdPWUpChIJ8/EGqYKy2e8VsRjA mcSXrwj5nNDF2PU3Vld+X4t1e8tyLwM3NJVaGsGCcjDk4Vvt/FzaYmRFW/bCBu7JuQKr 0ZVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=tGpzU5o0uO8y71NWjHVB6CRdcSTAyjwpCkCTtUxTZig=; b=JMbsPnAtpEWe9uH7CZh09n+3oN86yM+6l6q/+or0QuvTumOoWz7wU0zCa+bEl3FmQ1 a/ScrgMOxMA93yVmgHmNeAmz3UXJQvXbqxtEOwsVAEegx9IF1xSWP5Qe9pv+8THRvZNm 1Kd6Kh1CHjmO1/r79xMqJ8xx4B0ioSzWPgqL8yZDehg7dbp9C0bkoYOPUB3vYvGFLy+p vHV2oSLar92AbwBSTg4FkdTJT1qTQxHFbjZHbRjLbaSs6y4yQ0qiCOWDs/M/STUYG+cS F0IMrcCunIGjNDmdmj0gP8zltrY2N1kniE1xbD/RVIHWlssDyIPHZp0kScG/1Chyv19R wnUQ== X-Gm-Message-State: ANhLgQ29+XvwewkL+D6w8VsAay7YXocgGet3U8GEQRV0a3SfmV/iqUu8 +pBm7r0Ew/ughuzvoliLb2uRSg== X-Google-Smtp-Source: ADFU+vtDFOCiOnr5PMK5/DY0ULG4qtWhyZEIPZLxGSuPaBjs6x5qZ8Az61Dk6x7KDgkILlxoGstxvA== X-Received: by 2002:adf:9d8a:: with SMTP id p10mr12963354wre.190.1585557044578; Mon, 30 Mar 2020 01:30:44 -0700 (PDT) Received: from dynamic-em2ni49tudqxjtqcs-pd01.res.v6.highway.a1.net (dynamic-em2ni49tudqxjtqcs-pd01.res.v6.highway.a1.net. [2001:871:60:33bb:372c:dece:aede:21ac]) by smtp.gmail.com with ESMTPSA id i5sm21325679wrr.12.2020.03.30.01.30.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Mar 2020 01:30:44 -0700 (PDT) Message-ID: Subject: Re: Issue with Postgres process startup after instance restart From: Laurenz Albe To: Shishir Joshi , Tom Lane Cc: pgsql-general@postgresql.org Date: Mon, 30 Mar 2020 10:30:43 +0200 In-Reply-To: References: <19774.1585317649@sss.pgh.pa.us> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, 2020-03-30 at 11:02 +0530, Shishir Joshi wrote: > On Fri, 27 Mar 2020 at 19:30, Tom Lane wrote: > > Shishir Joshi writes: > > > I recently faced an issue with PG 11 where the VM that the PG process was > > > running on got restarted because of a hardware issue. After the VM restart, > > > the Postgres process failed to start on the 1st attempt with the error "*LOG: > > > could not open directory "pg_tblspc/16388/PG_11_201809051": No such file > > > or directory*" even though that directory was present. But on the 2nd > > > attempt it started up without issues. There didn't seem to be any disk > > > corruption issues and there were no other errors in the syslog either. Has > > > anyone else faced such an issue or has any ideas on why this could have > > > occurred? > > > > Maybe whatever the tablespace is pointing at wasn't mounted yet? > > Slow remote mounts are the bane of PG DBAs --- I can recall at least > > one famous incident in which someone's database became totally > > corrupt because the NFS mount it was on came up after server start, > > leading to the server having a mishmash of files on the NFS server > > and files on the local disk, now hidden underneath the mount point. > > > > If this is what your issue was, you got very lucky to escape without > > damage. Suggest adapting your PG server start script to make sure the > > mounted file system is present before you allow the server to start. > > I forgot to mention, but in this case it looks the mount was completed before > the PG process was started up. But we don't have an explicit check for making > sure the file system is present in the start script. Thanks for the tip. If that is an NFS mount, make sure it is "fg", not "bg". Also, check that your startup script simply fails if the file system is not mounted yet, rather than automatically running "initdb". Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com