Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l1nNq-0003yp-AG for pgsql-admin@arkaria.postgresql.org; Tue, 19 Jan 2021 09:33:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l1nNp-0007AE-8V for pgsql-admin@arkaria.postgresql.org; Tue, 19 Jan 2021 09:33:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l1nNo-0007A1-Td for pgsql-admin@lists.postgresql.org; Tue, 19 Jan 2021 09:33:05 +0000 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1l1nNm-0003vn-89 for pgsql-admin@postgresql.org; Tue, 19 Jan 2021 09:33:04 +0000 Received: by mail-ej1-x633.google.com with SMTP id gx5so8288630ejb.7 for ; Tue, 19 Jan 2021 01:33:02 -0800 (PST) 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=pQH4Ev8BwJmSIafUeu96fdvWhBt4pgH/E1/1RPlxnXE=; b=GRVg0jy9NGNVR0WhWg+ZrF6Mdh2jNOk7Y1LKp3Pdtq9YkWwdSr6BRZ2dSq2hJE4KRZ K4tVI/gcpWVeWOAdprcAJycD7sQxc6Laz9MeHkydRGwFPAQ9rBdk5nbYnF+ysXlQDOg3 XITCMW3TRdcBxS8KOTVcXoKphF4vIt4AlPXFk2dKPObD1hZzokI9JAUT4Bvr99uiO1zf 3mGEi36Ph/W+jqc9cBd9wHAKLv19QBGuaJvP0c20G5VOi1dA7tu39Egq1YFkDFJ8QJ+J O5RlWP/u0mlOF8666/6R8zh86haV5HEq9wdhU/pKyZPZ33KgMf46Jb3TenrJMudj10Tj MyRA== 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=pQH4Ev8BwJmSIafUeu96fdvWhBt4pgH/E1/1RPlxnXE=; b=YMn4EUupVJ4N4/Q7tZJCZdcB2+QIIreP0L87r3YYS9uYTy6cZg4inpUhKoJM/DO4zh Jrf2hTR7AQoxeEMcG9lrT2ZRRbP1aEGZaYWTMFTQ2sZp3jseOU4jTpyG255lLYjcfogM GnwSqhDIF2GzU8L0nq0+ZB+/iGX7w1befIKSI6RORJnEdDoWVd027U5FlXZR36opt/5O AxqfuVOk3ZRmmA2SE7oHUzKSG4APqco5dkGfjc8kF3XCu4yoac9KEC8xrigDrsqgEA1j bC1cRcb3xVnD9EPy+109TLkDWFQ9W3xeiyQQ8gb6pHZmAuOBC1EeQNrgifpw1QEw6JCo CxmQ== X-Gm-Message-State: AOAM530sG/jVv604hVkk/IEeA8d8Ceepss1MagmDWUdzbR+i1apQL7z3 QySuC/x6mfXH+Jh5JukCK2+Ltg== X-Google-Smtp-Source: ABdhPJy+UaA8M03vYiwtOTSl00fMubdAVlIbhH5ewjOV6YPl0tAar34u+t0Dack0D0hHHJAzdmPqiQ== X-Received: by 2002:a17:906:1348:: with SMTP id x8mr2349281ejb.81.1611048781220; Tue, 19 Jan 2021 01:33:01 -0800 (PST) Received: from localhost.localdomain (62-46-248-242.adsl.highway.telekom.at. [62.46.248.242]) by smtp.gmail.com with ESMTPSA id h12sm11590444edb.16.2021.01.19.01.33.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 01:33:00 -0800 (PST) Message-ID: Subject: Re: hot standby in Postgresql 12 From: Laurenz Albe To: "David G. Johnston" , Ankush Chawla Cc: pgsql-admin Date: Tue, 19 Jan 2021 10:32:59 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, 2021-01-18 at 20:48 -0700, David G. Johnston wrote: > On Monday, January 18, 2021, Ankush Chawla wrote: > > log files ; > > > > > > 2021-01-18 07:31:00.946 UTC [21072]LOG: database system was interrupted; last known up at 2021-01-18 07:30:07 UTC > > cp: cannot stat '/u01/archive/00000004.history': No such file or directory > > 2021-01-18 07:31:00.963 UTC [21072]LOG: entering standby mode > > 2021-01-18 07:31:00.966 UTC [21072]LOG: restored log file "00000003.history" from archive > > 2021-01-18 07:31:00.981 UTC [21072]LOG: restored log file "000000030000000000000034" from archive > > 2021-01-18 07:31:01.029 UTC [21072]LOG: redo starts at 0/34000028 > > 2021-01-18 07:31:01.030 UTC [21072]LOG: consistent recovery state reached at 0/34000138 > > cp: cannot stat '/u01/archive/000000030000000000000035': No such file or directory > > 2021-01-18 07:31:01.043 UTC [21079]LOG: started streaming WAL from primary at 0/35000000 on timeline 3 > > > > And now the standby is waiting for the next wal file to be archived by the primary. > You should probably set archive_timeout to a non-zero value since the primary doesn’t > seem very busy (though you also still need to do at least one write, empty wal files > don’t get rotated out and archived.) If the standby is *streaming* WAL, it is *not* waiting for a WAL segment to be archived. WAL is streamed to the standby right away. What the standby needs to become available for connections are two events in the WAL stream: - the WAL entry that ends the base backup (BACKUP_END) - a WAL entry with the running transactions on the primary (RUNNING_XACTS) Since we see the message "consistent recovery state reached", the first condition is satisfied. So the standby is waiting for a RUNNING_XACTS. These get written every couple of seconds by the primary server if all is well. So it would be interesting to know what the primary is doing. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com