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 1uqtm1-00EsRV-JX for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Aug 2025 13:31:43 +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 1uqtlz-006OBt-CW for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Aug 2025 13:31:40 +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.94.2) (envelope-from ) id 1uqtlz-006OBl-1v for pgsql-hackers@lists.postgresql.org; Tue, 26 Aug 2025 13:31:39 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uqtlw-001qXU-1g for pgsql-hackers@lists.postgresql.org; Tue, 26 Aug 2025 13:31:38 +0000 Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-61c51f57224so3736076a12.2 for ; Tue, 26 Aug 2025 06:31:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec.at; s=google; t=1756215094; x=1756819894; darn=lists.postgresql.org; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from:from:to:cc :subject:date:message-id:reply-to; bh=e/uc/bz/uKgg63SjCsaiip0l+12yYlRP/J72MWoFdZk=; b=pdqUlweoNx0CQGYAk6FQucIe5ZvRmA5Lr7obJYpcTriszPKzKbisYFzUlA4aVSFuiz EF4jzxFibJJGvktoyBXCMEIgUreXGSmmVLxXe+ggik/v/AJRFg38e/YY0SjIZujGVoKM syr5Nyip6jKMHq4iUfhQm6abI0+0F4IHwmY6fO/7DeC4QOv478hIKmTTxJfIunXCj40v PdEQJZ9JQSgIlIchAShMDF6/FiyRGQEJZW+Jd4WNwHqdeBQO8fOJvjl49KTPVpxQEoY/ /RcrvhajbCqSDPxqFyIkrWJ2EjGkCCzXA8qOtHWa6nJGJUHy34ZnLuqfatFRyCDVsxK4 KbrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1756215094; x=1756819894; h=message-id:date:content-transfer-encoding:content-id:mime-version :comments:references:in-reply-to:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=e/uc/bz/uKgg63SjCsaiip0l+12yYlRP/J72MWoFdZk=; b=wKQSFqSh1nbejW7iWgFfBchxFtMqp1SvupUMMjgrvRKJHfTeh1sUqy4fJumHl9vNfM f7gIr7drQ2qUIkUf/KvOKjZjxBQ2FPOF5jFBahEJ8/imxQ6BHqFCh4QqQFeZ4k+wKOuP F10Z+RFgbh3FlK3IeNDiW+XgmDOYrUdH/XHmy8NvvptpKx71+r13NhoV625ulgLUcThB LEcPvRtnGlf2FELf2P7QIyzDYcUtwFnoqQquLswikOD9DAQbXMoVyUCOATXzdQjv7NZB vTBr+vdmYTwRbPxJBBGN+bazjt4ed9zTAsPY48ayWCdB3RG2nlvUWO7KTTVn9Ji8Kazb Nblg== X-Forwarded-Encrypted: i=1; AJvYcCXBfFBxDnONhyhFo/hqZBDt0jOSzmdM1svdz1VTp+NEGPAQJ+C012pvi4mvQzfPyZb94haJ8gj1me3RJnoj@lists.postgresql.org X-Gm-Message-State: AOJu0YyaZl6UdQxs29lzVonUM6ynTPTijkvCop3Xm/bEt56ZJtMEkYOW eoUNJ3LGQ7erwShI0bmrJc6tu1Fmrmwhneh3HG2UtUX8iI0n9IVPHUX/qEvjq0twlFM= X-Gm-Gg: ASbGnctg//07FnpeHKEUM01ivmrVoKyE/BtyWh0Z+9SqwOv5YWPV7xNnSDdFD4gbI3t kvB7+GOAaMhpf127OtU1Yg3/y2lh9x/AfUunEOme2zfG4y5AKhMqFLxagb4i3TXwlK6UMIJ2GLc 5JvtlKIwaeAdAqoubPvsQH7fubpkiJk150v64WvSDf9fTsPU0/dQiLUjfC3AwsJ3zraaNBcchkp SrswXNnNZdsr3qujWn7XO/c9ONTM3b5VPDOUqIcxzYm0dZTb1VbzWpL49iEoz1qo74imJRgsJ2r ZFPa3A7FHjF5pl7vb79aDa99VSnpd8zWCuNLc1Esb7OBKCZR6cD66b66W73O+4EADGkpQQB+fIW 41PSV4kUrK019Z7xaesgigV5exctSD6Zv7Z7n X-Google-Smtp-Source: AGHT+IFUcuiNIl2UEb1VEI3LDuSW2xvaFvGHBMPZfpa8AXtY5+xQGXEpir36xSjY/4G1NMMJJ56++Q== X-Received: by 2002:a17:907:6d19:b0:ae3:4f99:a5aa with SMTP id a640c23a62f3a-afe28f75f65mr1702219966b.4.1756215094171; Tue, 26 Aug 2025 06:31:34 -0700 (PDT) Received: from localhost (109-81-168-144.rct.o2.cz. [109.81.168.144]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-afe8e77c6aasm323924666b.56.2025.08.26.06.31.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Aug 2025 06:31:33 -0700 (PDT) From: Antonin Houska To: Mihail Nikalayeu cc: Alvaro Herrera , Fujii Masao , Robert Treat , Pg Hackers Subject: Re: Adding REPACK [concurrently] In-reply-to: References: <202508091333.qvgvo7ikuezm@alvherre.pgsql> <40729.1755799624@localhost> <9536.1756127358@localhost> <21931.1756136535@localhost> <24483.1756142534@localhost> <4790.1756197960@localhost> Comments: In-reply-to Mihail Nikalayeu message dated "Tue, 26 Aug 2025 11:02:01 +0200." X-Mailer: MH-E 8.6+git; nmh 1.8; GNU Emacs 28.3 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <29526.1756215093.1@localhost> Content-Transfer-Encoding: quoted-printable Date: Tue, 26 Aug 2025 15:31:33 +0200 Message-ID: <29527.1756215093@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Mihail Nikalayeu wrote: > Antonin Houska : > = > > Although it could work, I think it'd be confusing to consider the tran= sactions > > 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. Where exactly should HeapTupleSatisfiesDirty() conclude that the tuple is visible? TransactionIdIsCurrentTransactionId() will not do w/o the modifications that you proposed earlier [1] and TransactionIdIsInProgress(= ) is not suitable as I explained in [2]. I understand your idea that there are no transaction aborts in the new tab= le, which makes things simpler. I cannot judge if it's worth inventing a new k= ind of snapshot. Anyway, I think you'd then also need to hack HeapTupleSatisfiesUpdate(). Isn't that too invasive? [1] https://www.postgresql.org/message-id/CADzfLwUqyOmpkLmciecBy4aBN1sohQV= Z2Hgc6m-tjSUqDRHwyQ%40mail.gmail.com [2] https://www.postgresql.org/message-id/24483.1756142534%40localhost -- = Antonin Houska Web: https://www.cybertec-postgresql.com