- Notifications
You must be signed in to change notification settings - Fork39
Fix shmem allocation size.#42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
maksm90 commentedMar 25, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Some notes about the relevance of this kind of estimation of max processes in
|
Agreed, and the code should have a comment saying that the value has to be synced with ProcGlobal->allProcCount initialization in InitProcGlobal(), so that it's clear to anyone looking at the code why this value is used.
Unfortunately it's not possible :( The community insisted to report only the top-level queryid there, for consistency with e.g. pg_stat_activity.query, even if I initially suggested to report the current query. So we, extension owners, still have to allocate and handle our own queryid array. Unfortunately there isn't even a simple way to do it only once and not once per extension. |
Yeah, it's a good idea to document the formula in that way.
It's a pity.
Yes, in essence, multiple extensions have to maintain its own storage for |
I just force-pushed the modifications we discussed. I tried to describe the problem with all consequences, so that if anyone tries to read or use the code for something else they will have all the information needed to know if that approach will work for them too. |
MaxBackends is still 0 when _PG_init() is called, which means that wedon't request enough memory in RequestAddinShmemSpace(), while the rest ofthe code sees (and allocate) a correct value.It's technically usually not a problem as postgres adds an extra 100kB ofmemory for small unaccounted memory usage, but it's better to avoid relying onit too much.Note that the value is still not guaranteed to be exact as other modules_PG_init() could later change the underlying GUCs, but there is not availableAPI to handle that case accurately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I just force-pushed the modifications we discussed. I tried to describe the problem with all consequences, so that if anyone tries to read or use the code for something else they will have all the information needed to know if that approach will work for them too.
Excellent! Thanks a lot. Approved.
Thanks! |
MaxBackends is still 0 when _PG_init() is called, which means that we
don't request enough memory in RequestAddinShmemSpace(), while the rest of
the code sees (and allocate) a correct value.
It's technically usually not a problem as postgres adds an extra 100kB of
memory for small unaccounted memory usage, but it's better to avoid relying on
it too much.
Note that the value is still not guaranteed to be exact as other modules
_PG_init() could later change the underlying GUCs, but there is not available
API to handle that case accurately.