Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eNBXh-0005uO-6Y for pgsql-admin@arkaria.postgresql.org; Fri, 08 Dec 2017 05:49:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eNBXf-0006jK-KK for pgsql-admin@arkaria.postgresql.org; Fri, 08 Dec 2017 05:49:47 +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 1eNBXf-0006jB-Dk for pgsql-admin@lists.postgresql.org; Fri, 08 Dec 2017 05:49:47 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eNBXK-0008KS-0d for pgsql-admin@lists.postgresql.org; Fri, 08 Dec 2017 05:49:46 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 334CA4CEE8; Fri, 8 Dec 2017 06:49:23 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id am0_iuqZz8Pt; Fri, 8 Dec 2017 06:49:21 +0100 (CET) Message-ID: <1512712155.2390.6.camel@cybertec.at> Subject: Re: "FATAL: the database system is starting up" and hot_standby = on From: Laurenz Albe To: Ilnur Khanov , pgsql-admin@lists.postgresql.org Date: Fri, 08 Dec 2017 06:49:15 +0100 In-Reply-To: References: <1512634318.2188.3.camel@europecamions-interactive.com> <1512668252.2915.17.camel@cybertec.at> Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Ilnur Khanov wrote: > I've just disabled hot_standby and restarted server. Everything is OK now. > > I assume there was continuous recovery mode. > > > You cannot modify the database, right? > > No, I can. As long it was in this recovery mode with hot_standby=on I was able query and modify database, with hot_standby=off I couldn't even connect. > Here is another my wonder: relying on manual, it had to be read-only mode. Now that would be really strange if you could modify the database while in recovery mode. Unfortunately you cannot test that now... > That is the question: If I can't connect with "FATAL: the database system is starting up" how I can check pg_is_in_recovery()? If you get the fatal message you *know* the system is recovering. That query is to ascertain you are still in recovery if you set hot_standby=on. > So my conclusion is: > If postgres says "FATAL: the database system is starting up" after failure without any other errors in logs and postgres output, than you can: > - wait for some long period of time > or > - you can turn on hot_standby and use your database with care while it's recovering and turn hot_standby off when it finishes. > > Hoping this thread helps someone sometime. In my opinion the main question is why crash recovery took so long. The server log should be able to tell you more about it. Is your checkpoint_timeout very high? Was there a backup_label file in the data directory (now backup_label.old)? Yours, Laurenz Albe