|
26 | 26 | #include"utils/snapmgr.h"
|
27 | 27 |
|
28 | 28 |
|
| 29 | +/* |
| 30 | + * We delay all invalidation jobs received in relcache hook. |
| 31 | + */ |
29 | 32 | staticList*delayed_invalidation_parent_rels=NIL;
|
30 | 33 | staticList*delayed_invalidation_vague_rels=NIL;
|
31 |
| -staticbooldelayed_shutdown= false; |
| 34 | +staticbooldelayed_shutdown= false;/* pathman was dropped */ |
| 35 | + |
32 | 36 |
|
33 | 37 | /* Add unique Oid to list, allocate in TopMemoryContext */
|
34 | 38 | #definelist_add_unique(list,oid) \
|
@@ -291,11 +295,24 @@ finish_delayed_invalidation(void)
|
291 | 295 | {
|
292 | 296 | ListCell*lc;
|
293 | 297 |
|
| 298 | +/* Handle the probable 'DROP EXTENSION' case */ |
294 | 299 | if (delayed_shutdown)
|
295 | 300 | {
|
296 | 301 | delayed_shutdown= false;
|
297 |
| -unload_config(); |
298 |
| -return; |
| 302 | + |
| 303 | +/* Check that PATHMAN_CONFIG table has indeed been dropped */ |
| 304 | +if (InvalidOid==get_relname_relid(PATHMAN_CONFIG,get_pathman_schema())) |
| 305 | +{ |
| 306 | +/* Ok, let's unload pg_pathman's config */ |
| 307 | +unload_config(); |
| 308 | + |
| 309 | +/* Disregard all remaining invalidation jobs */ |
| 310 | +free_invalidation_list(delayed_invalidation_parent_rels); |
| 311 | +free_invalidation_list(delayed_invalidation_vague_rels); |
| 312 | + |
| 313 | +/* No need to continue, exit */ |
| 314 | +return; |
| 315 | +} |
299 | 316 | }
|
300 | 317 |
|
301 | 318 | /* Process relations that are (or were) definitely partitioned */
|
@@ -324,16 +341,19 @@ finish_delayed_invalidation(void)
|
324 | 341 |
|
325 | 342 | switch (search)
|
326 | 343 | {
|
| 344 | +/* It's still parent */ |
327 | 345 | casePPS_ENTRY_PART_PARENT:
|
328 | 346 | perform_parent_refresh(parent);
|
329 | 347 | break;
|
330 | 348 |
|
| 349 | +/* It *might have been* parent before (not in PATHMAN_CONFIG) */ |
331 | 350 | casePPS_ENTRY_PARENT:
|
332 | 351 | remove_pathman_relation_info(parent);
|
333 | 352 | break;
|
334 | 353 |
|
| 354 | +/* How come we still don't know?? */ |
335 | 355 | casePPS_NOT_SURE:
|
336 |
| -elog(ERROR,"This should never happen"); |
| 356 | +elog(ERROR,"Unknown table status, this should never happen"); |
337 | 357 | break;
|
338 | 358 |
|
339 | 359 | default:
|
@@ -482,6 +502,11 @@ try_syscache_parent_search(Oid partition, PartParentSearch *status)
|
482 | 502 | {
|
483 | 503 | parent= ((Form_pg_inherits)GETSTRUCT(inheritsTuple))->inhparent;
|
484 | 504 |
|
| 505 | +/* |
| 506 | + * NB: don't forget that 'inh' flag does not immediately |
| 507 | + * mean that this is a pg_pathman's partition. It might |
| 508 | + * be just a casual inheriting table. |
| 509 | + */ |
485 | 510 | if (status)*status=PPS_ENTRY_PARENT;
|
486 | 511 |
|
487 | 512 | /* Check that PATHMAN_CONFIG contains this table */
|
|