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 1w9hVT-001f7o-1j for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 10:48:35 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9hVQ-007t0s-0q for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 10:48:32 +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 1w9hVP-007t0k-1v for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 10:48:32 +0000 Received: from fhigh-a4-smtp.messagingengine.com ([103.168.172.155]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w9hVM-00000000sxz-1g7q for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 10:48:31 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 18CFE1400183; Mon, 6 Apr 2026 06:48:26 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Mon, 06 Apr 2026 06:48:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1775472506; x=1775558906; bh=S fxPwty7SreQmScQ3b3ypyQqFD890Ipg8asJ0KBvsNo=; b=eEmPSiCZxTZsB1kx2 6CQD0mwghDI9liKQaTacgObLjU9JmHegHMaeO6ffW3Fcob58eMz5BlrgbXwexC7Z G7MzyRgH5gqNO3HHJKfToW83GkQCA5bQKH5I1qRYB8VMYVZjXg10+eiZSQYoyh/J f7tdVrliWR3mfhBccODLlq1+93ur/WOepyLEELuz1nkdbvlUiO86T+DwSwjzq4RQ 0sdbx2IxIAATf173hWxiiUiZaQX17vS0aYxjdpqEXtpiGz32UuZltjtnsGKXQhZY o44ux4Po0yqHm7Y7cxYvdLQAr6NkS1oVIb+UV9uZCpNhHDkP3wb+bq3n2r6fbT45 U4c7Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddujeehudcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetlhhvrghrohcu jfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqeenuc ggtffrrghtthgvrhhnpedvkedtffduffdtffffheffhfejjefhgfeiueeukeejkeffgfdu fffhudffffeuveenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghr rhgvsegrlhhvhhdrnhhoqdhiphdrohhrghdpnhgspghrtghpthhtohepjedpmhhouggvpe hsmhhtphhouhhtpdhrtghpthhtoheprghhsegthigsvghrthgvtgdrrghtpdhrtghpthht oheprghmihhtrdhkrghpihhlrgduieesghhmrghilhdrtghomhdprhgtphhtthhopegsoh gvkhgvfihurhhmodhpohhsthhgrhgvshesghhmrghilhdrtghomhdprhgtphhtthhopehm ihhhrghilhhnihhkrghlrgihvghusehgmhgrihhlrdgtohhmpdhrtghpthhtohepshhrih hnrghthhdvudeffeesghhmrghilhdrtghomhdprhgtphhtthhopehpghhsqhhlqdhhrggt khgvrhhssehlihhsthhsrdhpohhsthhgrhgvshhqlhdrohhrghdprhgtphhtthhopehroh gsseigiihilhhlrgdrnhgvth X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 6 Apr 2026 06:48:25 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1775472503; bh=CZfIVrdNHrrX3hcDPiEIjDwPCi901ese8/I4gLNr2ZM=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=jxgCsebiuIXwuiB0dlpxKY9hjikHPQKMJV4HqtdJ3R7z3dLJh4Eyv83T+/SxsxVG1 RBniTRWQ/JnPAIlzP55S2Ecc767KGG1WqYoBAhCZ+4DxRH96q/GNd6MM6BmNnQAYNy IsugL7gZn4K1laacDBfnku/2LHMQgD1d1AcIyxu9Qbw6yl/TJSwzpGyegxy3zczQ3P vQojt0dNmLdBPBmLgnZ7ZB3K3TO/27RVURplMAW8aF6/1kI1iuMQq9zmTtZ4OTRxvu C/FyyfxkM0JI3pD3pUYbZHc/tb/W17FUQ2e4PWDs88KYLfW+YmykhRDXUzYHSgIFOY ELo3yuKvBe1Tw== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id D556A7C; Mon, 06 Apr 2026 12:48:23 +0200 (CEST) Date: Mon, 6 Apr 2026 12:48:23 +0200 From: Alvaro Herrera To: Mihail Nikalayeu Cc: Antonin Houska , Srinath Reddy Sadipiralla , Amit Kapila , Matthias van de Meent , Pg Hackers , Robert Treat Subject: Re: Adding REPACK [concurrently] Message-ID: <202604061043.4tvvhamrwnlc@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2026-Apr-06, Mihail Nikalayeu wrote: > repack.c:2725 > > if (!VARATT_IS_EXTERNAL(varlen)) > continue; > > I think it should be VARATT_IS_EXTERNAL_INDIRECT - the same as in pgrepack:244. Right. > Also, after > > natt_ext--; > > I think it worth to add > > Assert(natt_ext >= 0); > > or Assert(natt_ext == 0); but in another place. > > Or exit early with > for (int i = 0; i < desc->natts && natt_ext > 0; i++) Hmm, how about something like this? natt_ext--; if (natt_ext < 0) ereport(ERROR, errcode(ERRCODE_DATA_CORRUPTED), errmsg("insufficient number of attributes stored separately")); I'd like to give more details, such as the tuple's identity, but that seems hard ... > ---------------------------- > repack.c:2587 > > table_tuple_insert(rel, slot, GetCurrentCommandId(true), > HEAP_INSERT_NO_LOGICAL, NULL); > > More idiomatic to use TABLE_INSERT_NO_LOGICAL instead. Ah right. > ---------------------------- > repack.c:2696 > > ExecForceStoreHeapTuple(tup, slot, false); > > AFAIU there is a memory leak here. Memory allocated above (for tuple) > is not freed in any way, because shouldFree == false. > Also, ExecClearTuple (tts_virtual_clear for virtual tuples) requires > TTS_SHOULDFREE to be set to free anything. Yeah but I don't want the virtual tuple to be materialized (which would happen in tts_virtual_materialize if I set shouldFree=true). The memory should be freed in ResetPerTupleExprContext(chgcxt->cc_estate); anyway, right? Maybe deserves a comment. > ------------------------- > grab ShareUpdateExclusiveLock (jsut like VACUUM > > typo in "just" Right. > -------------------------- > > "If the identity index is not set due to replica identity being, PK" > > Missing "FULL" after "being"? Ah yeah, I rewrote this. > ------------------------- > > Commit message: > > "intial copy" -> "initial copy" > "backed performing REPACK" -> "backend performing REPACK" Thanks! -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "Sallah, I said NO camels! That's FIVE camels; can't you count?" (Indiana Jones)