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 1nLeIV-0000Kv-Gg for pgsql-hackers@arkaria.postgresql.org; Sun, 20 Feb 2022 04:58:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nLeIT-000362-LD for pgsql-hackers@arkaria.postgresql.org; Sun, 20 Feb 2022 04:58:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nLeIS-00035s-V1 for pgsql-hackers@lists.postgresql.org; Sun, 20 Feb 2022 04:58:09 +0000 Received: from mail-qv1-xf35.google.com ([2607:f8b0:4864:20::f35]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nLeIL-0005pM-PO for pgsql-hackers@lists.postgresql.org; Sun, 20 Feb 2022 04:58:07 +0000 Received: by mail-qv1-xf35.google.com with SMTP id a19so23624127qvm.4 for ; Sat, 19 Feb 2022 20:58:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=aeB8wvQmoLZbbGiw1YSNE/wZWWIePd5QPQPBMXd9chs=; b=ZQVMjYIegOUAUkj5sob1OpmXLXm1glqbNFGIi6WypHIQnchs+XM0habcjqaKmIH3OC n5D8J7gSj5uvHAlSuudg/AVl/r15FhtldRTNyv30vjJz21d4E53AdpzCNyvDJH1fYw7W dg0ofpSI4pjgZLkUedhc5bWzPXwtmVeehkado= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=aeB8wvQmoLZbbGiw1YSNE/wZWWIePd5QPQPBMXd9chs=; b=vvG2+sfrEZqXqf3Jiw3+tDYZIeyVZJDVVMLZkh2WN+oQaCuARUk2FK+1e7WuuePGE5 C2C/yv4U5Mg0uG+C2T9kS9StG7uKPBTaOFsyP6Dizxi0YIA3psCX9k+KSnaK3y6z95f0 ewOgm+mHI/+D5W+WJQNvHGwRXw8/jgJ6X6DylMQLNzrpwEF273d7cpMBcGlDwkVEHiXp iynD9I/M3MrI0254T+3XN+FK+exsU7ecdRVsaEK+mcxotvn0R0+iugdOr+sEL1kz6wP7 9efpIOik/dW3NwTFiqtKP5IVUggs565cenx4oqtNnLVabt4BPt8sleGhumc+CI4m+o8C c6uw== X-Gm-Message-State: AOAM5329li+QAKs9yW8IqvSBc+SbKgj3xm2eNULEbe96sMSrdinHH3gw G3fJHDZAhj+rQIYo0AY8BYuRfg== X-Google-Smtp-Source: ABdhPJwH7bPpq6oMaTsiAR7GbRI4NuJwrDmShFuIrmhHyFz/xRNzF5mbZnc5ClIi4zpaDHy+JipuXg== X-Received: by 2002:ac8:5ad2:0:b0:2cb:96f9:caa4 with SMTP id d18-20020ac85ad2000000b002cb96f9caa4mr13042616qtd.640.1645333080445; Sat, 19 Feb 2022 20:58:00 -0800 (PST) Received: from rfd.leadboat.com ([2600:1702:a20:5750::2e]) by smtp.gmail.com with ESMTPSA id b10sm28200048qtb.34.2022.02.19.20.57.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Feb 2022 20:57:59 -0800 (PST) Date: Sat, 19 Feb 2022 20:57:57 -0800 From: Noah Misch To: John Naylor Cc: Peter Geoghegan , Andres Freund , Robert Haas , PostgreSQL Hackers Subject: Re: do only critical work during single-user vacuum? Message-ID: <20220220045757.GA3733812@rfd.leadboat.com> References: <20220203215048.rmwjzixdzaetedxq@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Feb 16, 2022 at 03:43:12PM +0700, John Naylor wrote: > On Wed, Feb 16, 2022 at 6:17 AM Peter Geoghegan wrote: > > On Tue, Feb 15, 2022 at 9:28 AM Peter Geoghegan wrote: > > > > I did notice from my own testing of the failsafe (by artificially > > > inducing wraparound failure using an XID burning C function) that > > > autovacuum seemed to totally correct the problem, even when the system > > > had already crossed xidStopLimit - it came back on its own. I wasn't > > > completely sure of how robust this effect was, though. > > I'll put some effort in finding any way that it might not be robust. A VACUUM may create a not-trivially-bounded number of multixacts via FreezeMultiXactId(). In a cluster at multiStopLimit, completing VACUUM without error needs preparation something like: 1. Kill each XID that might appear in a multixact. 2. Resolve each prepared transaction that might appear in a multixact. 3. Run VACUUM. At this point, multiStopLimit is blocking new multixacts from other commands, and the lack of running multixact members removes the need for FreezeMultiXactId() to create multixacts. Adding to the badness of single-user mode so well described upthread, one can enter it without doing (2) and then wrap the nextMXact counter.