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 1kewH1-0007Mc-N6 for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Nov 2020 08:23:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kewH0-0001uR-Jb for pgsql-hackers@arkaria.postgresql.org; Tue, 17 Nov 2020 08:23:34 +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 1kewH0-0001tQ-AL for pgsql-hackers@lists.postgresql.org; Tue, 17 Nov 2020 08:23:34 +0000 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kewGx-0007tm-H3 for pgsql-hackers@postgresql.org; Tue, 17 Nov 2020 08:23:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1605601411; x=1637137411; h=to:cc:references:from:message-id:date:mime-version: in-reply-to:content-transfer-encoding:subject; bh=2yWkyrPjtWAXGkw/JavtvKtPvHCOt5/s2aiRAmi7HuA=; b=wBcsF2NxhGhqGVax0PhA63Ef3rckvnFBgK9zL59wykX/rIc81dbdRimr JF0UswhhFgIrMAuQ+k3uktUg7P7nBqqgskPQFI3lmPDBi0qz5y22IqmTU 9TzltDQyEJLPxSzRHHgrGk5INXl4I2KgpEgZT0BRU36pN60Wdq+e3etJE w=; X-IronPort-AV: E=Sophos;i="5.77,484,1596499200"; d="scan'208";a="66865403" Subject: Re: Add Information during standby recovery conflicts Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-1a-821c648d.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP; 17 Nov 2020 08:23:23 +0000 Received: from EX13D03EUC003.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-1a-821c648d.us-east-1.amazon.com (Postfix) with ESMTPS id 528FCA1E84; Tue, 17 Nov 2020 08:23:21 +0000 (UTC) Received: from 38f9d36c4abb.ant.amazon.com (10.43.160.125) by EX13D03EUC003.ant.amazon.com (10.43.164.192) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 17 Nov 2020 08:23:18 +0000 To: Masahiko Sawada CC: Fujii Masao , Masahiko Sawada , Kyotaro Horiguchi , Alvaro Herrera , PostgreSQL-development References: <20201015.121338.832998229451118046.horikyota.ntt@gmail.com> <20201015.145210.622238854316424234.horikyota.ntt@gmail.com> <9493cda6-ac77-6aff-28ea-4ff7774ba78c@oss.nttdata.com> <6416172a-8c7d-84da-2600-f5f41c61db18@amazon.com> From: "Drouvot, Bertrand" Message-ID: <9682a167-af46-2e58-7f77-c87edaf80fde@amazon.com> Date: Tue, 17 Nov 2020 09:23:13 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:78.0) Gecko/20100101 Thunderbird/78.4.3 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Originating-IP: [10.43.160.125] X-ClientProxiedBy: EX13D39UWA001.ant.amazon.com (10.43.160.54) To EX13D03EUC003.ant.amazon.com (10.43.164.192) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 11/17/20 2:09 AM, Masahiko Sawada wrote: > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe. > > > > On Mon, Nov 16, 2020 at 4:55 PM Drouvot, Bertrand wrote: >> Hi, >> >> On 11/16/20 6:44 AM, Masahiko Sawada wrote: >>> Thank you for updating the patch. >>> >>> Here are review comments. >>> >>> + if (report_waiting && (!logged_recovery_conflict || >>> new_status == NULL)) >>> + ts = GetCurrentTimestamp(); >>> >>> The condition will always be true if log_recovery_conflict_wait is >>> false and report_waiting is true, leading to unnecessary calling of >>> GetCurrentTimestamp(). >>> >>> --- >>> + >>> + You can control whether a log message is produced when the startup process >>> + is waiting longer than deadlock_timeout for recovery >>> + conflicts. This is controled by the >> linkend="guc-log-recovery-conflict-waits"/> >>> + parameter. >>> + >>> >>> s/controled/controlled/ >>> >>> --- >>> if (report_waiting) >>> waitStart = GetCurrentTimestamp(); >>> >>> Similarly, we have the above code but we don't need to call >>> GetCurrentTimestamp() if update_process_title is false, even if >>> report_waiting is true. >>> >>> I've attached the patch that fixes the above comments. It can be >>> applied on top of your v8 patch. >> Thanks for the review and the associated fixes! >> >> I've attached a new version that contains your fixes. >> > Thank you for updating the patch. > > I have other comments: > > + > + You can control whether a log message is produced when the startup process > + is waiting longer than deadlock_timeout for recovery > + conflicts. This is controlled by the > + parameter. > + > > It would be better to use 'WAL replay' instead of 'the startup > process' for consistency with circumjacent descriptions. What do you > think? Agree that the wording is more appropriate. > > --- > @@ -1260,6 +1262,8 @@ ProcSleep(LOCALLOCK *locallock, LockMethod > lockMethodTable) > else > enable_timeout_after(DEADLOCK_TIMEOUT, DeadlockTimeout); > } > + else > + standbyWaitStart = GetCurrentTimestamp(); > > I think we can add a check of log_recovery_conflict_waits to avoid > unnecessary calling of GetCurrentTimestamp(). > > I've attached the updated version patch including the above comments > as well as adding some assertions. Please review it. > That looks all good to me. Thanks a lot for your precious help! Bertrand