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 1w9gm9-001eTj-20 for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 10:01:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9gm8-007jcb-0L for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Apr 2026 10:01:44 +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 1w9gm7-007jcS-2H for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 10:01:44 +0000 Received: from mail-yw1-x112d.google.com ([2607:f8b0:4864:20::112d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w9gm6-00000000pk8-11o7 for pgsql-hackers@lists.postgresql.org; Mon, 06 Apr 2026 10:01:43 +0000 Received: by mail-yw1-x112d.google.com with SMTP id 00721157ae682-79a535e7c00so35547777b3.3 for ; Mon, 06 Apr 2026 03:01:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1775469701; cv=none; d=google.com; s=arc-20240605; b=Qzq8QmFOhHvgzKqVJByOkz1vBpkTIphGSiIgAX1pLlZ5Ca6dzBhfjLQudHgji+lPRH 3HvyUVkqT+ylLxPprTRWFiJ2nNmA5dsIjfg8pQyQ6Wr60k59IjCoZxVyy1EWY2447bY7 7wmQ0CaD/1EeWO9Y/I46PKDGnSVdl1ALBXO8j/77o+ckUHfCt2xMsjwwq6ptB3dMEdKr UXu9QACv2+7hm93k8GfKrVBiYki/0AKSMRDPRTQypUhW7t/g9X3Z0qhF/WxI9W+VtVnh lqzb5qRm0s8tIivRoGhQXSMNlqMJIz4eTfpj4ycDcI5TFORRzKkBVyRu5R0hr8TQPbrK DBxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=RQXl/V+s3phJqRt0UvqVROxrFNPfUfGBeaFpsBxz/HE=; fh=zFwjKoYV3RiyEKVFpzkBkLYAFKhPCX3Hz1J5gLaB5HU=; b=YRaUqR/4ONFRujUGKGuSNHWFXDi4c5e81SumYysfhjcjCtyZTi1oQV8H1bgfixYYi7 UmK8OTWzExO5y0XKqdtomaQPI2HPhSbzG7jEIY0yJKLTPXIHO8bW1iH2+sarfChM+jNj XbfHxo2Q8CWUBgVvPx/w5fMUruffKfiohxEC3+1OeEjbtJuEuSMUoz6U7xA8s5mckTnF 78eNqE3cJvtcYo4UvvOcZtbmlZGbqZZkrfG36AP2POmgE7yMU9JgPV4xiGdtDqA267Dj Szfjaaxv5HgBHDlQEk90tWk1Oz4XCW4E0o97h4kcquf+yLVkHjiOc5IDvtdfPFvkPO9T Z4og==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1775469701; x=1776074501; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=RQXl/V+s3phJqRt0UvqVROxrFNPfUfGBeaFpsBxz/HE=; b=BIYI5cZd0NJLfzDG/GU0HOKCjrB9OQwfnZF51n8GZFRjwo8uvN6AL0nIthBB9ZCCEv 0A7iLtfaSXGzesQ9XTMDnlcYI58F0fzgsVFoa65NZKrtSdiMsxlJUzrvWcqoyxN1sTqJ lbAtq+q54KG2+QpgYoMTM7XxdLB6PSe9/VXONvZfYNfsBKwZ5UGnds0slj6GLH/eqBat f8fYXkp0TngOmzj+4rjs4kuhO/LyM9YuMD3c9tLGDOjRInotcQP4kU+xN15uceT7IO1o AOyzzvPNWP0d5ZtJKoceah+xYgV0FSBD3jUzDMQdKr8oIQKgHof65qTCX629pxUVXpPS QUVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775469701; x=1776074501; h=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=RQXl/V+s3phJqRt0UvqVROxrFNPfUfGBeaFpsBxz/HE=; b=OO4JOyQIv1HyHdiQqk7evYITavVzzJxWQ5m9hQgkDFo0TyBp21HxikFmmk9+wfQ1yv DuHW1VE02XUqKZPKWaZTAArXRRZT2Hvrc3wf4eKog8Yvf92/b8GSkJrT8EA55uADfyje g26cMvL9tjjFnKXsS+OkimKIPixmxbRe9YXNRNiJQJyI8+gulbn4yjgeVdkqy8H+stHH wB0rfmx68eChY8qAGvnYgFvTqNdGs/Vsea6gZtN8rrFx1cGaNwN9L46GqVzAbVRqBq71 LldOHyO2zLoVXq/Pf+KPqMoLBHkQFSi/gSnsH++7Ctz/2Sdt9md0Z/D76wvWodv7eoGe pSLA== X-Forwarded-Encrypted: i=1; AJvYcCWKyqi44gnEQk4YWcbDXLVBHdBFJoTZxZ6t/pbdDnHZ4bZdfdM6oXn6pUmmStet9fuvP62BNZg4sPxNtLqt@lists.postgresql.org X-Gm-Message-State: AOJu0Yz4M8aYj+CeY+Cg/X2QYIYzsW+qSGAkBYcszww8vUabZ9iHR5DB 7azYUJmZJGJeUVmfHCdhETpmtFdtEYkLjfAKos22lbGCxMPQdZVLOwyCEFbAPr8iqXRfeFAPLAd n++h4yrbhq6yKMdtg5XvFQt9hQG+VDm8= X-Gm-Gg: AeBDietw72V9Z69ecMRew8ktS0uKY5mgZD6WuNK6q2ZD1fIKvpx/e+oCKDFM7YV9iyD pL6m0fnrB2OhDFZ67/3YVjOP0jyNCG/px5O5Vfzuh14rFqCyyWg2ojgHE3PHraeTq4CnnFZZvNc JEJj/Cfvs819DVLvGfs1gq2QI8qfcVf2t0MYxRqGTOU2l/FNc5ie29sAJ6g6cWJ1WJKUc3cB537 AHkyw7lX+D4eNt39+ikinReTldZ6go/bcKMrG6C7cD1TN9aj2clTrJ3K+HnjRuMngIvIym/IQEA 9lKUDhlI X-Received: by 2002:a05:690c:3481:b0:79b:f4e1:a5b2 with SMTP id 00721157ae682-7a4d6c2907fmr126354477b3.22.1775469701376; Mon, 06 Apr 2026 03:01:41 -0700 (PDT) MIME-Version: 1.0 References: <202604060918.qw5ms7cbr2hz@alvherre.pgsql> In-Reply-To: <202604060918.qw5ms7cbr2hz@alvherre.pgsql> From: vignesh C Date: Mon, 6 Apr 2026 15:31:27 +0530 X-Gm-Features: AQROBzAeF6PCmK-0Oi_ujPw4Bc6ORIPhqZIeFUy89Ee91maDcS1t_kThEMgZKP4 Message-ID: Subject: Re: Adding REPACK [concurrently] To: Alvaro Herrera Cc: Antonin Houska , Srinath Reddy Sadipiralla , Amit Kapila , Mihail Nikalayeu , Matthias van de Meent , Pg Hackers , Robert Treat Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 6 Apr 2026 at 15:08, Alvaro Herrera wrote: > > On 2026-Apr-06, vignesh C wrote: > > > On Mon, 6 Apr 2026 at 02:12, Alvaro Herrera wrote: > > > Few comments: > > Thanks for reviewing this patch! > > > 1) Can we add a comment why we should error out here, as repack > > concurrently requires this whereas repack does not require this check. > > Even if it is required for decoding can't it be handled by replica > > identity full: > > + /* > > + * If the identity index is not set due to replica identity being, PK > > + * might exist. > > + */ > > + ident_idx = RelationGetReplicaIndex(rel); > > + if (!OidIsValid(ident_idx) && OidIsValid(rel->rd_pkindex)) > > + ident_idx = rel->rd_pkindex; > > + if (!OidIsValid(ident_idx)) > > + ereport(ERROR, > > + > > errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), > > + errmsg("cannot process relation \"%s\"", > > + RelationGetRelationName(rel)), > > + errhint("Relation \"%s\" has no > > identity index.", > > + RelationGetRelationName(rel))); > > Ah, I was just rewriting that comment moments ago. I think we could > make it work with replica identity full in theory, but I'm guessing it > would be useless. You really need an index that lets you locate the > affected tuples; otherwise the replay would take forever. If the table > is big, that would make the whole thing unworkable. If the table isn't > big, then you can probably just use straight repack without too much > disruption. > > /* > * Obtain the replica identity index -- either one that has been set > * explicitly, or the primary key. If none of these cases apply, the > * table cannot be repacked concurrently. It might be possible to have > * repack work with a FULL replica identity; however that requires more > * work and is not implemented yet. > */ Should this be mentioned in XXX comment: It might be possible to have repack work with a FULL replica identity; however that requires more work and is not implemented yet. > > 2) Do you think it will be good to add a test to simulate a case where > > one of the swap_replation_files is successful and a failure after > > that. We can verify that the oid should still point to old oids: > > Hmm, it's not clear to me in which cases this can happen. Are you > thinking that the first swap_replation_files call dies because of > out-of-memory? Yes, I was thinking of that. > Note that the really weird cases, like pg_class or mapped relations, are > directly rejected. So we don't get into the branch with > !RelFileNumberIsValid, and so on. > > I mean -- I'm not opposed to adding a test case for it. But I suspect > it's going to be somewhat annoying to write. I will verify this scenario through debugger. Regards, Vignesh