update comments about CatalogUpdateIndexes

Started by Tomas Vondraalmost 9 years ago2 messages
#1Tomas Vondra
tomas.vondra@2ndquadrant.com
1 attachment(s)

Hi,

commit 2f5c9d9c9ce removed CatalogUpdateIndexes and replaced it with
CatalogTupleInsert/CatalogTupleUpdate, which do both the operation and
index update.

But there remained three places in comments still referencing the
removed CatalogUpdateIndexes. Attached is a patch fixing those places.
It also removes the comment attribution to "bjm" from syscache.c,
because after modifying it's no longer the original comment.

regards

--
Tomas Vondra http://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachments:

catalog-update-indexes-comments.patchbinary/octet-stream; name=catalog-update-indexes-comments.patchDownload
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index f8d9214..8d42a34 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -1858,8 +1858,8 @@ index_update_stats(Relation rel,
 	 * 1. In bootstrap mode, we have no choice --- UPDATE wouldn't work.
 	 *
 	 * 2. We could be reindexing pg_class itself, in which case we can't move
-	 * its pg_class row because CatalogUpdateIndexes might not know about all
-	 * the indexes yet (see reindex_relation).
+	 * its pg_class row because CatalogTupleInsert/CatalogTupleUpdate might
+	 * not know about all the indexes yet (see reindex_relation).
 	 *
 	 * 3. Because we execute CREATE INDEX with just share lock on the parent
 	 * rel (to allow concurrent index creations), an ordinary update could
@@ -3542,9 +3542,9 @@ reindex_relation(Oid relid, int flags, int options)
 	 * that the updates do not try to insert index entries into indexes we
 	 * have not processed yet.  (When we are trying to recover from corrupted
 	 * indexes, that could easily cause a crash.) We can accomplish this
-	 * because CatalogUpdateIndexes will use the relcache's index list to know
-	 * which indexes to update. We just force the index list to be only the
-	 * stuff we've processed.
+	 * because CatalogTupleInsert/CatalogTupleUpdate will use the relcache's
+	 * index list to know which indexes to update. We just force the index
+	 * list to be only the stuff we've processed.
 	 *
 	 * It is okay to not insert entries into the indexes we have not processed
 	 * yet because all of this is transaction-safe.  If we fail partway
diff --git a/src/backend/utils/cache/syscache.c b/src/backend/utils/cache/syscache.c
index bdfaa0c..b1c0b4b 100644
--- a/src/backend/utils/cache/syscache.c
+++ b/src/backend/utils/cache/syscache.c
@@ -100,10 +100,8 @@
 	adding/deleting caches only requires a recompile.)
 
 	Finally, any place your relation gets heap_insert() or
-	heap_update() calls, make sure there is a CatalogUpdateIndexes() or
-	similar call.  The heap_* calls do not update indexes.
-
-	bjm 1999/11/22
+	heap_update() calls, use CatalogTupleInsert() or CatalogTupleUpdate()
+	instead, which also update indexes.  The heap_* calls do not do that.
 
 *---------------------------------------------------------------------------
 */
#2Robert Haas
robertmhaas@gmail.com
In reply to: Tomas Vondra (#1)
Re: update comments about CatalogUpdateIndexes

On Tue, Feb 28, 2017 at 10:45 PM, Tomas Vondra
<tomas.vondra@2ndquadrant.com> wrote:

commit 2f5c9d9c9ce removed CatalogUpdateIndexes and replaced it with
CatalogTupleInsert/CatalogTupleUpdate, which do both the operation and index
update.

But there remained three places in comments still referencing the removed
CatalogUpdateIndexes. Attached is a patch fixing those places. It also
removes the comment attribution to "bjm" from syscache.c, because after
modifying it's no longer the original comment.

Committed.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers