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 1w3Z5F-001Lkd-23 for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Mar 2026 12:36:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w3Z5E-005rFZ-0H for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Mar 2026 12:36:08 +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 1w3Z5D-005rFQ-2b for pgsql-hackers@lists.postgresql.org; Fri, 20 Mar 2026 12:36:08 +0000 Received: from mail-lf1-x135.google.com ([2a00:1450:4864:20::135]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w3Z5C-00000000AJa-1Zxc for pgsql-hackers@lists.postgresql.org; Fri, 20 Mar 2026 12:36:07 +0000 Received: by mail-lf1-x135.google.com with SMTP id 2adb3069b0e04-59de8155501so1840123e87.3 for ; Fri, 20 Mar 2026 05:36:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1774010163; cv=none; d=google.com; s=arc-20240605; b=SIgh2/2MfJdJ02LU7njJHOk1xfm4n8dHQYSQ7QAGkcBzBUaxY7oTLB+qTalw8eoJox HYR0z3y9z6DGIbgjhr4Jl7S36FkYajQ5RG2gb0+ddQASPJG/fnlbc3loOBGoTjxJ1nSo 4TbsVXVNVE9q5de4+DN/NEeY44bSAWqQUcpmzEQslmYP/lWUku5fEDc8dnky38PkKsja GknLsLmduPxC9VGoBukTJ0Bclc97Kz2IhWTFpLV3rZtAvEzgpyJGKlh0Ni3AgVJpD7CI Y2PWPQTWy5h0jhZQrvPJVR6vyEKvgO7bdM9b+YFVPN4VGMPqkBM6FqXriR1MH3D85wjq QfUw== 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=fMFmC7CHyfusEp9w3CgteoEaZflEV8yGqXusyiVhJtE=; fh=kyiJtck/MfL7IX4dqlGvABJdvzUDOPMIMbP3kXaKLHE=; b=dILi0133MghHrWxd8rV9n/uIh1eV9xSyDUhH0y9YPwjbwv/x3B4i5jiv3tCf8Fazen uetUHM4r5Tk4TdLZdoMWNO3hbT0XwrZorzgIdT4W/aNWCrxKi8BhGOWCsgq1kIlKmcM5 tYIA0K4q4VtJl6DE2bUjjAYFB6x9tYpaeYuADkk55jAViDuFqbiW2A3+KKzK424UKjF6 CJLSdRQ7dsYt6o9CgAYmlRn3FE1NDx+/H02cp011brPS2/Q9nIRIVgqXZKJIrYBnpURn Na6UYTa3n2Z0lyDBfWHWXLbpu3+X6FWnJ8pELxzm3bMNWHkDMB0mEUpSybVSQjKEvbQu I7vQ==; 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=20230601; t=1774010163; x=1774614963; 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=fMFmC7CHyfusEp9w3CgteoEaZflEV8yGqXusyiVhJtE=; b=Tv+ursvpQLct3JB+GAF98skKakC1ZqpgFjE2oTddqU1De9N7RqD9CZR9g+jIWsVJoK SQO+56IEVTSfHiIKkO65VY5VsADzjKrldQkygVnJ3ykPwWbcdo1J04TLN7VrQoxlh9gD LAaxeRjHP/cNHRfQ8azNXNH5+KD8KfZqUR2v3vPSM1DftB87DQKEZiUciQaWKfRNdunR Dmc8ENu1NiRfujn4CPUJiXCMpOzKGDwbAL3JvoG4ru8cKbjbEzWn8FRTt8KUp3DjQsIR i0lmfafKzg0c5yax51woi3A1SgC+ieSaKj/Ph5iqUwkPHNAddUOoKFSdGxadeLLiZ1x5 aiJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774010163; x=1774614963; 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=fMFmC7CHyfusEp9w3CgteoEaZflEV8yGqXusyiVhJtE=; b=NWWil03YQNiH4CJaoobYF9FR4omML3zzd4CvYCImZjzd2UoFBnxUmYsVknSxzTFRXP /0jRNpwIb8gFdg2x0X1adb7bswtLeq4KSi9gBYkawgD7z+w4BmmZ094hkr8Yb8J6G+T2 taegQO9IJKZn3unKBL+bGhypAqxKYmxHBOckedfZmrMxhWbM5iRK/bc6CZ8eu5GEI/BK VX76lgyAOcBk6KX4KKsq9SlWotHlrYeIb2S285un2+aFGU6AC8cVJoNpZxMyTLGiMIfv 1CLuhvNTocpmjW2CRhu07sOd8Wx+MUJF1owoX50lgmgvkb44m1NEa7qzfEdOlqVth1et qE/g== X-Forwarded-Encrypted: i=1; AJvYcCXIB1QeiCVC46hCPIhHsBUlrIGmz9FgKhNz+ADF/qUqmQSlGjtV/jWDu3ZjDzpeOkK7DTtbF0CsigC9lQe/@lists.postgresql.org X-Gm-Message-State: AOJu0Yz2knHycDWAU9j9kiSexp6t0G0Sx9IkEsYVT1tIQkxVeD2lcpHC d7UnnNTSe3ZDoIFyNwFH2E3YRJgt1NJfO3IkibuRNTAio4pSa4MTdtEuNrxZSRPxnBlVgW71bDQ DG0j9TPILq4KXr+wZY7BWKePOWkj+KoA= X-Gm-Gg: ATEYQzybxiElmk+0QmZpI0RPLCI6CDLoSvaU7q0rQ8/qzrg7c59E+tududJOG0SCpKR tXATPjimlNVEsLsHg76mFyECMCL5IBP37UoMh9CRKFUPZPGwJ12Iw2zBqkXB5wNtAWBqISQJMWB 8Zk42bTlbgg9kVGIbQFGXa9C9RGiUZDMbitVTgFIdMq8l7mJ45uux2Nbn2FpJfPfsaOun0bhJJ/ oDAhhXcbVMMreY72yqFEqxKjzwb9CEKWjiVNfuyauOqbrG21KgEVxi66bqYJYZI+VQsipkyD4+B 0A037ctgxz5h0al4ZpcTVeW4dmI5maUBIEPywzYrsk+1VX1vcVtdpTJewxw9lLlcMvH9 X-Received: by 2002:a05:6512:3f12:b0:5a1:2e0c:86ee with SMTP id 2adb3069b0e04-5a285b5a3c1mr1022636e87.36.1774010162883; Fri, 20 Mar 2026 05:36:02 -0700 (PDT) MIME-Version: 1.0 References: <202603191855.fzsgsnyzfvpt@alvherre.pgsql> In-Reply-To: <202603191855.fzsgsnyzfvpt@alvherre.pgsql> From: Mihail Nikalayeu Date: Fri, 20 Mar 2026 13:35:00 +0100 X-Gm-Features: AaiRm52mXXUtgF2B_eqfNiXIm187fEaprSOOh3wDLLKcn5tGd7q5KAvnLaKRfk0 Message-ID: Subject: Re: Adding REPACK [concurrently] To: Alvaro Herrera Cc: Srinath Reddy Sadipiralla , Antonin Houska , 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 Hello, everyone! Some comments for v43: --- src/backend/commands/cluster.c:3211 slot_attisnull(dest, i) uses a 0-based loop index but slot_attisnull starts with "Assert(attnum > 0);". Also, it proves it has not been tested in any way yet. ------------------------------ src/backend/storage/ipc/standby.c:1376 "if (xlrec.xcnt > 0)" looks like it should be "xlrec.xcnt + xlrec.xcnt_repack > 0" because of "CurrentRunningXacts->xcnt = count - subcount - count_repack;" ------------------------------ src/backend/storage/ipc/procarray.c:2673-2681 "nrepack = logical_decoding_enabled ? MAX_REPACK_XIDS : 0" not sure it is a real issue, but if EnableLogicalDecoding is called somehow after allocating the array - it makes it possible to overrun the array later by MAX_REPACK_XIDS. ------------------------------ src/backend/commands/cluster.c:3006 "apply_cxt = AllocSetContextCreate(TopTransactionContext, "REPACK - apply", ALLOCSET_DEFAULT_SIZES);" Should we do it before the "MakeSingleTupleTableSlot" calls? Because MakeSingleTupleTableSlot stored CurrentMemoryContext in tts_mcxt. ------------------------------ src/backend/commands/cluster.c:3187 if (natt_ext != 0) elog(WARNING, "have natt_ext %d, weird", natt_ext); Should we make that ERROR? ------------------------------ src/backend/access/rmgrdesc/standbydesc.c:24 appendStringInfo(buf, "nextXid %u latestCompletedXid %u oldestRunningXid %u oldestRunningXid %u", "oldestRunningXidLogical" at the end? ------------------------------ src/backend/catalog/index.c:766,1464-1469 "bool progress = (flags & INDEX_CREATE_REPORT_PROGRESS) != 0;" AFAIU gin, hash and btree (at least) still just unconditionally write PROGRESS_CREATEIDX_* progress. ------------------------------ src/backend/catalog/toasting.c:334 "INDEX_CREATE_IS_PRIMARY | INDEX_CREATE_REPORT_PROGRESS, 0," Should we add the "progress" flag too here and move it from make_new_heap? ------------------------------- Also just, gently remind you about [1] and a simple way to avoid any unnoticed MVCC-related issues with REPACK proposed here [2]. Best regards, Mikhail. [1]: https://www.postgresql.org/message-id/flat/5k2dfckyp6zv2fiovosvtbya5onvplgviz5n4kdamxupff4vi2%40yytzfnwr2ox7#c52bec0a074779921b14c1e46da9ed21 [2]: https://www.postgresql.org/message-id/CADzfLwUEH5+LjCN+6kRfSsXwuou8rKXyVV42Wi-O_TG0360Kug@mail.gmail.com