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

Commit5ee80cc

Browse files
committed
Fix shared resources allocation
1 parent01e366b commit5ee80cc

File tree

4 files changed

+26
-3
lines changed

4 files changed

+26
-3
lines changed

‎dsm_array.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,16 @@ typedef BlockHeader* BlockHeaderPtr;
4343
#defineset_length(header,length) \
4444
((length) | ((*header) & FREE_BIT))
4545

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+
4656
/*
4757
* Initialize dsm config for arrays
4858
*/

‎init.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ static bool validate_range_constraint(Expr *, PartRelationInfo *, Datum *, Datum
3434
staticboolvalidate_hash_constraint(Expr*expr,PartRelationInfo*prel,int*hash);
3535
staticintcmp_range_entries(constvoid*p1,constvoid*p2);
3636

37+
Size
38+
pathman_memsize()
39+
{
40+
Sizesize;
41+
42+
size=get_dsm_shared_size()+MAXALIGN(sizeof(PathmanState));
43+
returnsize;
44+
}
45+
3746
void
3847
init_shmem_config()
3948
{
@@ -596,4 +605,4 @@ remove_relation_info(Oid relid)
596605
}
597606
prel->children_count=0;
598607
hash_search(relations, (constvoid*)&key,HASH_REMOVE,0);
599-
}
608+
}

‎pathman.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ int irange_list_length(List *rangeset);
156156
boolirange_list_find(List*rangeset,intindex,bool*lossy);
157157

158158
/* Dynamic shared memory functions */
159+
Sizeget_dsm_shared_size(void);
159160
voidinit_dsm_config(void);
160161
boolinit_dsm_segment(size_tblocks_count,size_tblock_size);
161162
voidinit_dsm_table(size_tblock_size,size_tstart,size_tend);
@@ -171,6 +172,7 @@ HTAB *range_restrictions;
171172
boolinitialization_needed;
172173

173174
/* initialization functions */
175+
Sizepathman_memsize(void);
174176
voidinit_shmem_config(void);
175177
voidload_config(void);
176178
voidcreate_relations_hashtable(void);

‎pg_pathman.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ _PG_init(void)
127127
}
128128
#endif
129129

130+
/* Request additional shared resources */
131+
RequestAddinShmemSpace(pathman_memsize());
132+
RequestAddinLWLocks(3);
133+
130134
set_rel_pathlist_hook_original=set_rel_pathlist_hook;
131135
set_rel_pathlist_hook=pathman_set_rel_pathlist_hook;
132136
shmem_startup_hook_original=shmem_startup_hook;
@@ -325,8 +329,6 @@ handle_modification_query(Query *parse)
325329
staticvoid
326330
pathman_shmem_startup(void)
327331
{
328-
/* Initialize locks */
329-
RequestAddinLWLocks(3);
330332

331333
/* Allocate shared memory objects */
332334
LWLockAcquire(AddinShmemInitLock,LW_EXCLUSIVE);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp