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

Commit64b5868

Browse files
ashutosh108Anton Voloshin
authored and
Anton Voloshin
committed
adapt shared_ispell for upcoming PostgreSQL 15
1. Only call RequestAddinShmemSpace and RequestNamedLWLockTranche from withinour implementation of shmem_request_hook (as required after commit 4f2400cb3in PostgreSQL 15).2. While we are here, remove _PG_fini, as it is now officially deadafter commit ab02d702e in PostgreSQL 15.
1 parentbe08627 commit64b5868

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

‎src/shared_ispell.c

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,11 @@
6666
PG_MODULE_MAGIC;
6767

6868
void_PG_init(void);
69-
void_PG_fini(void);
7069

7170
/* Memory for dictionaries in kbytes */
7271
staticintmax_ispell_mem_size_kb;
7372

74-
/* Saved hookvalues in case of unload */
73+
/* Saved hookvalue for proper chaining */
7574
staticshmem_startup_hook_typeprev_shmem_startup_hook=NULL;
7675

7776
/* These are used to allocate data within shared segment */
@@ -97,6 +96,11 @@ max_ispell_mem_size()
9796
return (Size)max_ispell_mem_size_kb*1024L;
9897
}
9998

99+
#if (PG_VERSION_NUM >=150000)
100+
staticshmem_request_hook_typeprev_shmem_request_hook=NULL;
101+
staticvoidshared_ispell_shmem_request(void);
102+
#endif
103+
100104
/*
101105
* Module load callback
102106
*/
@@ -127,33 +131,33 @@ _PG_init(void)
127131

128132
EmitWarningsOnPlaceholders("shared_ispell");
129133

130-
/*
131-
* Request additional shared resources. (These are no-ops if we're not in
132-
* the postmaster process.) We'll allocate or attach to the shared
133-
* resources in ispell_shmem_startup().
134-
*/
134+
#ifPG_VERSION_NUM >=150000
135+
prev_shmem_request_hook=shmem_request_hook;
136+
shmem_request_hook=shared_ispell_shmem_request;
137+
#else
135138
RequestAddinShmemSpace(max_ispell_mem_size());
136139

137140
#ifPG_VERSION_NUM >=90600
138141
RequestNamedLWLockTranche("shared_ispell",1);
139142
#else
140143
RequestAddinLWLocks(1);
144+
#endif
141145
#endif
142146

143147
/* Install hooks. */
144148
prev_shmem_startup_hook=shmem_startup_hook;
145149
shmem_startup_hook=ispell_shmem_startup;
146150
}
147151

148-
149-
/*
150-
* Module unload callback
151-
*/
152-
void
153-
_PG_fini(void)
152+
staticvoid
153+
shared_ispell_shmem_request(void)
154154
{
155-
/* Uninstall hooks. */
156-
shmem_startup_hook=prev_shmem_startup_hook;
155+
if (prev_shmem_request_hook)
156+
prev_shmem_request_hook();
157+
158+
RequestAddinShmemSpace(max_ispell_mem_size());
159+
160+
RequestNamedLWLockTranche("shared_ispell",1);
157161
}
158162

159163
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp