Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w9cS2-001alm-0z for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 05:24:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9cS0-006fTO-2a for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 05:24:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w9cS0-006fTE-1c for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 05:24:40 +0000 Received: from mail-lj1-x22e.google.com ([2a00:1450:4864:20::22e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w9cRy-00000000ntS-38Hs for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 05:24:39 +0000 Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-38de18126e7so17522901fa.1 for ; Sun, 05 Apr 2026 22:24:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775453076; cv=none; d=google.com; s=arc-20240605; b=TcH8FdPl2F/wOLE+e4bmNwO9i93ZSDzY+0jeW1E21eoVZg3HCD4SWERpi+PFCHM+Il YCTT8AtaGJvOxr6TMkhVil5pmPaAIRkQx6e7eHGYca9ocdq1mGcWdmq9lf9Ys83L+/b8 SNo7hRLDD0UehrDiZRpwzv79SAahRtkcHSAWmpxNycgdv+OI1ge1K4kpUqPScOxOUFUF rjhq/RHjzBIje2RgWEcKnUA+tERGBOEbQdmHAIiVIVuiZ+Zlo+i+AzMmnre2mrLxGXPA Ub+k9oxHmIbQtvjcXjpo2gkwBvRr+Q8RH1FUXEO3qfr6CUPvAi1GmVYt9IqotmizGYjj 7I3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=dCftpjDF4GEMJ9KLlHW/Cz+slClmn/intpIlzt5cs+o=; fh=q8ktQaINmHHVrdsKxG5h3jFGNTGDxcMLgyQJLrU3nhw=; b=abVaEXoYTudOpizFfMT1i8iJJ37VIbSvrJ/w94/TjZTxHa0DdtB/FB2vOjsNGfQGjT MLD6VBS2123v3DA6cWUOfw4IExuvECmC11NH4ac6BfuSIJNWkGplzmjLwrCVi1iYjD2T gt6lJsEwAwb4t/IEqC6jezAmrAQXNFb06RUbHi69doWdGgn+HZ/7KF8JDFHvH6yhJ9fb /xR3Oe5sC7iZYD9H4GHYM3bxYnZ0cIdwBGYkRpZQKU16cuTvuTzWjnt+i2hVV3GnLTDa Dahle5jiWjMRYrLFNMMp8DnjqGnP55Ie2TodKDF2s3vM5S9z42WDoyCKqr2eK09h2rM2 UaXg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775453076; x=1776057876; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=dCftpjDF4GEMJ9KLlHW/Cz+slClmn/intpIlzt5cs+o=; b=AX93wEjJakILISA+D3lG3wfU1gGPLQhMGP86ZPxa/z0Fva1MkNk3RH+cLbjQbihfUx aLHi0FwHgkstsXthcqfobiLowGUmhKUGT9WC1UEADHdpvxXgWVv2xf91Kb7BRmb+F0Vh zFSwzcF08ExJ9aniHG947j1FiMZDMGrf7+uAMS5ss2H1tVh2rKYgTgtW2ejYP7e7Eks5 QgtWYtzhNzV0RbFGOJ1V/dpXiyLJL2E3iEg23HtJTOYQyGanCTrS0FZrJeNcCvVcKMOR w83uvfXRsv4/pxG5K4/rIkunmy8TduUzRYQtK7JWIvcQvwXjS6UvzjbTv+lt9MLnAH6W 7TvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775453076; x=1776057876; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=dCftpjDF4GEMJ9KLlHW/Cz+slClmn/intpIlzt5cs+o=; b=BXoAybAVWQv1WDEjVhyNExCxtRxD84OfaAVIvLWSUT1+2Ps8d9HRlHlhCycPSH6Grw xR85am6BS3pwst8z3QAb6xy4a22bLXZJ7rQ5z7h6o2B3hiTaBclWCH5Zkk8BPWChwBQw TJL/1EaIYbKElW/Aayi0dDq5H3IgrGSxcuwYOjdH6rfiyThFz/dV3kPWOuxY6X1QE3z0 lebwRbTLQM22/zmE/KfuHKwkizrDM6uYaqxjDN32ZnEkGXcFFnx2PgSYdmUQiB6Z8in3 oVgn7xglCtUL9s+xyAwePqqR9zHPjNdX42AJFbeaWjl8C0aIS+rjIDo1LQ6rKgJfwf6b SAjA== X-Forwarded-Encrypted: i=1; AJvYcCXjj7Ea9YauMl2ZO6nJl5QgoHdIVtPkgKV+0S8ejdTV5QgZIk3pPJToRg5wnQ0RqZBAaXnhQquTvkBPRvP9@lists.postgresql.org X-Gm-Message-State: AOJu0YxKHoTcSHn4aF7Wil0c4VUufznkbkuXHK9Cesa7YiEEYU3sKQgn Ji4cx58LH59ypPQH891gCKkmmObylIcVgERjkT9R7O9ALLc5pBYOGYH4ifLjoIRFZf3kBIz6cgI lRTqIIzORLMRgPiOwwfCOSceqf726Fho= X-Gm-Gg: AeBDieuuDBz2xkl1DQxzZXvBlVjSdV6ysrHcltZN2c860nhnNfZJoWy6I35Ywvp600z JEowIBdKQvsGNdABPPiMv/XNvhCLErKGdjqE/E6eMC6nQ1K13jbGkH9NVSj2EFemrdKKbPGyun5 mqcYcs+49DPZwh543nQ5EJS3BWi3DLU3soaBn1eeeSA2UlRaF7Edy5Vt8QdMwr6j3zNQs2CJeWR mMmc2jbMLbfUOqu+QEJx90CFBlUxsfRDChPGSumHmD8VMlyk/SluHsAaM2re/kMrrDchesDDgwm MaLljyvtDLADifXkZv43ComhDClVx4Ericf8REPnJ0FLTj+cmaWQ X-Received: by 2002:a05:651c:110c:b0:38d:e7cc:2971 with SMTP id 38308e7fff4ca-38de7cc31afmr21214741fa.9.1775453075799; Sun, 05 Apr 2026 22:24:35 -0700 (PDT) MIME-Version: 1.0 References: <202604040949.opyhm3tgddvt@alvherre.pgsql> In-Reply-To: <202604040949.opyhm3tgddvt@alvherre.pgsql> From: Amit Kapila Date: Mon, 6 Apr 2026 10:54:23 +0530 X-Gm-Features: AQROBzA6vTMY4eCvHly6lgHSffaw-b3bXlkIIumgr8T2147rmDbuemvZfKEym4o Message-ID: Subject: Re: Adding REPACK [concurrently] To: Alvaro Herrera Cc: "Hayato Kuroda (Fujitsu)" , Antonin Houska , Srinath Reddy Sadipiralla , Mihail Nikalayeu , Matthias van de Meent , Pg Hackers , Robert Treat Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Apr 4, 2026 at 3:49=E2=80=AFPM Alvaro Herrera wrote: > > On 2026-Apr-04, Hayato Kuroda (Fujitsu) wrote: > > > While testing REPACK CONCURRENTLY command with xid_wraparound module, n= oticed that > > wraparound-autovac worker was terminated with an error like below. > > > > `` > > ERROR: could not wait for concurrent REPACK > > DETAIL: Process 41512 waits for REPACK running on process 41027 > > CONTEXT: waiting for ShareUpdateExclusiveLock on relation 16384 of dat= abase 5 > > automatic vacuum of table "postgres.public.test" > > ``` > > > > The behavior is different from other commands, like LOCK and maybe norm= al REPACK. > > In these cases the autovac worker would wait till the command fails. > > > > Is it an intentional behavior? If so, what is the advantage that we ter= minate the > > failsafe vacuum? > > Hmm, this is intentional; see here: > https://postgr.es/m/202604011050.7ya3k4ccd3hg@alvherre.pgsql > Note that in order for this to happen, the autovacuum must be starting > when the repack is already underway. The theory behind this behavior is > that the autovacuum run is not useful anyway: its purpose is to advance > the freeze xmin/multixact, but the repack is also going to do that. > Once repack is done, autovacuum can assess again whether an emergency > vacuum is needed, and launch a worker in that case. > But won't it delay in update of datfrozenxid/datminmxid? For example, say repack errored out due to some reason, won't it further delay the update to datfrozenxid/datminmxid which in turn can delay truncate of clog. Is it possible that after repack errored out the launcher delays in picking the same table again which further add to such a delay? > Do you think it would be better if we allowed autovacuum to continue? > IIUC, the disadvantage of letting it continue is that if repack is successful then we have unnecessarily occupied the worker which won't do anything useful. If we want to not let autovacuum continue then we should somehow deal with boundary cases which shouldn't lead to delay in making progress to update frozen xids. > I'm not 100% myself of this new behavior, and it would be very good to > give it some more thought. > > > I suppose it's unfortunate that autovacuum launcher is going to try > again and again to get workers to process that table, and they are going > to be killed over and over. Maybe it would be better to have autovac > ignore those tables. > I feel that would be better at least when we know that the repack concurrently command is already in progress. It can help avoid launching workers again and again, especially when repack concurrently command is going to take a long time. --=20 With Regards, Amit Kapila.