Remove "recheck" argument from check_index_is_clusterable()
authorMichael Paquier <[email protected]>
Wed, 13 Apr 2022 06:32:35 +0000 (15:32 +0900)
committerMichael Paquier <[email protected]>
Wed, 13 Apr 2022 06:32:35 +0000 (15:32 +0900)
The last usage of this argument in this routine can be tracked down to
7e2f9062, aka 11 years ago.  Getting rid of this argument can also be an
advantage for extensions calling check_index_is_clusterable(), as it
removes any need to worry about the meaning of what a recheck would be
at this level.

Author: Justin Pryzby
Discussion: https://postgr.es/m/20220411140609[email protected]

src/backend/commands/cluster.c
src/backend/commands/tablecmds.c
src/include/commands/cluster.h

index 322d6bb2f184be35cba8855333d790b90f54d52a..0f0a6e9f018ff465c91ed587450e8101141d85ed 100644 (file)
@@ -232,7 +232,7 @@ cluster(ParseState *pstate, ClusterStmt *stmt, bool isTopLevel)
        if (rel != NULL)
        {
                Assert(rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE);
-               check_index_is_clusterable(rel, indexOid, true, AccessShareLock);
+               check_index_is_clusterable(rel, indexOid, AccessShareLock);
                rtcs = get_tables_to_cluster_partitioned(cluster_context, indexOid);
 
                /* close relation, releasing lock on parent table */
@@ -434,7 +434,7 @@ cluster_rel(Oid tableOid, Oid indexOid, ClusterParams *params)
 
        /* Check heap and index are valid to cluster on */
        if (OidIsValid(indexOid))
-               check_index_is_clusterable(OldHeap, indexOid, recheck, AccessExclusiveLock);
+               check_index_is_clusterable(OldHeap, indexOid, AccessExclusiveLock);
 
        /*
         * Quietly ignore the request if this is a materialized view which has not
@@ -480,7 +480,7 @@ cluster_rel(Oid tableOid, Oid indexOid, ClusterParams *params)
  * protection here.
  */
 void
-check_index_is_clusterable(Relation OldHeap, Oid indexOid, bool recheck, LOCKMODE lockmode)
+check_index_is_clusterable(Relation OldHeap, Oid indexOid, LOCKMODE lockmode)
 {
        Relation        OldIndex;
 
index 90edd0bb97d7dde7425d0e2c5cf21687b77328a9..1d7db41d172dfb3dc46c71e091659043b1568286 100644 (file)
@@ -14055,7 +14055,7 @@ ATExecClusterOn(Relation rel, const char *indexName, LOCKMODE lockmode)
                                                indexName, RelationGetRelationName(rel))));
 
        /* Check index is valid to cluster on */
-       check_index_is_clusterable(rel, indexOid, false, lockmode);
+       check_index_is_clusterable(rel, indexOid, lockmode);
 
        /* And do the work */
        mark_index_clustered(rel, indexOid, false);
index 3c279f6210ae1dc6011155fdce72e8a6da98dacf..df8e73af409474b0127009fb51cde33806da9a3c 100644 (file)
@@ -34,7 +34,7 @@ typedef struct ClusterParams
 extern void cluster(ParseState *pstate, ClusterStmt *stmt, bool isTopLevel);
 extern void cluster_rel(Oid tableOid, Oid indexOid, ClusterParams *params);
 extern void check_index_is_clusterable(Relation OldHeap, Oid indexOid,
-                                                                          bool recheck, LOCKMODE lockmode);
+                                                                          LOCKMODE lockmode);
 extern void mark_index_clustered(Relation rel, Oid indexOid, bool is_internal);
 
 extern Oid     make_new_heap(Oid OIDOldHeap, Oid NewTableSpace, Oid NewAccessMethod,