Re: ALTER tbl rewrite loses CLUSTER ON index
Michael Paquier <michael@paquier.xyz>
From: Michael Paquier <michael@paquier.xyz>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: Justin Pryzby <pryzby@telsasoft.com>, Amit Langote <amitlangote09@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@postgresql.org
Date: 2020-04-03T06:54:38Z
Lists: pgsql-hackers
On Thu, Apr 02, 2020 at 04:38:36AM -0300, Alvaro Herrera wrote: > I don't think we need to worry about that problem, because we already > checked that the pg_class tuple for the index is there two lines above. > The pg_index tuple cannot have gone away on its own; and the index can't > be deleted either, because cluster_rel holds AEL on the table. There > isn't "probably" about the can't-happen condition, is there? Yes, you are right here. I was wondering about an interference with the multi-relation cluster that would not lock the parent relation at the upper level of cluster() but the check on the existence of the index makes sure that we'll never see an invalid entry in pg_index, so let's keep patch 0002 as originally presented. As the commit tree is going to be rather crowded until feature freeze on Sunday, I'll wait until Monday or Tuesday to finalize this patch set. Now, would it be better to apply the refactoring patch for HEAD before feature freeze, or are people fine if this is committed a bit after? Patch 0002 is neither a new feature, nor an actual bug, and just some code cleanup, but I am a bit worried about applying that cleanup on HEAD just after the freeze. -- Michael
Commits
-
Refactor cluster.c to use new routine get_index_isclustered()
- 8ef9451f58ee 13.0 landed
-
Preserve clustered index after rewrites with ALTER TABLE
- 3f77a670241d 9.5.22 landed
- 61a161fe4421 9.6.18 landed
- cef2b8d52c59 10.13 landed
- 41faafbd75a5 11.8 landed
- 3e62dd3a937b 12.3 landed
- a40caf5f862c 13.0 landed
-
Preserve replica identity index across ALTER TABLE rewrite
- 1cc9c2412cc9 13.0 cited
-
Remove RangeIOData->typiofunc
- a77315fdf2a1 13.0 cited
-
Preserve pg_index.indisclustered across REINDEX CONCURRENTLY
- f087d63a45b5 12.3 landed
- d79fb88ac738 13.0 landed