@@ -81,9 +81,9 @@ refresh_pathman_relation_info(Oid relid,
81
81
Datum param_values [Natts_pathman_config_params ];
82
82
bool param_isnull [Natts_pathman_config_params ];
83
83
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 );
87
87
elog (DEBUG2 ,
88
88
found_entry ?
89
89
"Refreshing record for relation %u in pg_pathman's cache [%u]" :
@@ -239,9 +239,9 @@ invalidate_pathman_relation_info(Oid relid, bool *found)
239
239
HASHACTION action = found ? HASH_FIND : HASH_ENTER ;
240
240
PartRelationInfo * prel ;
241
241
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 );
245
245
246
246
if ((action == HASH_FIND ||
247
247
(action == HASH_ENTER && prel_found )) && PrelIsValid (prel ))
@@ -272,10 +272,9 @@ invalidate_pathman_relation_info(Oid relid, bool *found)
272
272
const PartRelationInfo *
273
273
get_pathman_relation_info (Oid relid )
274
274
{
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 );
279
278
/* Refresh PartRelationInfo if needed */
280
279
if (prel && !PrelIsValid (prel ))
281
280
{
@@ -345,20 +344,19 @@ get_pathman_relation_info_after_lock(Oid relid,
345
344
void
346
345
remove_pathman_relation_info (Oid relid )
347
346
{
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 ))
352
351
{
353
352
/* Free these arrays iff they're not NULL */
354
353
FreeChildrenArray (prel );
355
354
FreeRangesArray (prel );
356
355
}
357
356
358
357
/* 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 );
362
360
363
361
elog (DEBUG2 ,
364
362
"Removing record for relation %u in pg_pathman's cache [%u]" ,
@@ -509,10 +507,10 @@ cache_parent_of_partition(Oid partition, Oid parent)
509
507
bool found ;
510
508
PartParentInfo * ppar ;
511
509
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 );
516
514
elog (DEBUG2 ,
517
515
found ?
518
516
"Refreshing record for child %u in pg_pathman's cache [%u]" :
@@ -551,10 +549,10 @@ get_parent_of_partition_internal(Oid partition,
551
549
{
552
550
const char * action_str ; /* "Fetching"\"Resetting" */
553
551
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 );
558
556
/* Set 'action_str' */
559
557
switch (action )
560
558
{
@@ -581,9 +579,8 @@ get_parent_of_partition_internal(Oid partition,
581
579
582
580
/* Remove entry if necessary */
583
581
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 );
587
584
}
588
585
/* Try fetching parent from syscache if 'status' is provided */
589
586
else if (status )
0 commit comments