@@ -81,9 +81,9 @@ refresh_pathman_relation_info(Oid relid,
8181 Datum param_values [Natts_pathman_config_params ];
8282 bool param_isnull [Natts_pathman_config_params ];
8383
84- prel = (PartRelationInfo * ) hash_search (partitioned_rels ,
85- ( const void * ) & relid ,
86- HASH_ENTER , & found_entry );
84+ prel = (PartRelationInfo * ) pathman_cache_search_relid (partitioned_rels ,
85+ relid , HASH_ENTER ,
86+ & found_entry );
8787 elog (DEBUG2 ,
8888 found_entry ?
8989 "Refreshing record for relation %u in pg_pathman's cache [%u]" :
@@ -239,9 +239,9 @@ invalidate_pathman_relation_info(Oid relid, bool *found)
239239 HASHACTION action = found ? HASH_FIND : HASH_ENTER ;
240240 PartRelationInfo * prel ;
241241
242- prel = hash_search (partitioned_rels ,
243- ( const void * ) & relid ,
244- action , & prel_found );
242+ prel = pathman_cache_search_relid (partitioned_rels ,
243+ relid , action ,
244+ & prel_found );
245245
246246 if ((action == HASH_FIND ||
247247 (action == HASH_ENTER && prel_found )) && PrelIsValid (prel ))
@@ -272,10 +272,9 @@ invalidate_pathman_relation_info(Oid relid, bool *found)
272272const PartRelationInfo *
273273get_pathman_relation_info (Oid relid )
274274{
275- const PartRelationInfo * prel = hash_search (partitioned_rels ,
276- (const void * ) & relid ,
277- HASH_FIND , NULL );
278-
275+ const PartRelationInfo * prel = pathman_cache_search_relid (partitioned_rels ,
276+ relid , HASH_FIND ,
277+ NULL );
279278 /* Refresh PartRelationInfo if needed */
280279 if (prel && !PrelIsValid (prel ))
281280 {
@@ -345,20 +344,19 @@ get_pathman_relation_info_after_lock(Oid relid,
345344void
346345remove_pathman_relation_info (Oid relid )
347346{
348- PartRelationInfo * prel = hash_search (partitioned_rels ,
349- ( const void * ) & relid ,
350- HASH_FIND , NULL );
351- if (prel && PrelIsValid (prel ))
347+ PartRelationInfo * prel = pathman_cache_search_relid (partitioned_rels ,
348+ relid , HASH_FIND ,
349+ NULL );
350+ if (PrelIsValid (prel ))
352351 {
353352 /* Free these arrays iff they're not NULL */
354353 FreeChildrenArray (prel );
355354 FreeRangesArray (prel );
356355 }
357356
358357 /* Now let's remove the entry completely */
359- hash_search (partitioned_rels ,
360- (const void * ) & relid ,
361- HASH_REMOVE , NULL );
358+ pathman_cache_search_relid (partitioned_rels , relid ,
359+ HASH_REMOVE , NULL );
362360
363361 elog (DEBUG2 ,
364362 "Removing record for relation %u in pg_pathman's cache [%u]" ,
@@ -509,10 +507,10 @@ cache_parent_of_partition(Oid partition, Oid parent)
509507 bool found ;
510508 PartParentInfo * ppar ;
511509
512- ppar = hash_search (parent_cache ,
513- ( const void * ) & partition ,
514- HASH_ENTER , & found );
515-
510+ ppar = pathman_cache_search_relid (parent_cache ,
511+ partition ,
512+ HASH_ENTER ,
513+ & found );
516514 elog (DEBUG2 ,
517515 found ?
518516 "Refreshing record for child %u in pg_pathman's cache [%u]" :
@@ -551,10 +549,10 @@ get_parent_of_partition_internal(Oid partition,
551549{
552550 const char * action_str ; /* "Fetching"\"Resetting" */
553551 Oid parent ;
554- PartParentInfo * ppar = hash_search (parent_cache ,
555- ( const void * ) & partition ,
556- HASH_FIND , NULL );
557-
552+ PartParentInfo * ppar = pathman_cache_search_relid (parent_cache ,
553+ partition ,
554+ HASH_FIND ,
555+ NULL );
558556 /* Set 'action_str' */
559557 switch (action )
560558 {
@@ -581,9 +579,8 @@ get_parent_of_partition_internal(Oid partition,
581579
582580 /* Remove entry if necessary */
583581 if (action == HASH_REMOVE )
584- hash_search (parent_cache ,
585- (const void * ) & partition ,
586- HASH_REMOVE , NULL );
582+ pathman_cache_search_relid (parent_cache , partition ,
583+ HASH_REMOVE , NULL );
587584 }
588585 /* Try fetching parent from syscache if 'status' is provided */
589586 else if (status )
0 commit comments