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 1kpRBM-0002oD-To for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Dec 2020 07:25:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kpRBL-0005Pw-Rm for pgsql-hackers@arkaria.postgresql.org; Wed, 16 Dec 2020 07:25:07 +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 1kpRBL-0005Po-IV for pgsql-hackers@lists.postgresql.org; Wed, 16 Dec 2020 07:25:07 +0000 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kpRBI-0001Mb-NA for pgsql-hackers@postgresql.org; Wed, 16 Dec 2020 07:25:06 +0000 Received: by mail-pg1-x531.google.com with SMTP id f17so17006305pge.6 for ; Tue, 15 Dec 2020 23:25:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:to:cc:subject:from:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=O4cvEY9nKxY7FUzis/P9DiEkzDM2u1e8LXpY9KXENIA=; b=P4T4l3zoaraB3NuvAeGJWphHrj23xEL2oVGiJ5KyuOYK1FUDE/VQWH42ZEOf0DIxpY CaDXGDvwD3EHHt6noBQiSmZO8RqgehYfcqJ57mMU7UcCd1qA0WQtzsEknWuDlWFh3Q3E HlWVdPkFnzKL/X0qC5SEP/O6B4wpPaumFGkvrUoSZ0+MZCydtT5065D3Czkc9273kMP/ scK0lYBxASgVnOS5gQWSgfLY1d2V/vt68qMAzmt5AB77rstC1NdJJ8RPAy0ICj2i3DId 9w40hFXfQEb8V01IuDt06eyRW53FYtRaibFJ6KohfUS016gpmRaePzH12jLNJZBwLnA3 Tw3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:to:cc:subject:from:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=O4cvEY9nKxY7FUzis/P9DiEkzDM2u1e8LXpY9KXENIA=; b=Ss6eFpfSc0/MvADzuUTWQJNwRK2PGXdMOGwTVjpuIe/zZVeXI3pmgKQhBOkxPUWhu/ BjFIgXYMWjySy5iEMVpK/lX3g0KidyXrEMt4pVMA3cKf1lXOOkV120UPfxdjz2uvju+0 /4gY044bq17qYHn8zUOS0GIyelae7MIhFEo7Uh8tc42yMNNuSyJmONGuSCNzC3M/Dsbe NevXr7GgRFc/qh2EtdzXQcatxhBSBjAyb7g9CX6vDHcvgWvOeawyYfiDfxkp/Qb+HO94 5G2Pev5XglVmYTqYQzUTC9k9jFbKBU0hBkT7h5vKD1dbtTjx7k/Fy8SfHIleKYl5rFMt Z7MA== X-Gm-Message-State: AOAM533lpmQZqj2GbVw/e7Ohv5NOz+H76WTZFlH5VB7PFhOMcccluWhF No3gqJA7EP5lllJZfUpD2IM= X-Google-Smtp-Source: ABdhPJzXrkcBIeQC5zzV5OTFed8unxN5BVVFoV60lNC9ATRWDj9zecDwAy1Xd4jdZEnj29pnFfrwrw== X-Received: by 2002:a65:404b:: with SMTP id h11mr31485543pgp.379.1608103502493; Tue, 15 Dec 2020 23:25:02 -0800 (PST) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id 145sm1224668pfu.8.2020.12.15.23.25.00 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Tue, 15 Dec 2020 23:25:01 -0800 (PST) Date: Wed, 16 Dec 2020 16:24:59 +0900 (JST) Message-Id: <20201216.162459.1543880840255001035.horikyota.ntt@gmail.com> To: masao.fujii@oss.nttdata.com Cc: bharath.rupireddyforpostgres@gmail.com, pgsql-hackers@postgresql.org Subject: Re: Use standard SIGHUP and SIGTERM handlers in autoprewarm module From: Kyotaro Horiguchi In-Reply-To: References: <6b561c73-27ce-7079-b6e5-440e49653810@oss.nttdata.com> User-Agent: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk At Tue, 15 Dec 2020 23:10:28 +0900, Fujii Masao wrote in > > I pushed the following two patches. > > - v1-use-standard-SIGHUP-hanlder-in-syslogger-process.patch > > - v1-use-MyLatch-and-standard-SIGHUP-handler-in-startup-process.patch > > As I told in other thread [1], I'm thinking to revert this patch > because this change could have bad side-effect on the startup > process waiting for recovery conflict. > > Before applying the patch, the latch that the startup process > used to wait for recovery conflict was different from the latch > that SIGHUP signal handler or walreceiver process, etc set to > wake the startup process up. So SIGHUP or walreceiver didn't > wake the startup process waiting for recovery conflict up unnecessary. > > But the patch got rid of the dedicated latch for signaling > the startup process. This change forced us to use the same latch > to make the startup process wait or wake up. Which caused SIGHUP > signal handler or walreceiver proces to wake the startup process > waiting on the latch for recovery conflict up unnecessarily > frequently. > > While waiting for recovery conflict on buffer pin, deadlock needs > to be checked at least every deadlock_timeout. But that frequent > wakeups could prevent the deadlock timer from being triggered and > could delay that deadlock checks. I thought that spurious wakeups don't harm. But actually ResolveRecoveryConflictWithBufferPin doesn't consider spurious wakeups. Only the timer woke up ResolveRecoveryConflictWithBufferPin before the patch comes. Currently SIGHUP and XLogFlush() (on walreceiver) also wake up startup process. For a moment I thought that ResolveRecoveryConflictWithBufferPin should wake up at shutdown time by the old recovery latch but it's not the case since it wakes up after all blockers go away. It seems to me simpler to revert the patches than making the function properly handle spurious wakeups. > Therefore, I'm thinking to revert the commit ac22929a26 and > 113d3591b8. > > [1] > https://www.postgresql.org/message-id/a802f1c0-58d9-bd3f-bc3e-bdad54726855@oss.nttdata.com As the result, I agree to revert them. But I think we need to add a comment for the reason we don't use MyLatch for recovery-wakeup after reverting them. regards. -- Kyotaro Horiguchi NTT Open Source Software Center