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 1lisIX-0002hR-On for pgsql-hackers@arkaria.postgresql.org; Tue, 18 May 2021 05:29:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lisIV-0005Pa-Ho for pgsql-hackers@arkaria.postgresql.org; Tue, 18 May 2021 05:29:39 +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 1lisIV-0005PQ-89 for pgsql-hackers@lists.postgresql.org; Tue, 18 May 2021 05:29:39 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lisIO-0003Iq-8D for pgsql-hackers@postgresql.org; Tue, 18 May 2021 05:29:38 +0000 Received: by mail-pl1-x636.google.com with SMTP id t4so4444419plc.6 for ; Mon, 17 May 2021 22:29:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4JLx5YVOoX23GBMKYi6MjPsWXoLx4GVREraumxEY6cU=; b=vDauAelCYnVAigAjHGtae/N/JFxQBO3N6KTE9tDqdl8QROrWA4jP9hYw+UGggUu3+X PLRDGGxm7cAY2Ph3wJ0JX62jWUzgC+xY+nksHAvYekBlyMqsgtD5oaPqiG3f/gO3flkE x0t6ojXr2YCjDn2g8Zs55ic5DtB67MQPzVB4IyhVElG23RrYs06w6fNVB1vNuNSNQa40 FCokLNWUBNk0Y/enL4aHpgDepXwrty5dVLRKwc5N1rWPJA8MdXJZMzvKq1vpm2eOl20I U254k+tRT7SVllr8FKk4GuGyYpTkwcDCV0jw0VPVabQsIZ5OM193YC5ltdHkUnDcemx/ 5c/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4JLx5YVOoX23GBMKYi6MjPsWXoLx4GVREraumxEY6cU=; b=C2MkNouu1geQSOroDihfKL86KQn5+a5IjXEMmtwwIljtIl9E370xSoOyWTLG5UozQI x9d80KAT8aAPlnm/ESac9CNF3p6Lkz7/roS8rgXPRIKMKuwsIAa9HkbuDMclkFDfUd14 DDJK87gxOAF8d/t2+rwqCTRdC+Td9QS2BlevjUMrfIV6Jc2wXRgJ7XAzzWM3TKGM0meB 1Bik+Vj6PPI1uBAWN2++3sJyF1E87RKsvK0J4zrMHjdKDP3SOB0wp9cXIImPrKLk7aq5 E52UI5m5XgJdbO1o4+UFilDhFxSgWDhmtENMmA32bJQ/TwPTq8xkLN/8sss3RcqRY0kI 3w7g== X-Gm-Message-State: AOAM533f4DEbAU7rBRbTDKCaa13NRrbPBnCdLCybjn1r5HHi6lJVbhN3 ZQDQjm1x0zDEB5CZvv5oTZIJSmhuKwr7YfSnvS4= X-Google-Smtp-Source: ABdhPJzcedkDn4FLdzAwF24u0KnpQGXDK2hvvip8dHQ1w54Swi/9Tf/UKR4Da/1/GorEQsojV1mfOgWVJldz64FpCqg= X-Received: by 2002:a17:90b:4a11:: with SMTP id kk17mr3680549pjb.124.1621315769424; Mon, 17 May 2021 22:29:29 -0700 (PDT) MIME-Version: 1.0 References: <20210423204306.5osfpkt2ggaedyvy@alap3.anarazel.de> <20210424002921.pb3t7h6frupdqnkp@alap3.anarazel.de> In-Reply-To: From: Masahiko Sawada Date: Tue, 18 May 2021 14:28:53 +0900 Message-ID: Subject: Re: Testing autovacuum wraparound (including failsafe) To: Peter Geoghegan Cc: Andres Freund , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Apr 24, 2021 at 11:16 AM Peter Geoghegan wrote: > > On Fri, Apr 23, 2021 at 5:29 PM Andres Freund wrote: > > On 2021-04-23 16:12:33 -0700, Peter Geoghegan wrote: > > > The only reason that I chose 4GB for FAILSAFE_MIN_PAGES is because the > > > related VACUUM_FSM_EVERY_PAGES constant was 8GB -- the latter limits > > > how often we'll consider the failsafe in the single-pass/no-indexes > > > case. > > > > I don't really understand why it makes sense to tie FAILSAFE_MIN_PAGES > > and VACUUM_FSM_EVERY_PAGES together? They seem pretty independent to me? > > VACUUM_FSM_EVERY_PAGES controls how often VACUUM does work that > usually takes place right after the two pass case finishes a round of > index and heap vacuuming. This is work that we certainly don't want to > do every time we process a single heap page in the one-pass/no-indexes > case. Initially this just meant FSM vacuuming, but it now includes a > failsafe check. > > Of course all of the precise details here are fairly arbitrary > (including VACUUM_FSM_EVERY_PAGES, which has been around for a couple > of releases now). The overall goal that I had in mind was to make the > one-pass case's use of the failsafe have analogous behavior to the > two-pass/has-indexes case -- a goal which was itself somewhat > arbitrary. > > > The failsafe mode affects the table scan itself by disabling cost > > limiting. As far as I can see the ways it triggers for the table scan (vs > > truncation or index processing) are: > > > > 1) Before vacuuming starts, for heap phases and indexes, if already > > necessary at that point > > 2) For a table with indexes, before/after each index vacuum, if now > > necessary > > 3) On a table without indexes, every 8GB, iff there are dead tuples, if now necessary > > > > Why would we want to trigger the failsafe mode during a scan of a table > > with dead tuples and no indexes, but not on a table without dead tuples > > or with indexes but fewer than m_w_m dead tuples? That makes little > > sense to me. > > What alternative does make sense to you? > > It seemed important to put the failsafe check at points where we do > other analogous work in all cases. We made a pragmatic trade-off. In > theory almost any scheme might not check often enough, and/or might > check too frequently. > > > It seems that for the no-index case the warning message is quite off? > > I'll fix that up some point soon. FWIW this happened because the > support for one-pass VACUUM was added quite late, at Robert's request. +1 to fix this. Are you already working on fixing this? If not, I'll post a patch. > > Another issue with the failsafe commit is that we haven't considered > the autovacuum_multixact_freeze_max_age table reloption -- we only > check the GUC. That might have accidentally been the right thing to > do, though, since the reloption is interpreted as lower than the GUC > in all cases anyway -- arguably the > autovacuum_multixact_freeze_max_age GUC should be all we care about > anyway. I will need to think about this question some more, though. FWIW, I intentionally ignored the reloption there since they're interpreted as lower than the GUC as you mentioned and the situation where we need to enter the failsafe mode is not the table-specific problem but a system-wide problem. Regards, -- Masahiko Sawada EDB: https://www.enterprisedb.com/