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 1vistO-000Yi3-0u for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Jan 2026 11:30:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vistN-00CgC9-16 for pgsql-hackers@arkaria.postgresql.org; Thu, 22 Jan 2026 11:30:25 +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 1vistM-00CgC1-2y for pgsql-hackers@lists.postgresql.org; Thu, 22 Jan 2026 11:30:25 +0000 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vistK-001l4R-2A for pgsql-hackers@lists.postgresql.org; Thu, 22 Jan 2026 11:30:24 +0000 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-59b67388c9cso914944e87.2 for ; Thu, 22 Jan 2026 03:30:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1769081420; cv=none; d=google.com; s=arc-20240605; b=iVcE4Mb3l7esKmrpciguYZEUvyx6+p60cAMLDg2XYaikh90UX5ThoaatzFPIaXKpqN 83r+K7jZ88ETg5PbmyOpFAIW52u8XZ7HZpGZzoND4LjWVoCKr1QswnvfbC2fwViYQGBq 7hKrk6yYSkzIwgclqX07DqWAPbQL/2T47ZZPuoHG9O10A2BHdtyJfYIMo9C2ZYeNWuLs 6ERoPQdqq8Zlw2QdlwTOv8CIN3kBYkU7H7a2F0bt18sy4SCXFpo0jq/ge7ReJ9On5pkZ kWzINeKpOg6ohiOavPMMSVoAbhr+CkZ6RUNs7rnQlEY0xU5MvSLyx+22lsbCfQo7D4Nh 0GuQ== 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=DjBQaWetZissr2ceufhGpufJ5eW0gDDiB5XZ7GYz/F8=; fh=ynX1XjEv6mt6W3TJLcYNgJWcMGnjc/B/Ur48d4JgQIM=; b=lyybyWxqNs+7TbLT3mT3spzG0HUpiKaC4hyMj6aMzXOIlh3dT17qAoB6Be/vXL9NKx zx9MV6xYgiS23CP5HS/kiLvaTDRzDy4eWB3+axOfJN9BLl+wv9mY5nySZ5trDIfUWtSx M/VgWWpNDvQz3V8F4Td+AKTzHfQEb4gk8v6wvNHtxoQpfHGS2Xp5rMWN4F0e3rd6ERp6 4nRdhZERJPRaf1H0KwKj3G4C1YXCDjxGikzRmJqnJuUZv3P6nm8wVxl1s8icjw1rhAnb W1Rzk/MB26YzO3d3Y3rs/54MjnUTVIs4w6oeeRSPuYRfCJoI7wMTOEA4ST+/lvBX4BdM daMw==; 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=1769081420; x=1769686220; 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=DjBQaWetZissr2ceufhGpufJ5eW0gDDiB5XZ7GYz/F8=; b=kCM7cXLCop8ME7QsaoYbXZQLVwvKL7XyQ/OfMBgyZcOE/m4FtsTRGyGj3N8X9eVUKn R6HZV8jl5/+NDI72YWR9GIl2yQaTI1HOqL0X5jiUaCep2ph8mnCS3tszz0ER8YaBGbKI bmAzKRsapJkJWJMKn1r1CiXOiNQexqoYehQN6vz3t6/5LaMelLGAg5PGOY7uW6aPg4Qn fp8A4n9ClDge/ZrcwIATQX8AT6r2/BfHnmtqqw8L3CG4mipGLPC+71JK7+LBQ6s16fHu vWDWlnTXqJ2fwy6P+q9l8Oob4J1BywiFn9ohIakYZs7txn93ar4kO7La/wmvwg4Gb6vL dnSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769081420; x=1769686220; 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=DjBQaWetZissr2ceufhGpufJ5eW0gDDiB5XZ7GYz/F8=; b=OXMTt5zZYyJwJ/8v49tAqzl9rp1Vfm1avGKbVI8lUHSifq/+e/KDOZFZGr6I5MRriA IOTNDStny9DPLHIF4tW3/IfKZ99Q0mq6otFRakCK59NgeYdl3rwzRCtYpWxFpikQjGaX bTNPq/5gWFoRV+P8f6VYkd1pUnZK9pCFsVoTVFqYRko9WudRV2yQnWWoNChKea+1DQMx s7ccGuEmzKvlhQc1z80Z3LbbkxUSSXDosOzk8PEMmSw3oUSQmYg6SY1QqJZMNY0jVieF hDcj6RT9Zp6Wxo4/ztUR1xGGU5QsafenUbK5joquUz9NGlh4q/vK2wnxdMuFQUfSlofB vMuQ== X-Forwarded-Encrypted: i=1; AJvYcCVh2rllgcLhMnkcvqWsOThzX34W+eq8oqMz7aEPegXUQdCYiv/B9kiLR8CZUP0e95vOFFEwK+xysP0W2vgo@lists.postgresql.org X-Gm-Message-State: AOJu0Yx+kTI8sALR1xf98ISi+dcZyNU9nFcWL0q+6aBU9FFD8/YPZASJ 7ryCRV1u+4bcbgU6uo8ofKbLCcTo9dh+G4YQlHwdmsgRobMrFzW9BYRQhxunftnI3OllfRqOe/+ xP9xavflYtJj0Q4Og0vdds+8e5hNtn7Y= X-Gm-Gg: AZuq6aLnZGfVX7mhCVxLA5Uyomfm7wiRvm36NNsfVCNw7vGoFoZwqFybVLgLv3Kpfbg jU05BLtQF0fD8ySY2C2GED0AD9aC2Hpl9T6XOKP+/6duvR2iW2E7HJ2RALLOfkQafiXvCrodGNs zpkDwPjAYBGYvOqdwmSgnFYJa/aMQLEwWYPYK0VkCHOiWkWkOheKtDRhyMO6SN4Ng5GaZAnTTua cZIFqkLMj6qD13ASVM87WGgn7VR3LxqtE0elssUpwn7psi7e4akBgHivY+uiTQGXTN0qHMAuWlM Pg50UMuY2hsXHsJMkd1D0bwxaZJPfVzy1YvvAAETquuT3sHN7sPOUOiNxROpJZHRCU3+uv/fUSm gjfJ7u1P2iRJWalk= X-Received: by 2002:a05:6512:23aa:b0:59d:e2b6:a20a with SMTP id 2adb3069b0e04-59de2b6a47fmr162845e87.51.1769081420062; Thu, 22 Jan 2026 03:30:20 -0800 (PST) MIME-Version: 1.0 References: <202512151349.vlq3mpfniyk3@alvherre.pgsql> <11247.1767609087@localhost> <11558.1767609632@localhost> <141054.1767891540@localhost> <137668.1768235610@localhost> <74802.1769071060@localhost> In-Reply-To: <74802.1769071060@localhost> From: Mihail Nikalayeu Date: Thu, 22 Jan 2026 12:30:00 +0100 X-Gm-Features: AZwV_Qigv3GY2IFcPQYu1OobI1Mzx1jBXb0i8fgmhu6QjNqDKnt-5ySDj5P2xVM Message-ID: Subject: Re: Adding REPACK [concurrently] To: Antonin Houska Cc: Alvaro Herrera , Pg Hackers , Robert Treat Content-Type: multipart/alternative; boundary="0000000000009f238d0648f85ddb" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000009f238d0648f85ddb Content-Type: text/plain; charset="UTF-8" Hello, Antonin! > The changes present in WAL decoded prior the snapshot creation are not > replayed - these changes are visible to the snapshot. (This is not really > specific to the 0006 part.) OK, just want to be sure it still works the same way if we build multiple snapshots for the same slot that way. > The current API does not seem to support changing snapshot of an in-progress > scan and I don't want to change that. Plus note that the current > implementation of CLUSTER also uses SnapshotAny and then checks the visibility > separately. Finally, SnapshotAny is not really an expensive visibility check, > if it can be considered a visibility check at all. But we will require a real check for each tuple. Including dead one, multiple versions of the same HOT, etc. > I've added it only for xmin. xid is valid because REPACK is executed in a > transaction. That reminds me that PROC_IN_VACUUM should be present in > MyProc->statusFlags. Fixed. Yes, xid is required for repack. I think it is better to introduce a new flag instead of PROC_IN_VACCUUM. > > > PushActiveSnapshot(GetTransactionSnapshot()); > > GetLatestSnapshot() feels better here. > What will then happen to code that uses GetActiveSnapshot() ? O, I mean PushActiveSnapshot(GetLatestSnapshot()) > > Also, to correctly build a unique index - some tech from [0] is required (building a unique index with multiple snapshots is a little bit tricky). > ok, I'll check your patch. I realized building a unique index is still done with a single snapshot, so it should be OK for that case. But still check the patch :) > I proposed the Assert above, but still thinking about it. Hm... Do we really need these asserts if PROC_IN_VACUUM is set? I was proposing a way it is used for index building (to ensure nothing is propagated into xmin). Best regards, Mikhail. --0000000000009f238d0648f85ddb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello, Antonin!

> The cha= nges present in WAL decoded prior the snapshot creation are not
> rep= layed - these changes are visible to the snapshot. (This is not really
&= gt; specific to the 0006 part.)

= OK, just want to be sure it still works the same way if we build multiple s= napshots for the same slot that=C2=A0way.

> The current API does not seem to suppor= t changing snapshot of an in-progress
> scan and I don't want to = change that. Plus note that the current
> implementation of CLUSTER a= lso uses SnapshotAny and then checks the visibility
> separately. Fin= ally, SnapshotAny is not really an expensive visibility check,
> if i= t can be considered a visibility check at all.

But we will require a= real check for each tuple. Including dead one, multiple versions of the sa= me HOT, etc.

> I've added it only for xmin. xid is valid because REPACK is exec= uted in a
> transaction. That reminds me that PROC_IN_VACUUM should b= e present in
> MyProc->statusFlags. Fixed.

Yes, = xid is required for repack. I think it is better to introduce a new flag in= stead of PROC_IN_VACCUUM.


> > > PushActiveSnapshot(GetTransactionSnapshot())= ;
> > GetLatestSnapshot() feels better here.
> What w= ill then happen to code that uses GetActiveSnapshot() ?

<= span class=3D"gmail-im">O, I mean=C2=A0Push= ActiveSnapshot(GetLatestSnapshot())

> > Also, to correctly build a unique index - some tech from [= 0] is=20 required (building a unique index with multiple snapshots is a little=20 bit tricky).
> ok, I'll check your patch.

I realized building a unique index is still done= with a single snapshot, so it should be OK for that case. But still check = the patch :)

>=C2=A0 I proposed the Assert above, but still thinking about it.
Hm... Do we re= ally need these asserts if=C2=A0PROC_IN_VACUUM is set? I was proposi= ng a way it is used for index building (to ensure nothing is propagated int= o xmin).

Best regards,
Mikhail.

--0000000000009f238d0648f85ddb--