We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent01e366b commit5ee80ccCopy full SHA for 5ee80cc
dsm_array.c
@@ -43,6 +43,16 @@ typedef BlockHeader* BlockHeaderPtr;
43
#defineset_length(header,length) \
44
((length) | ((*header) & FREE_BIT))
45
46
+/*
47
+ * Amount of memory that need to be requested in shared memory to store dsm
48
+ * config
49
+ */
50
+Size
51
+get_dsm_shared_size()
52
+{
53
+return (Size)MAXALIGN(sizeof(DsmConfig));
54
+}
55
+
56
/*
57
* Initialize dsm config for arrays
58
*/
init.c
@@ -34,6 +34,15 @@ static bool validate_range_constraint(Expr *, PartRelationInfo *, Datum *, Datum
34
staticboolvalidate_hash_constraint(Expr*expr,PartRelationInfo*prel,int*hash);
35
staticintcmp_range_entries(constvoid*p1,constvoid*p2);
36
37
38
+pathman_memsize()
39
40
+Sizesize;
41
42
+size=get_dsm_shared_size()+MAXALIGN(sizeof(PathmanState));
+returnsize;
void
init_shmem_config()
{
@@ -596,4 +605,4 @@ remove_relation_info(Oid relid)
596
605
}
597
606
prel->children_count=0;
598
607
hash_search(relations, (constvoid*)&key,HASH_REMOVE,0);
599
-}
608
pathman.h
@@ -156,6 +156,7 @@ int irange_list_length(List *rangeset);
156
boolirange_list_find(List*rangeset,intindex,bool*lossy);
157
158
/* Dynamic shared memory functions */
159
+Sizeget_dsm_shared_size(void);
160
voidinit_dsm_config(void);
161
boolinit_dsm_segment(size_tblocks_count,size_tblock_size);
162
voidinit_dsm_table(size_tblock_size,size_tstart,size_tend);
@@ -171,6 +172,7 @@ HTAB *range_restrictions;
171
172
boolinitialization_needed;
173
174
/* initialization functions */
175
+Sizepathman_memsize(void);
176
voidinit_shmem_config(void);
177
voidload_config(void);
178
voidcreate_relations_hashtable(void);
pg_pathman.c
@@ -127,6 +127,10 @@ _PG_init(void)
127
128
#endif
129
130
+/* Request additional shared resources */
131
+RequestAddinShmemSpace(pathman_memsize());
132
+RequestAddinLWLocks(3);
133
134
set_rel_pathlist_hook_original=set_rel_pathlist_hook;
135
set_rel_pathlist_hook=pathman_set_rel_pathlist_hook;
136
shmem_startup_hook_original=shmem_startup_hook;
@@ -325,8 +329,6 @@ handle_modification_query(Query *parse)
325
329
staticvoid
326
330
pathman_shmem_startup(void)
327
331
328
-/* Initialize locks */
-RequestAddinLWLocks(3);
332
333
/* Allocate shared memory objects */
334
LWLockAcquire(AddinShmemInitLock,LW_EXCLUSIVE);