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 1w9IJw-001KMZ-2m for pgsql-hackers@arkaria.postgresql.org; Sun, 05 Apr 2026 07:55:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9IJt-001v45-20 for pgsql-hackers@arkaria.postgresql.org; Sun, 05 Apr 2026 07:54:58 +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 1w9IJt-001v3x-02 for pgsql-hackers@lists.postgresql.org; Sun, 05 Apr 2026 07:54:57 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w9IJp-00000000eFA-2M9z for pgsql-hackers@lists.postgresql.org; Sun, 05 Apr 2026 07:54:55 +0000 Received: by mail-wr1-x436.google.com with SMTP id ffacd0b85a97d-43b95e5b3afso1771784f8f.3 for ; Sun, 05 Apr 2026 00:54:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1775375691; x=1775980491; darn=lists.postgresql.org; h=message-id:date:mime-version:comments:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=Lgj2T4zcRkMJZ2rAZFrP1BemUWMZDqlS1y7C2/PPOfo=; b=F1tfkN5LP1O3a6wZWZglHZtvZvMOq+Y7pTrSHH0QZQzHTCGdCMZ5ehEFF+/q9jeHnw Fm8L/9sDY/+7Qh0TuumdozcWsFfsmFUwPOjwdgHhM+ADhFQFw4eXSVF1WZR1ttHn2y4P CluyYBlScIiN3nq+sp/pXkWlW53m81Ejx6+/NAOtlBWw/vbTmKmoc6KP1DFkXxjYEYdj QUb1dYF6or3nv2HX0OSjj6aPI4wW9EyMOITMfzyG0Pc3o0A4LcNoCFn0ett7r6L0dHK9 QKVS0Kj1sF00wlvKVhv5iEIzIiV0Sjun3ygka3LwrezyHc4lQyhQ9Gp7mb2lg11TK/O2 F9NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775375691; x=1775980491; h=message-id:date:mime-version:comments:references:in-reply-to :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=Lgj2T4zcRkMJZ2rAZFrP1BemUWMZDqlS1y7C2/PPOfo=; b=MNbEcPWNHs5pS9Jq0Gx4Tv1D+jA6uMbI8jpDFeL20VhIHrkRrHakJuj0pqWA93Z022 n6odcWR+rpjc/Qi8uXi6OAe14reS8KtKDWf4P7WEKieQgeww3sYRs22XhMSrPLyFDyhw k98MzXsz6S7ouz1psxIW8M56A9qFxi3IJbwFapn4BsOMmU7U+tTQ4cLgbWK5Tmkj779n tf4lNGh+k5WahsxfaTMwwxxgS++8QLjNACP30vLIq8jdZulumbgDzqYAkTbT7nCkwMHC f1bDN65VuyvL7pEKRTF8vuhYZ2io8a+dvjbLacqFiNg2Jjy5+BtjM4ahWhlJFv9DGauu x73g== X-Forwarded-Encrypted: i=1; AJvYcCULqh6iuU/MU4rUknVS53YGznMDIH++zcJvtrU3QUUaPlOmbSyQmRBQ1GlpCKAR0aLcVfTyGFpsorXU/35f@lists.postgresql.org X-Gm-Message-State: AOJu0Ywhas2PV1nnjNxgyqDvQ+zp6h+4lgbZ1Uvzzwosopc2dyMAHNT6 cajHaoRlv6W8ulRqZqpBHbqnardfTNHKzyJii8YoQlCs1RQYMYCngjKvM5jcMDhVKr8= X-Gm-Gg: AeBDies0Gzh5ef+ByEVSfyZhHye7Xws8PmEUF8W+at1gp68CZKjxn2UDGBa5gxJuwvN ZeJhs/bKl0xcVt0jb1E307g3TtmQM8tzupGwv7G8dmkOViReVvfCtXBB7i395ob+iVgHuak77F7 7gP5kaiyjCjhns6tAjeHi/p17Mf9tJF4CEp2FSp9D4/jWGJrD9rBQmCgks+vsU1GR5ZyiKRL7Er kb89aLo3h7zOQ79iEbBmnz392h7hhAwfP+Gs0HJRKeLNbN3ihKNEI3v2upUOW2pLpg3cLFAICGa 7bVlLhPle/PJia/okMt3Y87GjmvpBTjTb5wXParRY0Rv5GaRca6r2uovDyGpFSTSRwXSw6QhGy9 7e9fOSU+llr3jZNfHlrFNua3zN8NTcP4z3eQcPkXDxHKaaPAVL5hmqgp8BhFldk8h+eCzvBU0lM q/8MDcJzEyIDZqml8Lu/qJuJpHjPd8ls0VkzYx X-Received: by 2002:a5d:584b:0:b0:43c:ef4f:79de with SMTP id ffacd0b85a97d-43d2927bbb6mr13532701f8f.16.1775375690557; Sun, 05 Apr 2026 00:54:50 -0700 (PDT) Received: from localhost (109-81-168-142.rct.o2.cz. [109.81.168.142]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43d1e4f52easm31593866f8f.36.2026.04.05.00.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Apr 2026 00:54:49 -0700 (PDT) From: Antonin Houska To: Alvaro Herrera cc: Srinath Reddy Sadipiralla , Amit Kapila , Mihail Nikalayeu , Matthias van de Meent , Pg Hackers , Robert Treat Subject: Re: Adding REPACK [concurrently] In-reply-to: <202604042326.nwa4o5sezj77@alvherre.pgsql> References: <202604042326.nwa4o5sezj77@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Sun, 05 Apr 2026 01:53:09 +0200." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Date: Sun, 05 Apr 2026 09:54:49 +0200 Message-ID: <19989.1775375689@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=-=-= Content-Type: text/plain Alvaro Herrera wrote: > On 2026-Apr-04, Antonin Houska wrote: > > > Alvaro Herrera wrote: > > > > > On 2026-Apr-04, Antonin Houska wrote: > > > > > > > I agree that the global variable is not handy, but instead of modifying > > > > CreateInitDecodingContext(), how about adding a boolean returning callback to > > > > OutputPluginCallbacks? The point is that whether shared catalogs are needed > > > > during the decoding or not is actually property of the plugin. > > > > > > Oh, yeah, that sounds good to me. > > > > This is it. New callback was actually not needed, I just added a new flag to > > the OutputPluginOptions structure. > > Thank you, I removed the previous one and picked up this one (it's 0001 > here.) The only potentially troublesome thing I see with it is this change: > > /* > * Update range of interesting xids based on the running xacts > * information. We don't increase ->xmax using it, because once we are in > * a consistent state we can do that ourselves and much more efficiently > * so, because we only need to do it for catalog transactions since we > * only ever look at those. > * > * NB: We only increase xmax when a catalog modifying transaction commits > * (see SnapBuildCommitTxn). Because of this, xmax can be lower than > * xmin, which looks odd but is correct and actually more efficient, since > * we hit fast paths in heapam_visibility.c. > + * > + * If database specific transaction info was used during startup, the info > + * for the whole cluster can make xmin go backwards. That would be bad > + * because we might no longer have older XIDs in ->committed. > */ > - builder->xmin = running->oldestRunningXid; > + if (NormalTransactionIdFollows(running->oldestRunningXid, builder->xmin)) > + builder->xmin = running->oldestRunningXid; > > > I can't see any problem with advancing the ->xmin only when it goes > forward, but I wonder if it's possible to introduce any bugs this way. > > > This bit looks funny though: > > /* > * Advance the xmin limit for the current replication slot, to allow > * vacuum to clean up the tuples this slot has been protecting. > * > * The reorderbuffer might have an xmin among the currently running > * snapshots; use it if so. If not, we need only consider the snapshots > * we'll produce later, which can't be less than the oldest running xid in > * the record we're reading now. > */ > xmin = ReorderBufferGetOldestXmin(builder->reorder); > - if (xmin == InvalidTransactionId) > + /* > + * Like above, do not let slot xmin go backwards. > + */ > + if (xmin == InvalidTransactionId && !db_specific) > xmin = running->oldestRunningXid; > > I probably need some sleep, but this doesn't make sense to me. ok, maybe just skip the whole cleanup in that special case. -- Antonin Houska Web: https://www.cybertec-postgresql.com --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=nocfbot.v53-0001.2-Introduce-an-option-to-make-logical-replication-.patch