@@ -2439,10 +2439,10 @@ RelationDestroyRelation(Relation relation, bool remember_tupdesc)
24392439 list_free_deep (relation -> rd_fkeylist );
24402440 list_free (relation -> rd_indexlist );
24412441 list_free (relation -> rd_statlist );
2442+ bms_free (relation -> rd_indexattr );
24422443 bms_free (relation -> rd_keyattr );
24432444 bms_free (relation -> rd_pkattr );
24442445 bms_free (relation -> rd_idattr );
2445- bms_free (relation -> rd_hotblockingattr );
24462446 if (relation -> rd_pubdesc )
24472447 pfree (relation -> rd_pubdesc );
24482448 if (relation -> rd_options )
@@ -5104,10 +5104,10 @@ RelationGetIndexPredicate(Relation relation)
51045104Bitmapset *
51055105RelationGetIndexAttrBitmap (Relation relation , IndexAttrBitmapKind attrKind )
51065106{
5107+ Bitmapset * indexattrs ; /* indexed columns */
51075108 Bitmapset * uindexattrs ; /* columns in unique indexes */
51085109 Bitmapset * pkindexattrs ; /* columns in the primary index */
51095110 Bitmapset * idindexattrs ; /* columns in the replica identity */
5110- Bitmapset * hotblockingattrs ; /* columns with HOT blocking indexes */
51115111 List * indexoidlist ;
51125112 List * newindexoidlist ;
51135113 Oid relpkindex ;
@@ -5116,18 +5116,18 @@ RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
51165116 MemoryContext oldcxt ;
51175117
51185118 /* Quick exit if we already computed the result. */
5119- if (relation -> rd_attrsvalid )
5119+ if (relation -> rd_indexattr != NULL )
51205120 {
51215121 switch (attrKind )
51225122 {
5123+ case INDEX_ATTR_BITMAP_ALL :
5124+ return bms_copy (relation -> rd_indexattr );
51235125 case INDEX_ATTR_BITMAP_KEY :
51245126 return bms_copy (relation -> rd_keyattr );
51255127 case INDEX_ATTR_BITMAP_PRIMARY_KEY :
51265128 return bms_copy (relation -> rd_pkattr );
51275129 case INDEX_ATTR_BITMAP_IDENTITY_KEY :
51285130 return bms_copy (relation -> rd_idattr );
5129- case INDEX_ATTR_BITMAP_HOT_BLOCKING :
5130- return bms_copy (relation -> rd_hotblockingattr );
51315131 default :
51325132 elog (ERROR , "unknown attrKind %u" , attrKind );
51335133 }
@@ -5158,7 +5158,7 @@ RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
51585158 relreplindex = relation -> rd_replidindex ;
51595159
51605160 /*
5161- * For each index, add referenced attributes to appropriate bitmaps .
5161+ * For each index, add referenced attributes to indexattrs .
51625162 *
51635163 * Note: we consider all indexes returned by RelationGetIndexList, even if
51645164 * they are not indisready or indisvalid. This is important because an
@@ -5167,10 +5167,10 @@ RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
51675167 * CONCURRENTLY is far enough along that we should ignore the index, it
51685168 * won't be returned at all by RelationGetIndexList.
51695169 */
5170+ indexattrs = NULL ;
51705171 uindexattrs = NULL ;
51715172 pkindexattrs = NULL ;
51725173 idindexattrs = NULL ;
5173- hotblockingattrs = NULL ;
51745174 foreach (l , indexoidlist )
51755175 {
51765176 Oid indexOid = lfirst_oid (l );
@@ -5235,9 +5235,8 @@ RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
52355235 */
52365236 if (attrnum != 0 )
52375237 {
5238- if (indexDesc -> rd_indam -> amhotblocking )
5239- hotblockingattrs = bms_add_member (hotblockingattrs ,
5240- attrnum - FirstLowInvalidHeapAttributeNumber );
5238+ indexattrs = bms_add_member (indexattrs ,
5239+ attrnum - FirstLowInvalidHeapAttributeNumber );
52415240
52425241 if (isKey && i < indexDesc -> rd_index -> indnkeyatts )
52435242 uindexattrs = bms_add_member (uindexattrs ,
@@ -5254,15 +5253,10 @@ RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
52545253 }
52555254
52565255 /* Collect all attributes used in expressions, too */
5257- if (indexDesc -> rd_indam -> amhotblocking )
5258- pull_varattnos (indexExpressions , 1 , & hotblockingattrs );
5256+ pull_varattnos (indexExpressions , 1 , & indexattrs );
52595257
5260- /*
5261- * Collect all attributes in the index predicate, too. We have to
5262- * ignore amhotblocking flag, because the row might become indexable,
5263- * in which case we have to add it to the index.
5264- */
5265- pull_varattnos (indexPredicate , 1 , & hotblockingattrs );
5258+ /* Collect all attributes in the index predicate, too */
5259+ pull_varattnos (indexPredicate , 1 , & indexattrs );
52665260
52675261 index_close (indexDesc , AccessShareLock );
52685262 }
@@ -5290,46 +5284,46 @@ RelationGetIndexAttrBitmap(Relation relation, IndexAttrBitmapKind attrKind)
52905284 bms_free (uindexattrs );
52915285 bms_free (pkindexattrs );
52925286 bms_free (idindexattrs );
5293- bms_free (hotblockingattrs );
5287+ bms_free (indexattrs );
52945288
52955289 goto restart ;
52965290 }
52975291
52985292 /* Don't leak the old values of these bitmaps, if any */
5293+ bms_free (relation -> rd_indexattr );
5294+ relation -> rd_indexattr = NULL ;
52995295 bms_free (relation -> rd_keyattr );
53005296 relation -> rd_keyattr = NULL ;
53015297 bms_free (relation -> rd_pkattr );
53025298 relation -> rd_pkattr = NULL ;
53035299 bms_free (relation -> rd_idattr );
53045300 relation -> rd_idattr = NULL ;
5305- bms_free (relation -> rd_hotblockingattr );
5306- relation -> rd_hotblockingattr = NULL ;
53075301
53085302 /*
53095303 * Now save copies of the bitmaps in the relcache entry. We intentionally
5310- * set rd_attrsvalid last, because that's what signals validity of the
5311- * values; if we run out of memory before making that copy, we won't leave
5312- * the relcache entry looking like the other ones are valid but empty.
5304+ * set rd_indexattr last, because that's the one that signals validity of
5305+ * the values; if we run out of memory before making that copy, we won't
5306+ * leave the relcache entry looking like the other ones are valid but
5307+ * empty.
53135308 */
53145309 oldcxt = MemoryContextSwitchTo (CacheMemoryContext );
53155310 relation -> rd_keyattr = bms_copy (uindexattrs );
53165311 relation -> rd_pkattr = bms_copy (pkindexattrs );
53175312 relation -> rd_idattr = bms_copy (idindexattrs );
5318- relation -> rd_hotblockingattr = bms_copy (hotblockingattrs );
5319- relation -> rd_attrsvalid = true;
5313+ relation -> rd_indexattr = bms_copy (indexattrs );
53205314 MemoryContextSwitchTo (oldcxt );
53215315
53225316 /* We return our original working copy for caller to play with */
53235317 switch (attrKind )
53245318 {
5319+ case INDEX_ATTR_BITMAP_ALL :
5320+ return indexattrs ;
53255321 case INDEX_ATTR_BITMAP_KEY :
53265322 return uindexattrs ;
53275323 case INDEX_ATTR_BITMAP_PRIMARY_KEY :
53285324 return pkindexattrs ;
53295325 case INDEX_ATTR_BITMAP_IDENTITY_KEY :
53305326 return idindexattrs ;
5331- case INDEX_ATTR_BITMAP_HOT_BLOCKING :
5332- return hotblockingattrs ;
53335327 default :
53345328 elog (ERROR , "unknown attrKind %u" , attrKind );
53355329 return NULL ;
@@ -6250,11 +6244,10 @@ load_relcache_init_file(bool shared)
62506244 rel -> rd_indexlist = NIL ;
62516245 rel -> rd_pkindex = InvalidOid ;
62526246 rel -> rd_replidindex = InvalidOid ;
6253- rel -> rd_attrsvalid = false ;
6247+ rel -> rd_indexattr = NULL ;
62546248 rel -> rd_keyattr = NULL ;
62556249 rel -> rd_pkattr = NULL ;
62566250 rel -> rd_idattr = NULL ;
6257- rel -> rd_hotblockingattr = NULL ;
62586251 rel -> rd_pubdesc = NULL ;
62596252 rel -> rd_statvalid = false;
62606253 rel -> rd_statlist = NIL ;
0 commit comments