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 1w9sLD-001qYx-2S for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 22:22:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9sLB-00CU70-2n for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 22:22:42 +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 1w9sLA-00CU6r-33 for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 22:22:41 +0000 Received: from fout-a6-smtp.messagingengine.com ([103.168.172.149]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w9sL7-00000000yfP-3QiD for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 22:22:41 +0000 Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.phl.internal (Postfix) with ESMTP id A240EEC0104; Mon, 6 Apr 2026 18:22:35 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Mon, 06 Apr 2026 18:22:35 -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=1775514155; x=1775600555; bh=J QXParUny7a9BJiGMl6Yf912DPH1qPp27L9Z4Ntn+90=; b=h/VUCV6tNsJgmxB6c mk25qzuoFpMDmxI81i3JrLEDQp5UxFMFXB2QEg7EKRCeZSC2sTbOhh52v1TjRkN1 cU5FEPU6XZelFW7z3U/hTbumP5GYc7FyeT3TgiT9IZ1+Nt9Lx3zTnl3uR+Yp0UG2 mRzpolAv5pBvIefXyLq4zJEVZ4Vf9/Tur6bRC5D8xeBGpmR6Y9TlmJHGR1GBLLoU nnyTclAe2+2Hbz1+vi5Kq7HiyVY4WwZWyI4iDo1wPMmMlY0w58yDpP+5btFBNQOB 4f9AuLiO7X+yisNlHT80jVXZssrLzcYxTcSy4qn/fhhcYNQQjVVeGEhfrRF2Omu7 fdtlw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgddukeelfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpeffhffvvefukfggtggugfgjsehmkeerredttdejnecuhfhrohhmpeetlhhvrghrohcu jfgvrhhrvghrrgcuoegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgqeenuc ggtffrrghtthgvrhhnpeduleekkefgtddttedtkefguddvieffleetgeejiefhteehkeev feettdduvdfhueenucffohhmrghinhepvghnthgvrhhprhhishgvuggsrdgtohhmnecuve 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 18:22:34 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1775514152; bh=bxauuqIQSRH7EksI4fFZXnjnYMUgSj75brkBFiRxsJo=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=DGTcrsYLpcZjZcf2Jnk5WlW4BFOzFNj4k3JxxdJdPiY+8Z+St2GpQHEbTgVdzGSwA 6Ne3ftWBhQKOZgD8ULR6UPED3bNKsjPQ1coiI5kAO2eGj7xTRlKCTTOdAbOJdSQXBW UcJ/Wp0lVFRKR76OF5QkBoXEjTgkpUiGi5mDSg8itIIoyGsT7LTxgMkOqyQj37Hv7O 35wrAm59sN4AhTyvZQsuM6RrGsGCK9LrotQCCs2Baj4VR+xFBc8eZdUUf9HHQvEDz6 43+ESetyZytzpZxeZAaIBv4dH1IuEORPT8YMDHA7tLoP0IgUE2TJQHDRNn+UM0lPQY OAioqPsBs5Kyw== Received: by schmee.kurilemu.internal (Postfix, from userid 1000) id 4FEC77C; Tue, 07 Apr 2026 00:22:32 +0200 (CEST) Date: Tue, 7 Apr 2026 00:22:32 +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: <202604062213.cgo352cdsgsm@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="qs77q6fpwolne4ds" 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 --qs77q6fpwolne4ds Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit Hello, On 2026-Apr-06, Mihail Nikalayeu wrote: > > 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. > > Not sure, ResetPerTupleExprContext resets just "ExecutorState". > But slots are created in another memory context. > > Also, we can't reset slot->tts_mcxt itself - it will free the slot also. So what I ended up doing, is to just not change to the slot's context in restore_tuple. That was just dumb (mea culpa). So all the memory we allocate for the slot lives in the executor context, and goes away on the ResetPerTupleExprContext call at the bottom of the loop. BTW I don't understand why you say that function only resets ExecutorState -- as far as I can tell, it does this #define ResetPerTupleExprContext(estate) \ do { \ if ((estate)->es_per_tuple_exprcontext) \ ResetExprContext((estate)->es_per_tuple_exprcontext); \ } while (0) which in turn does #define ResetExprContext(econtext) \ MemoryContextReset((econtext)->ecxt_per_tuple_memory) which AFAICT is exactly what we want. Anyway, here's the three missing parts. I have not yet edited the deadlock-checker one to protect autovacuum from processing tables under repack. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ --qs77q6fpwolne4ds Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="v56-0001-Allow-logical-replication-snapshots-to-be-databa.patch" Content-Transfer-Encoding: 8bit