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 1vUUfj-00DQ9u-0t for pgsql-hackers@arkaria.postgresql.org; Sat, 13 Dec 2025 18:48:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vUUfi-00BPnN-0j for pgsql-hackers@arkaria.postgresql.org; Sat, 13 Dec 2025 18:48:51 +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 1vUUfh-00BPnE-1N for pgsql-hackers@lists.postgresql.org; Sat, 13 Dec 2025 18:48:50 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vUUfb-000ZQY-1j for pgsql-hackers@lists.postgresql.org; Sat, 13 Dec 2025 18:48:49 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4779cc419b2so23638285e9.3 for ; Sat, 13 Dec 2025 10:48:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1765651721; x=1766256521; 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=AB4C0JEu89to8qsULO7WECtpIzOpDNCO+vxz3eX33So=; b=esWN3VkFiYcYmDybBKCBEII9kZIZ9E5EdnC82aURsate6u6wDGh3ziwqVtnTC/olZJ 0ZhE25CMXLGjoGRtwQA2dfI6yJxP9z9e5jw3IUrVuaGev370XNIE1edE0YQFrSNlzhiy BVlgFfoU5BT7IgeKfid0Ec8bOFP8XdZCfpOS4079bPA8TaEf8XOrROf9kxMBadKca9cq Y/6o1rAxREJb/Ub+PcXy5o7AB03yqVAPjXf/3pbBgNir00s27aTrnJw3CdlIcOkK4P1u aCkJnXmuesxp+wdmfG8XeKc1xNYscJGjxf42OHWkS3miA8LdQlFdOI2d4PjXzgN6nZvP sQqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765651721; x=1766256521; 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=AB4C0JEu89to8qsULO7WECtpIzOpDNCO+vxz3eX33So=; b=vEpbOCxV0FuTt2BvKhEyWuhGMHkH/nWHXVWrDAmBVyY8swufBSygUZP/ovVY8iN0Qw 25vXQLz8vC7vqrXFw46SG8H8FC0UfvCD3bejogyXfNWVvND9JNfnO9w3jI3k0a0ZFm5D sd8akSSWrkDR/fTn/PcyzgZKJt3hoP6iAAQPxS9p/DtPTc0vkRuTl0rV85aV6jE1JjuY Li/YP6NlGJg1sRIRIW/eNe+NRdN0QUNt9edlFpxquQhW77EYbgMlUie5ZL0l/0DKeTzM VsFa60jKrgxhJaxABZeV8vLIKoUFVu/nod/78wimIbrbVQVMZuU3fWMdtAOx0OSWxRU8 gauQ== X-Forwarded-Encrypted: i=1; AJvYcCWLI3AMD8xXM0eswCkPkSvZ3uQ7E1bXQcy0BbQna/N1KCIcb9ilTzNtjM9GYpf5/IpxXl6+kuN6n5gdhe8j@lists.postgresql.org X-Gm-Message-State: AOJu0Yym4pkswPI0Gfh36CrXYAVqfGG7A6GhyP8gBcaqwW38ANX0oFct qDzVGma7VkFwP94qmSBB1Fd3ZO56YzgNArJFo800pRV70Cxy+210IIKurg5TbsrKF+Q= X-Gm-Gg: AY/fxX5f6KqkhiGd5biisTeGbfYsDNPSKvxFBEcPkxra+dxWeZTLlxmXBx3+PKZG5kI DcVYW9u1NW5QaXSyDs4bxbzTw0VP+c8qEo9W+geJPscOcRw+H/kqj04wCxha4Ts/BxuD1EtDCXL ctZWavxXVTR6EbTS67uYZzej/Q0BVbRvHgWWysc5w2+fjbG+IESF1n6OVSOyqdE2FF1XisowpW4 WflkNbvQkKxAJWRf/FZX1gdbo7yQTEX46XYoPw4mwhJsO07y6AJ1oQ1tJWC9yow/4ZI87Do+MQN LdLQLd3FLSo7sdSOTBsecua4rLd9MzXZb8mjJfH71lNJGez0agGI4/+41AOK2FB/jMqxhJz8Dn5 LokZqXP6hmmLyIYYVVeXkv2YoGa7iCCr3afY+3LUGhjILvKA53/X4eRoULTP78GxS5j1DN1qd/M JEcQ3ld5xNJCjogtsE5ROv8bfG X-Google-Smtp-Source: AGHT+IEj7iQcwC0OhYlEKOf9JY0WJ3AZm+T999rT8wrUDc4WOPlkcWZJzOranBLxYjhi7fBlyfzzhg== X-Received: by 2002:a05:600c:524e:b0:46e:48fd:a1a9 with SMTP id 5b1f17b1804b1-47a8f915c70mr60792965e9.33.1765651720523; Sat, 13 Dec 2025 10:48:40 -0800 (PST) Received: from localhost (109-81-168-246.rct.o2.cz. [109.81.168.246]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47a8f4b516bsm38652625e9.2.2025.12.13.10.48.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Dec 2025 10:48:39 -0800 (PST) From: Antonin Houska To: Alvaro Herrera cc: Mihail Nikalayeu , Pg Hackers , Robert Treat Subject: Re: Adding REPACK [concurrently] In-reply-to: <202512091915.ws6fk7csn76r@alvherre.pgsql> References: <202512091915.ws6fk7csn76r@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Tue, 09 Dec 2025 20:22:09 +0100." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Date: Sat, 13 Dec 2025 19:48:39 +0100 Message-ID: <210036.1765651719@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=-=-= Content-Type: text/plain Alvaro Herrera wrote: > Hello, many thanks for the new version. Here's a very quick proposal > for a new top-of-file comment on cluster.c, The comment matches 0005, but I had to adjust it for 0004 (no background worker there). Also, the worker writes the changes to a file rather than tuplestore (storage/sharedfileset.h seems to me an easier way to pass the data from one process to another) Besides that I made the following changes: "bloat is greatly reduced" -> "bloat is eliminated" and "table, and to cope with" -> "table. To cope with" > I haven't read build_relation_finish_concurrent() yet to understand how > exactly do we do the lock upgrade, which I think is an important point > we should address in this comment. Also not addressed is how exactly we > handle indexes. Feel free to correct this, reword it or include any > additional details that you think are important. ok, I'll get back to the earlier parts of the set, including this, in the beginning of January. Regarding indexes, one thing I've noticed recently that they get locked in build_new_indexes(), but maybe it should happen earlier. > (At this point we could just as well rename the file to repack.c, since > very little of the original remains. But let's discuss that later.) ok. Do you mean only the file or the functions as well? (I'm not going to do that now, w/o that discussion.) Attached here is a new version of the patch set. Its rebased and extended one more time: 0006 is a PoC of the "snapshot resetting" technique, as discussed elsewhere with Mihail Nikalayeu and Matthias van de Meent. The way snapshot are generated here is different though: we need the snapshots from logical replication's snapbuild.c, not those from procarray.c. More information is in the commit message. I do not insist that this should go to PG 19, just needed some confidence that it's doable, as well as some feedback. There are no tests for this yet, but I've played with it for a while and checked the behavior using debugger. I'm curious to hear if the design is sound. While working on that, I fixed some problems in 0004 and 0005 too. It shouldn't be difficult to identify them using git, if needed. Even if 0005 and 0006 won't land in PG19, these parts show that some refactoring may be needed regarding the AM callback table_relation_copy_for_cluster(). The parts 0004, 0005 and 0006 each change the argument list. It wouldn't be perfect if both PG 19 and 20 changed the API. I think we should reconsider which arguments are generic and which are rather AM-specific. Maybe we should then add an opaque pointer (void *) for the AM-specific information. REPACK could then use it to pass the CONCURRENTLY-specific information. I'm now going to prioritize the parts <= 0004. -- Antonin Houska Web: https://www.cybertec-postgresql.com --=-=-= Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename=v28-0001-Add-REPACK-command.patch Content-Transfer-Encoding: quoted-printable