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.94.2) (envelope-from ) id 1uqpac-00Dnqt-QS for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Aug 2025 09:03:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uqpac-003mF5-5F for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Aug 2025 09:03:38 +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.94.2) (envelope-from ) id 1uqpab-003mEo-Qx for pgsql-hackers@lists.postgresql.org; Tue, 26 Aug 2025 09:03:38 +0000 Received: from mail-vk1-xa2b.google.com ([2607:f8b0:4864:20::a2b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uqpaa-001vH4-06 for pgsql-hackers@lists.postgresql.org; Tue, 26 Aug 2025 09:03:38 +0000 Received: by mail-vk1-xa2b.google.com with SMTP id 71dfb90a1353d-53b174ca9bdso4077067e0c.2 for ; Tue, 26 Aug 2025 02:03:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1756199014; x=1756803814; 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=//sTBQAngQZ85q4DkFawKUSJ9DOuOHd0ess4NQuLI4Q=; b=e87pjfoLCjrLJk6jgOY7biFki/d1acvV+PA8UyLW6eJUOiuHAIXnGfTanhhe7Nbmio m/rUikwmnu3EbBS6HM/tN/fYsWmp0xuYBBoQQvJUIUGCv9bwbWHcHj2am4ZPrWiJ+IZj hkzD3lhJgshr8tXsc2t3EqJQEMOshBZeijg0BzsrM9vW3SfGLOvcywrb6l2GRHm2lu5J Jse2bBsTCqEzENNJJtHyYgy7Rh/BXgGb/rOL+r7wLzsAuo+wvPs4hlSeJh361eJpTJQW n/QztYUkHcsxEfAWmwz7xXkhIeplmRb5U+1JtLKDF5VxVIyuUZOChYyG/JPqgfYsR1eh C6fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756199014; x=1756803814; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=//sTBQAngQZ85q4DkFawKUSJ9DOuOHd0ess4NQuLI4Q=; b=oM+ADSE36LkPU2eDyIHeYGH+wlTgClF+xBZr6bus156nlex5orz7hsuXXjthydJARt oMsV6uX2qtPVaPy3vQ06kuK8a1ZCKB5mMyPwTxgcbsgNFVJqeNXja0fhjib46vS4rPWJ eTIN2yZHHy8DADKL47WYxQiV9hnFSaEpl8/58OCi7iNlNp7//Q4MmlmWdvMtt/0mVovV 3ApsgeGCZ2zRdgXXiO+BCQHpddRt2yQbUv8OL7Yp0NFGe5GQvVikKCDVOEQJF34Fvdgq a+/mjzPZpeLiQRVre1/LzOMRiuQhKst7BQG+UvBPvNsJHhsi3i4HIzk7o4FlnWjoLpM+ d75g== X-Forwarded-Encrypted: i=1; AJvYcCUlr01nbZXUuK9kjVDxjNpkuINsmgJPkW8sTJb7YWn5r+KPyWYajyxiE/feYtz41Ktq06zXGAHL2hObUrGO@lists.postgresql.org X-Gm-Message-State: AOJu0YxJzYbkQyQg1EfUvzyGJfYJsHAxa4BtJ2ilv+aWImlpCLg0WajB J/6zmaTS1lZpP8gl2Q+cJWzwNUX5SVI9oimo003DVe8t70cdYQTNTnYA4RrKYMWVbAzTAbXzmYh Rqbar510SGWZnwKk1SnVYCnJSziNZE88= X-Gm-Gg: ASbGnctMqQ/AzvmeBPRuEP7JedTiy9LJ/aD8UxjznDm5dLlYPrbQdi0GG/HdJB3T/EU hogZIfK4No+Z4Q555WMrEaBKLWy16K/Ilnt9OrEHhfj++Gn0qAk/WufvbpgUM2fDb+Ya7bRb4xa yIGJvofzsbHj/YFJcOEdvorx6NLTrrMjPNv0Q0XpxmE+ZfucOerm5rZzfObgsfi+k5RBwWH9Uxz /tc88o= X-Google-Smtp-Source: AGHT+IFFQtq0Cb2cAj+/a9wGqd0aMyxR56Zyt0498EgO/zVlPTG38Ba8lwsW6MDOk2W3w0leKjfo/oSlUYg+8Ev78UY= X-Received: by 2002:a05:6122:4685:b0:542:59a2:72fb with SMTP id 71dfb90a1353d-54259a2791amr1663413e0c.9.1756199013836; Tue, 26 Aug 2025 02:03:33 -0700 (PDT) MIME-Version: 1.0 References: <202508091333.qvgvo7ikuezm@alvherre.pgsql> <40729.1755799624@localhost> <9536.1756127358@localhost> <21931.1756136535@localhost> <24483.1756142534@localhost> <4790.1756197960@localhost> In-Reply-To: <4790.1756197960@localhost> From: Mihail Nikalayeu Date: Tue, 26 Aug 2025 11:02:01 +0200 X-Gm-Features: Ac12FXyLvSxmC6yhIjLHlsJjnD7C2vuSqvQOEDHRzxu8qJ7clTsL-B22Pxgr05k Message-ID: Subject: Re: Adding REPACK [concurrently] To: Antonin Houska Cc: Alvaro Herrera , Fujii Masao , Robert Treat , Pg Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Antonin Houska : > Although it could work, I think it'd be confusing to consider the transactions > being replayed as "current" from the point of view of the backend that > executes REPACK CONCURRENTLY. Just realized SnapshotDirty is the thing that fits into the role - it respects not-yet committed transactions, giving enough information to wait for them. It is already used in a similar pattern in check_exclusion_or_unique_constraint and RelationFindReplTupleByIndex. So, it is easy to detect the case of the race you described previously and retry + there is no sense to hack around TransactionIdIsCurrentTransactionId. BWT, btree + SnapshotDirty has issue [0], but it is a different story and happens only with concurrent updates which are not present in the current scope. [0]: https://www.postgresql.org/message-id/flat/CADzfLwXGhH_qD6RGqPyEeKdmHgr-HpA-tASYdi5onP%2BRyP5TCw%40mail.gmail.com#77f6426ef2d282198f2d930d5334e3fa