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 1w0LtL-001pvW-1J for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Mar 2026 15:54:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w0LtJ-00A03T-2V for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Mar 2026 15:54:34 +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 1w0LtI-00A03K-2W for pgsql-hackers@lists.postgresql.org; Wed, 11 Mar 2026 15:54:33 +0000 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w0LtB-00000001d9I-0AYy for pgsql-hackers@lists.postgresql.org; Wed, 11 Mar 2026 15:54:32 +0000 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-485345e1013so9104525e9.1 for ; Wed, 11 Mar 2026 08:54:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1773244464; x=1773849264; 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=aStmyQU10QDL93BIZXTZdbPSswmBnW7kPRHvig2VCvk=; b=gwSdVpaXr5Ym/UItKFcMpaU6Iz/DTZIjiiCbo2kkEZpo2vHEEfNZqALOG1J9AhciLd ayGSzs6kygcVZFVgLeKvvV5Go6PB6RIx+QE6zTlo7sMY/LzYeRVjJq8NiMsdX/1o6WZ9 wvZ18y3TW6Ah1bOj51gkCjlNa0TBqfEhzvmI+McO0s5Q7e6wIa5lRDxMl07WS2s0ek8l jP1jo53sf3rb6hisJj65T9Lud1gQOkgs3vaowZBtdDZsXewdBFii/JH7XGZpJf75faCk 0OCYDKKzFrwkwmZsxLH85U63cJfVI7tgXDvFGX4k1hn2SySLc8wt0NKu64gDvuWd6LLd qrQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773244464; x=1773849264; 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=aStmyQU10QDL93BIZXTZdbPSswmBnW7kPRHvig2VCvk=; b=OnVPrQAqbdBV64WIRYK/NTDMyi9mEPsIsk8ibrx1wtRrn8AYQAxaaHwq0mEcdmwxCG XEA8hZTE6ilm7i5/Dv8T8nVc8WfzFF4aPus1/JWQ9vTSjct+invw9yZ7+NzekUXe/w4O 8ARclcWeQnTAoTYrtJmB/I4h3hRXHVLpImPbnQMINXeJQJgxqCRxmFnhjntZlSoISmiA RKA1R8jPyXpNjdB+A16g5VBqqFAyFCJfz5u42yLfI0IHr4CgQw7olqmemtTzS+LBqLEO G9M9UtRpqpR54v8tqag20S1qRRQgOXqqIyZzHSM1CHczP/NJMUHUVCqxYemb2FGRWhkO RCew== X-Forwarded-Encrypted: i=1; AJvYcCWbJU/R27mORAKDX5WBbuEAvHHtcjXq+vv0Ac6nsjPKJyq76GTww13zT1Vwu6wNSEW0pI2tFk9uvBlFbdDn@lists.postgresql.org X-Gm-Message-State: AOJu0YwnyVLdy9i2Hheo0xWnU5/BGRxjQDn+g1/KYvI0+UfbutVjYMc4 X/kp/kHVky2BT48eKHfzyCoFxfsnpLDajryNnJMBXjDeZmEskfvqfhQw+fcaLcXZF8rW1dEBRrI KFIegLL4= X-Gm-Gg: ATEYQzyFxgAHK6lOeUbePh7ppcy9whKsejHh9DkmBLX/L7MziMVvNfn6W35Owz16tCB oTetYPXVL284fJE9vf94pY4VSCnGlsjtXpd3YAzwwYBeoEKAYRoW4Ue1giaP4D9V2Y272PBgBJF d8K5LoMLJen2dn+SZXuGFVhIWL99Lh8IOtpamAziuaKSqOqdoEQin7Qr5+uxq4UT0P0RxOH9SAj LtTIg6qwGctUj2gE7+2T0aB5sHTcpWARMo8gadRDEHLcSIv2U1kfmeP3fl2hQP7K8goD6gDIrn4 aeCr+IFVQ0HjM2/k4u/PeGbT9KajocEYdwaVUrcL15YF8brMaDrGLECNhkED6Ip+06p7Xq2Wg27 0pnIqUn/OopijK9I/obvPW8jzEHILHX1qlQvz28CxrsKSxFWQkSSe7C9Np2R7h8A9HHy4942Qws JOPPcSUS+UD/F/oXHih8jjopM0TNDEG9u7CqyrHGA2+XVL83I= X-Received: by 2002:a05:600c:46cd:b0:485:3294:fff0 with SMTP id 5b1f17b1804b1-4854f5a2b77mr1322165e9.17.1773244463319; Wed, 11 Mar 2026 08:54:23 -0700 (PDT) Received: from localhost (109-81-168-142.rct.o2.cz. [109.81.168.142]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48541b6f6b7sm206742835e9.9.2026.03.11.08.54.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Mar 2026 08:54:22 -0700 (PDT) From: Antonin Houska To: Alvaro Herrera cc: Mihail Nikalayeu , Pg Hackers , Robert Treat Subject: Re: Adding REPACK [concurrently] In-reply-to: <202603101915.kitboh3blier@alvherre.pgsql> References: <202603101915.kitboh3blier@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Tue, 10 Mar 2026 20:24:25 +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: Wed, 11 Mar 2026 16:54:22 +0100 Message-ID: <235330.1773244462@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Alvaro Herrera wrote: > I have just pushed 0001 with some additional changes. Thanks! > Here's a rebase of the next ones; no changes other than fixing the > conflicts. >=20 > I'm seeing this warning caused by 0004, which I think is also being > reported in CI > https://cirrus-ci.com/task/6606871575920640 >=20 > [281/1134] Compiling C object src/backend/postgres_lib.a.p/commands_clust= er.c.o > In file included from ../../source/repack/src/include/access/htup_details= .h:22, > from ../../source/repack/src/include/access/relscan.h:17, > from ../../source/repack/src/include/access/heapam.h:19, > from ../../source/repack/src/backend/commands/cluster.c:= 37: > In function =E2=80=98VARSIZE_ANY=E2=80=99, > inlined from =E2=80=98restore_tuple=E2=80=99 at ../../source/repack/s= rc/backend/commands/cluster.c:3129:18, > inlined from =E2=80=98apply_concurrent_changes=E2=80=99 at ../../sour= ce/repack/src/backend/commands/cluster.c:2915:9, > inlined from =E2=80=98process_concurrent_changes=E2=80=99 at ../../so= urce/repack/src/backend/commands/cluster.c:3386:2: > ../../source/repack/src/include/varatt.h:243:51: warning: array subscript= =E2=80=98varattrib_4b[0]=E2=80=99 is partly outside array bounds of =E2=80= =98varlena[1]=E2=80=99 [-Warray-bounds=3D] > 243 | ((((const varattrib_4b *) (PTR))->va_4byte.va_header >> 2= ) & 0x3FFFFFFF) > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ > ../../source/repack/src/include/varatt.h:467:24: note: in expansion of ma= cro =E2=80=98VARSIZE_4B=E2=80=99 > 467 | return VARSIZE_4B(PTR); > | ^~~~~~~~~~ > ../../source/repack/src/backend/commands/cluster.c: In function =E2=80=98= process_concurrent_changes=E2=80=99: > ../../source/repack/src/backend/commands/cluster.c:3121:33: note: object = =E2=80=98varhdr=E2=80=99 of size 4 > 3121 | varlena varhdr; > | ^~~~~~ I'm not sure it can be fixed nicely in the REPACK (CONCURRENTLY) patch. I think the problem is that, in the current tree, VARSIZE_ANY() is used in su= ch a way that the compiler cannot check the "array bounds". The restore_tuple() function is special in that it uses VARSIZE_ANY() to check a variable allocated from the stack, so the compiler can check the size. I'm trying to fix that in a new diff 0002 - the point is that VARSIZE_ANY() should not need to dereference a pointer to varattrib_4b, since the size information is always located at the beginning of the structure. Maybe you have better idea. Besides that, I've done a related change in 0003 (now 0004, due to the new diff): diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index 77e301b7c63..8b5571374d0 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -3118,7 +3118,7 @@ restore_tuple(BufFile *file, Relation relation, Memor= yContext cxt) BufFileReadExact(file, &natt_ext, sizeof(natt_ext)); for (int i =3D 0; i < natt_ext; i++) { - varlena varhdr; + alignas(uint32) varlena varhdr; char *ext_val; Size ext_val_size; =20 And also this one in the same file, to suppress another compiler warning (occuring when configured w/o --enable-cassert): diff --git a/src/backend/replication/pgoutput_repack/pgoutput_repack.c b/sr= c/backend/replication/pgoutput_repack/pgoutput_repack.c index 707940c1127..90f3a8975b9 100644 --- a/src/backend/replication/pgoutput_repack/pgoutput_repack.c +++ b/src/backend/replication/pgoutput_repack/pgoutput_repack.c @@ -93,12 +93,9 @@ static void plugin_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn, Relation relation, ReorderBufferChange *change) { - RepackDecodingState *dstate; - - dstate =3D (RepackDecodingState *) ctx->output_writer_private; - /* Changes of other relation should not have been decoded. */ - Assert(RelationGetRelid(relation) =3D=3D dstate->relid); + Assert(RelationGetRelid(relation) =3D=3D + ((RepackDecodingState *) ctx->output_writer_private)->relid); =20 /* Decode entry depending on its type */ switch (change->action) --=20 Antonin Houska Web: https://www.cybertec-postgresql.com --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=v41-0001-Refactor-index_concurrently_create_copy-for-use-with.patch