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 1wF5Ts-004jSE-0f for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Apr 2026 07:25:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wF5Tr-007G07-18 for pgsql-hackers@arkaria.postgresql.org; Tue, 21 Apr 2026 07:25:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wF5Tr-007Fzz-08 for pgsql-hackers@lists.postgresql.org; Tue, 21 Apr 2026 07:25:11 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wF5To-00000002GGr-2i6t for pgsql-hackers@lists.postgresql.org; Tue, 21 Apr 2026 07:25:10 +0000 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-2b299b3c739so17745675ad.3 for ; Tue, 21 Apr 2026 00:25:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776756306; x=1777361106; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=nxiffD3r09uDnv9ucY+Y7hC9ESrAdIIbHsONdJJObBg=; b=V4+7GsFXdof6oESUl9h6l8aJWiWmpn20kESKf0W70imqeX5Mwpc6yupkZaTK62K8cf oUjLzWJ/DH4rql+XnlALr3C+yCe3Xq6l4TZedrLbWUMnqQ/NMnYZUfhcL2hjivovbhVW ol0OuPdOF8f4DSK+EXtQjBpAWVTvIgqI6woRUE6DR8dUS3MbU09A6rkWuAbCOxX20CLr rdgBXcdnSq9jN/yl9K5mWX2TmO1GhBrtJ8xiJojZYOonoBiZMa/fcCrvQqTpeywpAJqv MsyL3nJhi0YIun5huYz4OmhkdOnI8uEXut7Ft+iA4nPF2Qpcuct/CEgc2sfQ7ClmMUvu rSKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776756306; x=1777361106; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=nxiffD3r09uDnv9ucY+Y7hC9ESrAdIIbHsONdJJObBg=; b=C8tHvbVXVl72ocCax5MYfQ8JOLre/VCir8HOincseuGgQlRDSPRmy/o1WBzdURPzhC M9IWSwx0HHlQtq1/IzQU4PDKafAC9xcsedxfLb8KSNlkgEAwFTUyyISbUZjplDKu44LS kuHA9gcHLBFHstafzcggjH0RuX86fHYcyi6PZfFn30mKghycYy0AmV60wsq+Rl4iCE6C 6Ue6sJP0Z9Xmt5U2YPPx4Y7qCjifO7GCpUwby24LCRqiPsNESCqvohGcDNrDbiVrkcSI kH6e+krTFBMQY7IC+jy42MLXIv2jcVlrkOAXWejPF7EDesDHD8ALh8tVNfvpAeU8B1A5 V1DA== X-Forwarded-Encrypted: i=1; AFNElJ9YT/tqFBIoTvKlvsEjQswGGN/vWvGPOj6rh5vUftbXGXerKhB15/vqKV5g2DohJIN2NtY/zRlwPH+QI10o@lists.postgresql.org X-Gm-Message-State: AOJu0YznYgQ8Z+mzaRMF++GLHpIeWxfxHLZEUHJhi0XPL/Ncr4J+lJgI tDrk8xYlV4vsw5nJmc/pIVIS36//1VkY+/JW3WEcHyvudb5D0YtBxaem X-Gm-Gg: AeBDieuRi9SLSQN10pPYF8j4yiO8F1ulozdFUmMkF57qomOdYLjdN89w3b7lUEk/6L9 yo/pNVKs8u79z7Jdauon2IqV3jcBPLYBvm5T1dMDRW7liHCTyzluqCo8v/1k4bagNNcuVcsjg2/ fir/UWNewmm/4GngyMVfnixZK3+P48pyAwS+tQtF1KTn0AieI5M6X9sIoiLM1ZhjYfODgdFXvXQ 3cnRDF4UVBlWtF5frI4TAnIlRUiUmgvX2RvCTIcZ/eiwQdpiK0DCYXYdJI9yofjRdYV9JxvqPF/ qKg/fnWLLDgpZ6yOKRkqvZEJHudx7MUpSeK1ulMb00CR8wvUbm6yYyI7Hn3nwGJ8bqU8yUle48l w1A8H+QzNhwuYpHEzkBU3BgjXG9xxlvgXz+BmozcfXLVC1EonAIxrgf8PCiHorAacF8SJoJO6Vm zN7gbfJJhobKmExEuCc2tlN0szc5JOh55WfFjeNWHLlA== X-Received: by 2002:a17:902:7087:b0:2b4:6367:7b86 with SMTP id d9443c01a7336-2b5f9fc435dmr116763465ad.37.1776756306151; Tue, 21 Apr 2026 00:25:06 -0700 (PDT) Received: from smtpclient.apple ([45.32.121.103]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b5fab4049bsm115372495ad.77.2026.04.21.00.25.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 21 Apr 2026 00:25:05 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.21\)) Subject: Re: Adding REPACK [concurrently] From: Chao Li In-Reply-To: Date: Tue, 21 Apr 2026 15:24:25 +0800 Cc: Alvaro Herrera , Amit Kapila , "Hayato Kuroda (Fujitsu)" , Antonin Houska , Srinath Reddy Sadipiralla , Mihail Nikalayeu , Matthias van de Meent , Pg Hackers , Robert Treat Content-Transfer-Encoding: quoted-printable Message-Id: <704E4371-FDA5-488F-B5E9-6B6F86A06669@gmail.com> References: <202604072027.gazfa2zt2l2j@alvherre.pgsql> To: "Zhijie Hou (Fujitsu)" X-Mailer: Apple Mail (2.3864.400.21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Apr 10, 2026, at 18:53, Zhijie Hou (Fujitsu) = wrote: >=20 > Hi, >=20 > When testing REPACK concurrently, I noticed that all WALs are retained = from > the moment REPACK begins copying data to the new table until the = command > finishes replaying concurrent changes on the new table and stops the = repack > decoding worker. >=20 > I understand the reason: the REPACK command itself starts a = long-running > transaction, and logical decoding does not advance restart_lsn beyond = the > oldest running transaction's start position. As a result, = slot.restart_lsn > remains unchanged, preventing the checkpointer from recycling WALs. >=20 > However, since REPACK can run for a long time (hours or even days), = I'd like > to confirm whether this is expected behavior or if we plan to improve = it > in the future ? And additionally, IIUC, REPACK without using = concurrent option > does not have this issue. >=20 > Given that we do not restart a REPACK, I think the repack decoding = worker > should be able to advance restart_lsn each time after writing changes > (similar to how a physical slot behaves). To illustrate this, I've = written > a patch (attached) that implements this approach, and it works fine = for me. >=20 > BTW, catalog_xmin also won't advance, but that seems not a big issue = as > the REPACK transaction itself also holds a snapshot that retains = catalog tuples, > so advancing catalog_xmin wouldn't change the situation anyway. >=20 > Thoughts ? >=20 > Best Regards, > Hou zj > I found the same problem with LogicalConfirmReceivedLocation and posted = a fix in a separate thread [1]. So I would withdraw my patch. Looking at this patch, the change is exactly the same as what I did in = [1], but I think the code comment should be updated as well. For the = comment change, please see my patch in [1]. [1] = https://www.postgresql.org/message-id/D8D9F770-DAA2-482C-A7E0-F87E5104C13E= %40gmail.com Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/