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 1jTDMt-0004GL-TB for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Apr 2020 23:40:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jTDMM-0000Xc-6q for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Apr 2020 23:40:22 +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 1jTDML-0000XV-RL for pgsql-hackers@lists.postgresql.org; Mon, 27 Apr 2020 23:40:21 +0000 Received: from mail-qt1-x842.google.com ([2607:f8b0:4864:20::842]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jTDMD-0001pJ-J8 for pgsql-hackers@lists.postgresql.org; Mon, 27 Apr 2020 23:40:20 +0000 Received: by mail-qt1-x842.google.com with SMTP id w29so15927465qtv.3 for ; Mon, 27 Apr 2020 16:40:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=+UWOWcEIs6+B8wpE/DSDb6gjuPHLd9/f9ZwxcjzxIxI=; b=Oy/2bNN+DyKEaENgloffqiGJFcsf/eHq0xbzYQmEBkOp5oDMiixZNotVfVBUotM0LE khflM7pRQudVDy1HFbUKwZCk+t79LgNkTe2/82mZmihGoWITQFdTRZ6/D/KwapvE5G8P oyYRsGjkxxfmTWWZsTeYsJGbC+MpSrUmornTsc78npPwylaBu9ryWS+chWHUVSCdz+lV zGUhk7GHothUa8RK5Pn9aXFMSyFr+ea+PqpkpJ6+7huO5T995NHWmQucGM7VeZsu1k5g UtGwcELdHXs7jEk06DZCM3Hgu7cU2WwScPQpJIgLIIjjlBENAxp+og+/ByM24ar7CdbU Oc6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=+UWOWcEIs6+B8wpE/DSDb6gjuPHLd9/f9ZwxcjzxIxI=; b=AkPQEYlw0Q6RNS91hYcetQOJijSW+VVcyL4iKiVx50KmOQdQVMO5Q+0JQPut5VufWv emUP6Stq6ghAinQOkXU0s6rDCzOItf0Y2IbfsicEXF7DASC1++SkbYLeO7Ecs1ZdGvLR oXPWxXhsskVXW37FjwnKg8seUPAOE6Bl4ufC2pemCXaGj7sNvEwyWpAFvlNfr8LqrWsx PfX4h9FI75a0KiFtRfDjzJ67WfqiWWLBbuEIxB1dPu5VqfeYOIV1KGB+Af1NeDxV4DmB Dl/Pmy4c4zC6LBboMhZH8PbUCxTtKlc3KIYd0vl3u5td0123gAy0XRAP2MfI8YmlnG5Y e0Rg== X-Gm-Message-State: AGi0PuaFVjgG5S3k33rMAk8sWuWOWXkhLX0M8H2x1r0Eg1KapxvnzTGT FrcXI+0zUQHtMeMqqTs3CE89Ig== X-Google-Smtp-Source: APiQypIVYhLJ6iD+VTDl9aqohJuV/rrFLKrFImKjaqF2wWIsgPzWfaEENGZaInhVwTMpE8X9P0EJMw== X-Received: by 2002:ac8:6c23:: with SMTP id k3mr26241412qtu.107.1588030811107; Mon, 27 Apr 2020 16:40:11 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.95.18.252]) by smtp.gmail.com with ESMTPSA id v62sm12017027qkb.85.2020.04.27.16.40.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Apr 2020 16:40:10 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 09592300819; Mon, 27 Apr 2020 19:40:08 -0400 (-04) Date: Mon, 27 Apr 2020 19:40:07 -0400 From: Alvaro Herrera To: Kyotaro Horiguchi Cc: jgdr@dalibo.com, andres@anarazel.de, michael@paquier.xyz, sawada.mshk@gmail.com, peter.eisentraut@2ndquadrant.com, pgsql-hackers@lists.postgresql.org, thomas.munro@enterprisedb.com, sk@zsrv.org, michael.paquier@gmail.com Subject: Re: [HACKERS] Restricting maximum keep segments by repslots Message-ID: <20200427234007.GA14631@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="EVF5PPMfhYS0aIcm" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200408.164605.1874250940847340108.horikyota.ntt@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --EVF5PPMfhYS0aIcm Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit On 2020-Apr-08, Kyotaro Horiguchi wrote: > I understand how it happens. > > The latch triggered by checkpoint request by CHECKPOINT command has > been absorbed by ConditionVariableSleep() in > InvalidateObsoleteReplicationSlots. The attached allows checkpointer > use MyLatch for other than checkpoint request while a checkpoint is > running. Hmm, that explanation makes sense, but I couldn't reproduce it with the steps you provided. Perhaps I'm missing something. Anyway I think this patch should fix it also -- instead of adding a new flag, we just rely on the existing flags (since do_checkpoint must have been set correctly from the flags earlier in that block.) I think it'd be worth to verify this bugfix in a new test. Would you have time to produce that? I could try in a couple of days ... -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services --EVF5PPMfhYS0aIcm Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Don-t-freeze-on-checkpoints.patch" From 511c22043846c7453cea8b00bf911705417609eb Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Mon, 27 Apr 2020 19:35:15 -0400 Subject: [PATCH] Don't freeze on checkpoints --- src/backend/postmaster/checkpointer.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c index e354a78725..5cf5e9fe08 100644 --- a/src/backend/postmaster/checkpointer.c +++ b/src/backend/postmaster/checkpointer.c @@ -494,6 +494,13 @@ CheckpointerMain(void) */ pgstat_send_bgwriter(); + /* + * Don't sleep if our latch was set for reasons other than a + * checkpoint request. + */ + if (!do_checkpoint) + continue; + /* * Sleep until we are signaled or it's time for another checkpoint or * xlog file switch. -- 2.20.1 --EVF5PPMfhYS0aIcm--