@@ -187,7 +187,7 @@ init_relation_info_static_data(void)
187
187
188
188
/* Invalidate PartStatusInfo for 'relid' */
189
189
void
190
- invalidate_pathman_status_info (Oid relid )
190
+ forget_status_of_relation (Oid relid )
191
191
{
192
192
PartStatusInfo * psin ;
193
193
PartParentInfo * ppar ;
@@ -225,7 +225,7 @@ invalidate_pathman_status_info(Oid relid)
225
225
226
226
/* Invalidate all PartStatusInfo entries */
227
227
void
228
- invalidate_pathman_status_info_cache (void )
228
+ invalidate_status_cache (void )
229
229
{
230
230
invalidate_psin_entries_using_relid (InvalidOid );
231
231
}
@@ -241,14 +241,14 @@ invalidate_psin_entries_using_relid(Oid relid)
241
241
242
242
while ((psin = (PartStatusInfo * ) hash_seq_search (& status )) != NULL )
243
243
{
244
- if (relid == InvalidOid ||
244
+ if (! OidIsValid ( relid ) ||
245
245
psin -> relid == relid ||
246
246
(psin -> prel && PrelHasPartition (psin -> prel , relid )))
247
247
{
248
248
/* Perform invalidation */
249
249
invalidate_psin_entry (psin );
250
250
251
- /* Exit if found */
251
+ /* Exit if exact match */
252
252
if (OidIsValid (relid ))
253
253
{
254
254
hash_seq_term (& status );
@@ -952,15 +952,10 @@ forget_bounds_of_partition(Oid partition)
952
952
NULL ) :
953
953
NULL ; /* don't even bother */
954
954
955
- /* Free this entry */
956
955
if (pbin )
957
956
{
958
- /* Call pfree() if it's RANGE bounds */
959
- if (pbin -> parttype == PT_RANGE )
960
- {
961
- FreeBound (& pbin -> range_min , pbin -> byval );
962
- FreeBound (& pbin -> range_max , pbin -> byval );
963
- }
957
+ /* Free this entry */
958
+ FreePartBoundInfo (pbin );
964
959
965
960
/* Finally remove this entry from cache */
966
961
pathman_cache_search_relid (bounds_cache ,
@@ -1027,6 +1022,26 @@ get_bounds_of_partition(Oid partition, const PartRelationInfo *prel)
1027
1022
return pbin ;
1028
1023
}
1029
1024
1025
+ void
1026
+ invalidate_bounds_cache (void )
1027
+ {
1028
+ HASH_SEQ_STATUS status ;
1029
+ PartBoundInfo * pbin ;
1030
+
1031
+ Assert (offsetof(PartBoundInfo , child_relid ) == 0 );
1032
+
1033
+ hash_seq_init (& status , bounds_cache );
1034
+
1035
+ while ((pbin = hash_seq_search (& status )) != NULL )
1036
+ {
1037
+ FreePartBoundInfo (pbin );
1038
+
1039
+ pathman_cache_search_relid (bounds_cache ,
1040
+ pbin -> child_relid ,
1041
+ HASH_REMOVE , NULL );
1042
+ }
1043
+ }
1044
+
1030
1045
/*
1031
1046
* Get constraint expression tree of a partition.
1032
1047
*
@@ -1258,6 +1273,26 @@ get_parent_of_partition(Oid partition)
1258
1273
}
1259
1274
}
1260
1275
1276
+ void
1277
+ invalidate_parents_cache (void )
1278
+ {
1279
+ HASH_SEQ_STATUS status ;
1280
+ PartParentInfo * ppar ;
1281
+
1282
+ Assert (offsetof(PartParentInfo , child_relid ) == 0 );
1283
+
1284
+ hash_seq_init (& status , parents_cache );
1285
+
1286
+ while ((ppar = hash_seq_search (& status )) != NULL )
1287
+ {
1288
+ /* This is a plain structure, no need to pfree() */
1289
+
1290
+ pathman_cache_search_relid (parents_cache ,
1291
+ ppar -> child_relid ,
1292
+ HASH_REMOVE , NULL );
1293
+ }
1294
+ }
1295
+
1261
1296
1262
1297
/*
1263
1298
* Partitioning expression routines.
0 commit comments