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.94.2) (envelope-from ) id 1urD8C-002LQb-Ma for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Aug 2025 10:11:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1urD8A-00E47w-2B for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Aug 2025 10:11:50 +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.94.2) (envelope-from ) id 1urD89-00E47n-Nr for pgsql-hackers@lists.postgresql.org; Wed, 27 Aug 2025 10:11:50 +0000 Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1urD87-001zwx-1m for pgsql-hackers@lists.postgresql.org; Wed, 27 Aug 2025 10:11:49 +0000 Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-afcb7ace3baso1180367266b.3 for ; Wed, 27 Aug 2025 03:11:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1756289506; x=1756894306; darn=lists.postgresql.org; h=message-id:date:content-id:mime-version:comments:references :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=UHcFfrPCPll2MFec4HHW0Z2I3IPB70sROJ4BOmXBnso=; b=PgPeobdExzTW8U3+Etqht893onaR+vXLsmtlCIE1PDHCk/VWtKHWlxESiEXvjygyIJ ozHr4ghkBFOvDyMLpLtbi68Lh4AO9Vj4JljcpLCrl3CkEBKYN1jOLfJcUua69h9FtmKn /WJtNrWV7omGg7vyo3PutAnG3YYd6sbQfiDGqUp5moRyyHEJEX+0zPiF1Ixnaz/TNSBf tbavDuA3c0B0pnJKqnXuBaWSlvHLDQeHdc2GaBIbkh9vEkYlsib9OvevlhhSsCq9OPq+ RAB/ogHzY/tCT63Jurp81602t/vobfsRJFERthaGEVXxoBwr4pCRM+wLCL5eXo8BRcyB RzNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756289506; x=1756894306; h=message-id:date:content-id:mime-version:comments:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UHcFfrPCPll2MFec4HHW0Z2I3IPB70sROJ4BOmXBnso=; b=NxZG+gic7Je8wzS0ZaTM2EFw+2SOnawoyK7+Bk08zW7R9E6Ov1lAUk9ICn3a9xwOcN ivKi6EDGIySzUNdYMtXMaZpAW7/jRkNgeoaSAf+UyAHVAwYbwV1gaIXqAKNiXxd/f0DN brmhQVjCegbLj4Glw1qldyxufbDHvZKbd4q8sm4JgfHlW5H54trE6ubBYyXjj0eQHWcl O7bIpHumfiNLZIFp1D/0JEasQaFAGmjhTlbfdlp3OduHi0IWUWMK57J2wz/zhLNj28m9 mrmQ895vq6r5UhDK7hnu1mBeKF1EAX5wGHXyKG0TtWfaTvoiTm1tADzkEMy1NFrke0xK x+ag== X-Forwarded-Encrypted: i=1; AJvYcCUnQQ/bFlxnjQ0URNixDRanOwPxLB0CUIZAwPQdQO7NRVWYbXxtlXCXXj3yYLr8NpGcDNUE4gUQIW+qB1R6@lists.postgresql.org X-Gm-Message-State: AOJu0Yz9nhHu2aCA0+D3zngMzzmZkWK0nMH1SL94A7p7fA48PMQ4IZLJ m2jJr549DqSXR6cs26W3lwRGNoBSkFTIkiNVw+oS1xtGbE0CvwsOw66KV4PyyeyHwYY= X-Gm-Gg: ASbGnctgaSWXbGWF/u8g4/y0f1RtPZBV5lJWZU+LFyhqaSSbCeeiK1hf3vbXSsC1nyA VYGT/Zk2BZoIB/gQMRwMM6qGsgHPBVaImCB01x4r1vZWQo22FoxNz/2o0lJo1CY8OLyVAW4oUY9 8o2nk5Lz0drXHBADqTbOoMejGcSKSumOObnryNBg4hObb5mCZL0xjBBZ+kNSVGB+B6q25dwy3k8 P3EbcRvEyFXpHZIBn1Rw+EEfaMgNFrwdeySzkgKR8+RYPsBqe9sr7QHq3JVD+BVr2t8Rxsgr1G7 qDqFc8II8/m2GvCUY6wbAeH1RcpjQSbd5JTGjU/ENAd6YmzXpv4wfziSet6gCYxjLeHzQNB1MTU QhPgmQK0DHA6pKWBMj1KTxszaX+q0M5EKQXpK7CbDw6S/2Kg= X-Google-Smtp-Source: AGHT+IGXW3CqalPm5K3eEMCX1p2Lws34AUIQWQgxKKn9J+HTgu7tU8eiRB2khgWYRv7phNZhZmm+XA== X-Received: by 2002:a17:907:e98b:b0:afe:7bc0:4d0e with SMTP id a640c23a62f3a-afe7bc04e59mr885792266b.23.1756289506366; Wed, 27 Aug 2025 03:11:46 -0700 (PDT) Received: from localhost (109-81-168-144.rct.o2.cz. [109.81.168.144]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-afe98cbf721sm422621966b.30.2025.08.27.03.11.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Aug 2025 03:11:45 -0700 (PDT) From: Antonin Houska To: Mihail Nikalayeu cc: Alvaro Herrera , Fujii Masao , Robert Treat , Pg Hackers Subject: Re: Adding REPACK [concurrently] In-reply-to: References: <202508091333.qvgvo7ikuezm@alvherre.pgsql> <40729.1755799624@localhost> <9536.1756127358@localhost> <21931.1756136535@localhost> <24483.1756142534@localhost> <4790.1756197960@localhost> <29527.1756215093@localhost> <6931.1756275367@localhost> Comments: In-reply-to Mihail Nikalayeu message dated "Wed, 27 Aug 2025 10:22:24 +0200." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <17669.1756289505.1@localhost> Date: Wed, 27 Aug 2025 12:11:45 +0200 Message-ID: <17670.1756289505@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Mihail Nikalayeu wrote: > > A new kind of snapshot seems like (much) cleaner solution at the moment. > > Do you mean some kind of snapshot which only uses > TransactionIdDidCommit/Abort ignoring > TransactionIdIsCurrentTransactionId/TransactionIdIsInProgress? > Actually it behaves like SnapshotBelieveEverythingCommitted in that > particular case, but TransactionIdDidCommit/Abort may be used as some > kind of assert/error source to be sure everything is going as > designed. Given that there should be no (sub)transaction aborts in the new table, I think you only need to check that the tuple has valid xmin and invalid xmax. I think the XID should be in the commit log at the time the transaction is being replayed, so it should be legal to use TransactionIdDidCommit/Abort in Assert() statements. (And as long as REPACK CONCURRENTLY will use ShareUpdateExclusiveLock, which conflicts with VACUUM, pg_class(relfrozenxid) for given table should not advance during the processing, and therefore the replayed XIDs should not be truncated from the commit log while REPACK CONCURRENTLY is running.) > And, yes, for the new snapshot we need to have > HeapTupleSatisfiesUpdate to be modified. > > Also, to deal with that particular race we may just use > XactLockTableWait(xid, NULL, NULL, XLTW_None) before starting > transaction replay. Do you mean the race related to TransactionIdIsInProgress()? Not sure I understand, as you suggested above that you no longer need the function. > > No rush. First, the MVCC safety is not likely to be included in v19 [1]. > > That worries me - it is not the behaviour someone expects from a > database by default. At least the warning should be much more visible > and obvious. > I think most of user will expect the same guarantees as [CREATE|RE] > INDEX CONCURRENTLY provides. It does not really worry me. The pg_squeeze extension is not MVCC-safe and I remember there were only 1 or 2 related complaints throughout its existence. (pg_repack isn't MVCC-safe as well, but I don't keep track of its issues.) Of course, user documentation should warn about the problem, in a way it does for other commands (typically ALTER TABLE). -- Antonin Houska Web: https://www.cybertec-postgresql.com