Skip to content

Commit 16810d9

Browse files
committed
Revisit pathman readiness again.
Most pathman functions break if pathman is disabled: earlier I put defense checks in split and merge range partitions, now it is drop_range_partition_expand_next. Looks like the reason is that pathman caches are not being invalidated if it is disabled: pathman_relcache_hook exits right away then. This is kinda reasonable: if we want to disable pathman completely, why maintain the caches? So this time try to bury the readiness check deeper, in get_pathman_relation_info itself. BTW, pathman caches are not dropped when it is disabled, which looks suspicious on its own -- probably if we re-enable it later, caches might be inconsistent.
1 parent d1032b0 commit 16810d9

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

expected/pathman_calamity.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ ERROR: pg_pathman is disabled
10091009
SELECT * FROM pathman_partition_list; /* not ok */
10101010
ERROR: pg_pathman is not initialized yet
10111011
SELECT get_part_range('calamity.survivor', 0, NULL::INT); /* not ok */
1012-
ERROR: pg_pathman is not initialized yet
1012+
ERROR: pg_pathman is disabled
10131013
EXPLAIN (COSTS OFF) SELECT * FROM calamity.survivor; /* OK */
10141014
QUERY PLAN
10151015
------------------------------

src/pl_range_funcs.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -489,9 +489,6 @@ split_range_partition(PG_FUNCTION_ARGS)
489489
char *query;
490490
int i;
491491

492-
if (!IsPathmanReady())
493-
elog(ERROR, "pg_pathman is disabled");
494-
495492
if (!PG_ARGISNULL(0))
496493
{
497494
partition1 = PG_GETARG_OID(0);
@@ -655,9 +652,6 @@ merge_range_partitions(PG_FUNCTION_ARGS)
655652
FmgrInfo finfo;
656653
int i;
657654

658-
if (!IsPathmanReady())
659-
elog(ERROR, "pg_pathman is disabled");
660-
661655
/* Validate array type */
662656
Assert(ARR_ELEMTYPE(arr) == REGCLASSOID);
663657

src/relation_info.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,9 @@ get_pathman_relation_info(Oid relid)
320320
{
321321
PartStatusInfo *psin;
322322

323+
if (!IsPathmanReady())
324+
elog(ERROR, "pg_pathman is disabled");
325+
323326
/* Should always be called in transaction */
324327
Assert(IsTransactionState());
325328

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy