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 1vecuM-00FpQz-1P for pgsql-hackers@arkaria.postgresql.org; Sat, 10 Jan 2026 17:37:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vecuJ-00Ac6G-2L for pgsql-hackers@arkaria.postgresql.org; Sat, 10 Jan 2026 17:37:48 +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 1vecuJ-00Ac68-0w for pgsql-hackers@lists.postgresql.org; Sat, 10 Jan 2026 17:37:48 +0000 Received: from mail-lj1-x22a.google.com ([2a00:1450:4864:20::22a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vecuI-005Or7-0r for pgsql-hackers@lists.postgresql.org; Sat, 10 Jan 2026 17:37:46 +0000 Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-382f4aa8dd1so35694531fa.3 for ; Sat, 10 Jan 2026 09:37:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1768066663; x=1768671463; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=BewOW2upozQilhkiQesywmOPMZ+aTG2RQAGMBFvxXtI=; b=VpCZ0K8EhZGwpdLqQMOkQvnVtMPQ6h5mwBt9tQYOB2y99EDINynVSvO9hwNz/2jZts gDH24dv269iLFR0AGbEP60IEPy4xcqi1IwLVqTq8q6ri/DgexHWskvqeboLmX4VqSsxj mjX8TD2j19qfvb9fNgtXN/jckJc3OjsOX+4fv+hJslJnvZX81DgpHQVUGgWI0SvAnaXm 8D22cTheVW7EMLxljhZphifRuLtvqpBpZEZa0ev30IvPBOmcRdAc7QUsS+Ft3yWPT1FV g/X6R8W+naGkN0BkFxkeCwZf60jBAOyEiW0P7ZXfQJt7yAlQglvO8I26bUWsm4MaROLH eBPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768066663; x=1768671463; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=BewOW2upozQilhkiQesywmOPMZ+aTG2RQAGMBFvxXtI=; b=habmnu+oY2sQKpRdGzOFLXvMEeHKQ2CclS/Ul/F27A/i9fb17xMpEMgWQqpiqJeUiM bGNhznZc9GRe+tia3oklKToIM9xh2AaTP2WDmV53ct+zGjvQPKG3G0PRPmPJ3crtUP4p P4JSTCscDbgPfTLna0n8YhspkeUQvXIZeTEM9VpN8tgi5V9v4W0R/0p/2NDVVFBzxDgX yT4dC+xUp/soptTLYbamYvHmNLUHwmPlbtEbASAEvXWgUgDk059HLsLqLcMIoVBj0F0V zhE951zlHDAr6TUInPj0CxdaVMP+3vJKBkG/hVTeNXyh7dnrmtb/il5M8uQx9ueUEg0d Y+rg== X-Forwarded-Encrypted: i=1; AJvYcCWRj5wVcAHh24xEqfR4jyvZkIvj3dJrxe2hLdgbtK4e4dOH31gqKcZg7XJDdUcRIj3NIHSrL/QxyCzLXsZC@lists.postgresql.org X-Gm-Message-State: AOJu0YzvpcjVoPdkR15BA1Vzh/Xj9bjvgc36ugC4H7KdEUdeQeEhirE1 SzWSacuqhCqLOFOYLvkqEJ5TYPHOS4PvGFVfBFXRQA1IZKn+QJKqriQNX04fh+24OqdftIuyi+a EyVFkabkQpoh6lQ7u+WjGTRe9NFMKYPA= X-Gm-Gg: AY/fxX5a5GgOSYH7HSGaw3y4QxBNxXG3Z4mhTqhWbj8cl3cOBbJRTqKcO9mvBN+WMpP tY7ig2YiX0E2YWpDYss3SdXi4c5IPEzeditOx3u3pi2UeddPTpf25Q9Sm70WUoIl+ACbBRqtMkG KG4onVoSBHdNpfD1EL11dtOpDwV/sC7HNaMgzhqeItOGZA+WIMgGfic7iWsu7LLm2TPRvkf/rCG nadIGg8hf+kMvN1HiHzPvGNsDfO3l8hLewPCkcB4s6lYjL82U2CfVvJYmZMSBR+myxpZ8l/o9qZ UQLMACExjHAB1uGBWR8k1jhYdStqXBWE5bHv+1Hb6wRxA2FyCZmQkro1+Q== X-Google-Smtp-Source: AGHT+IFxcFQZJIAPCfcjkAOicXPnUCkH2MRwoJm4SvX+vNHZkeGNivMXGzqIb2Nm8TtffCJMqmfH4qQUMQ00wnaXojU= X-Received: by 2002:a05:651c:30c9:b0:37e:644a:49ad with SMTP id 38308e7fff4ca-382ff81edb8mr44700901fa.29.1768066663035; Sat, 10 Jan 2026 09:37:43 -0800 (PST) MIME-Version: 1.0 References: <202512151349.vlq3mpfniyk3@alvherre.pgsql> <11247.1767609087@localhost> <11558.1767609632@localhost> <141054.1767891540@localhost> In-Reply-To: <141054.1767891540@localhost> From: Mihail Nikalayeu Date: Sat, 10 Jan 2026 20:37:06 +0300 X-Gm-Features: AZwV_QhsPDKyem_eXKpIoB8YSUDSMrDn1za3_TLDK8q6AqNHENVRm5os1lL9l_E Message-ID: Subject: Re: Adding REPACK [concurrently] To: Antonin Houska Cc: Alvaro Herrera , Pg Hackers , Robert Treat Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, Antonin! On Thu, Jan 8, 2026 at 7:59=E2=80=AFPM Antonin Houska wrot= e: > v29 tries to fix the problem. Some comments for 0001-0004. ------ 0001 ----- > src/bin/scripts/t/103_repackdb.pl:1: > # Copyright (c) 2021-2025 Update year for 2026. > * FIXME: this is missing a way to specify the index to use to repack one > * table, or whether to pass a WITH INDEX clause when multiple tables are > * used. Something like --index[=3Dindexname]. Adding that bleeds into > * vacuuming.c as well. Comments look stale. > return "???"; I think it is better to add Assert(false); before (done that way in a few places). > command REPACK The= re need . > =E2=80=9CAn utility=E2=80=9D Should be =E2=80=9CA utility=E2=80=9D > else if (pg_strcasecmp(cmd, "CLUSTER") =3D=3D 0) > cmdtype =3D PROGRESS_COMMAND_CLUSTER; Should we set PROGRESS_COMMAND_REPACK here? Because cluster is not used anywhere. Probably we may even delete PROGRESS_COMMAND_CLUSTER. > CLUOPT_RECHECK_ISCLUSTERED It is not set anymore... Probably something is wrong here or we need to just remove that constant and check for it. ------ 0002 ----- > rebuild_relation(Relation OldHeap, Relation index, bool verbose) It removes unused cmd parameter, but I think it is better to not add it in the previous commit. ------ 0003 ----- > int newxcnt =3D 0; I think it is better to use uint32 for consistency here. Also, I think it is worth adding Assert(snapshot->snapshot_type =3D=3D SNAPSHOT_HISTORIC_MVCC) ------ 0004 ----- > /* Is REPACK (CONCURRENTLY) being run by this backend? */ > if (am_decoding_for_repack()) We should check change_useless_for_repack here - to avoid looking and TRUNCATE of unrelated tables. > /* For the same reason, unlock TOAST relation. */ > if (OldHeap->rd_rel->reltoastrelid) > LockRelationOid(OldHeap->rd_rel->reltoastrelid, AccessExclusiveLock); Hm, we are locking here instead of unlocking ;) > (errhint("Relation \"%s\" has no identity index.", > RelationGetRelationName(rel))))); One level of braces may be removed. > * to decode on behalf of REPACK (CONCURRENT)? CONCURRENTLY > * If recheck is required, it must have been preformed on the source "performed" > * On exit,'*scan_p' contains the scan descriptor used. The caller must cl= ose > * it when he no longer needs the tuple returned. There is no scan_p argument here. > * Copyright (c) 2012-2025, PostgreSQL Global Development Group 2026 > newtuple =3D change->data.tp.newtuple !=3D NULL ? > change->data.tp.newtuple : NULL; > oldtuple =3D change->data.tp.oldtuple !=3D NULL ? > change->data.tp.oldtuple : NULL; > newtuple =3D change->data.tp.newtuple !=3D NULL ? > change->data.tp.newtuple : NULL; Hm, should it be just x =3D y ? > apply_concurrent_insert Double newline at function start. > heap2_decode Should we check for change_useless_for_repack here also? (for multi insert, for example). Best regards, Mikhail.