- Notifications
You must be signed in to change notification settings - Fork5
Commit6c03d98
committed
Change API of ShmemAlloc() so it throws error rather than returning NULL.
A majority of callers seem to have believed that this was the API specalready, because they omitted any check for a NULL result, and hencewould crash on an out-of-shared-memory failure. The original proposalwas to just add such error checks everywhere, but that does nothing toprevent similar omissions in future. Instead, let's make ShmemAlloc()throw the error (so we can remove the caller-side checks that do exist),and introduce a new function ShmemAllocNoError() that has the previousbehavior of returning NULL, for the small number of callers that needthat and are prepared to do the right thing. This also lets us removethe rather wishy-washy behavior of printing a WARNING for out-of-shmem,which never made much sense: either the caller has a strategy fordealing with that, or it doesn't. It's not ShmemAlloc's business todecide whether a warning is appropriate.The v10 release notes will need to call this out as a significantsource-code change. It's likely that it will be a bug fix forextension callers too, but if not, they'll need to change to usingShmemAllocNoError().This is nominally a bug fix, but the odds that it's fixing any livebug are actually rather small, because in general the requestsbeing made by the unchecked callers were already accounted for indetermining the overall shmem size, so really they ought not fail.Between that and the possible impact on extensions, no back-patch.Discussion: <24843.1472563085@sss.pgh.pa.us>1 parent6f7c0ea commit6c03d98
File tree
4 files changed
+26
-34
lines changed- src
- backend/storage
- ipc
- lmgr
- include/storage
4 files changed
+26
-34
lines changedLines changed: 24 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
163 | 163 |
| |
164 | 164 |
| |
165 | 165 |
| |
166 |
| - | |
| 166 | + | |
167 | 167 |
| |
168 |
| - | |
169 |
| - | |
170 |
| - | |
| 168 | + | |
171 | 169 |
| |
172 | 170 |
| |
173 | 171 |
| |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
174 | 191 |
| |
175 | 192 |
| |
176 | 193 |
| |
| |||
206 | 223 |
| |
207 | 224 |
| |
208 | 225 |
| |
209 |
| - | |
210 |
| - | |
211 |
| - | |
212 |
| - | |
213 |
| - | |
| 226 | + | |
214 | 227 |
| |
215 | 228 |
| |
216 | 229 |
| |
| |||
293 | 306 |
| |
294 | 307 |
| |
295 | 308 |
| |
296 |
| - | |
| 309 | + | |
297 | 310 |
| |
298 | 311 |
| |
299 | 312 |
| |
| |||
364 | 377 |
| |
365 | 378 |
| |
366 | 379 |
| |
367 |
| - | |
368 |
| - | |
369 |
| - | |
370 |
| - | |
371 |
| - | |
372 |
| - | |
373 | 380 |
| |
374 | 381 |
| |
375 | 382 |
| |
| |||
410 | 417 |
| |
411 | 418 |
| |
412 | 419 |
| |
413 |
| - | |
| 420 | + | |
414 | 421 |
| |
415 | 422 |
| |
416 | 423 |
| |
|
Lines changed: 0 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1184 | 1184 |
| |
1185 | 1185 |
| |
1186 | 1186 |
| |
1187 |
| - | |
1188 |
| - | |
1189 |
| - | |
1190 |
| - | |
1191 |
| - | |
1192 |
| - | |
1193 | 1187 |
| |
1194 | 1188 |
| |
1195 | 1189 |
| |
| |||
1255 | 1249 |
| |
1256 | 1250 |
| |
1257 | 1251 |
| |
1258 |
| - | |
1259 |
| - | |
1260 |
| - | |
1261 |
| - | |
1262 |
| - | |
1263 |
| - | |
1264 | 1252 |
| |
1265 | 1253 |
| |
1266 | 1254 |
| |
|
Lines changed: 1 addition & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
194 | 194 |
| |
195 | 195 |
| |
196 | 196 |
| |
| 197 | + | |
197 | 198 |
| |
198 | 199 |
| |
199 | 200 |
| |
200 |
| - | |
201 |
| - | |
202 |
| - | |
203 |
| - | |
204 |
| - | |
205 | 201 |
| |
206 | 202 |
| |
207 | 203 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
35 | 35 |
| |
36 | 36 |
| |
37 | 37 |
| |
| 38 | + | |
38 | 39 |
| |
39 | 40 |
| |
40 | 41 |
| |
|
0 commit comments
Comments
(0)