Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit14e05f2

Browse files
committed
[WIP] add 'allow_incomplete' option to function refresh_pathman_relation_info()
1 parentf603e6c commit14e05f2

File tree

4 files changed

+20
-15
lines changed

4 files changed

+20
-15
lines changed

‎src/init.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,9 @@ read_pathman_config(void)
752752
}
753753

754754
/* Create or update PartRelationInfo for this partitioned table */
755-
refresh_pathman_relation_info(relid,parttype,text_to_cstring(attname));
755+
refresh_pathman_relation_info(relid,parttype,
756+
text_to_cstring(attname),
757+
true);/* allow lazy prel loading */
756758
}
757759

758760
/* Clean resources */

‎src/pl_funcs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,9 @@ add_to_pathman_config(PG_FUNCTION_ARGS)
623623
/* Some flags might change during refresh attempt */
624624
save_pathman_init_state(&init_state);
625625

626-
refresh_pathman_relation_info(relid,parttype,text_to_cstring(attname));
626+
refresh_pathman_relation_info(relid,parttype,
627+
text_to_cstring(attname),
628+
false);/* initialize immediately */
627629
}
628630
PG_CATCH();
629631
{

‎src/relation_info.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ static Oid get_parent_of_partition_internal(Oid partition,
6767
constPartRelationInfo*
6868
refresh_pathman_relation_info(Oidrelid,
6969
PartTypepartitioning_type,
70-
constchar*part_column_name)
70+
constchar*part_column_name,
71+
boolallow_incomplete)
7172
{
7273
constLOCKMODElockmode=AccessShareLock;
7374
constTypeCacheEntry*typcache;
@@ -103,14 +104,14 @@ refresh_pathman_relation_info(Oid relid,
103104
}
104105

105106
/* First we assume that this entry is invalid */
106-
prel->valid= false;
107+
prel->valid= false;
107108

108109
/* Make both arrays point to NULL */
109-
prel->children=NULL;
110-
prel->ranges=NULL;
110+
prel->children=NULL;
111+
prel->ranges=NULL;
111112

112113
/* Set partitioning type */
113-
prel->parttype=partitioning_type;
114+
prel->parttype=partitioning_type;
114115

115116
/* Initialize PartRelationInfo using syscache & typcache */
116117
prel->attnum=get_attnum(relid,part_column_name);
@@ -245,9 +246,8 @@ get_pathman_relation_info(Oid relid)
245246

246247
/* Refresh partitioned table cache entry (might turn NULL) */
247248
/* TODO: possible refactoring, pass found 'prel' instead of searching */
248-
prel=refresh_pathman_relation_info(relid,
249-
part_type,
250-
attname);
249+
prel=refresh_pathman_relation_info(relid,part_type,
250+
attname, false);
251251
}
252252
/* Else clear remaining cache entry */
253253
elseremove_pathman_relation_info(relid);
@@ -611,10 +611,10 @@ try_perform_parent_refresh(Oid parent)
611611
parttype=DatumGetPartType(values[Anum_pathman_config_parttype-1]);
612612
attname=DatumGetTextP(values[Anum_pathman_config_attname-1]);
613613

614-
/* If anything went wrong, return false (actually, it mightthrow ERROR) */
615-
if (!PrelIsValid(refresh_pathman_relation_info(parent,parttype,
616-
text_to_cstring(attname))))
617-
return false;
614+
/* If anything went wrong, return false (actually, it mightemit ERROR) */
615+
refresh_pathman_relation_info(parent,parttype,
616+
text_to_cstring(attname),
617+
true);/* allow lazy */
618618
}
619619
/* Not a partitioned relation */
620620
elsereturn false;

‎src/relation_info.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ PrelLastChild(const PartRelationInfo *prel)
120120

121121
constPartRelationInfo*refresh_pathman_relation_info(Oidrelid,
122122
PartTypepartitioning_type,
123-
constchar*part_column_name);
123+
constchar*part_column_name,
124+
boolallow_incomplete);
124125
voidinvalidate_pathman_relation_info(Oidrelid,bool*found);
125126
voidremove_pathman_relation_info(Oidrelid);
126127
constPartRelationInfo*get_pathman_relation_info(Oidrelid);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp