On Wed, Dec 9, 2015 at 5:31 PM, Amit Kapila <amit.kapil...@gmail.com> wrote: > > Another bigger issue I see in the above part of code is that it doesn't > seem to be safe to call load_hba() at that place in PostgresMain() as > currently load_hba() is using a context created from PostmasterContext > to perform the parsing and some other stuff, the PostmasterContext > won't be available at that time. It is deleted immediately after > InitPostgres > is completed. So either we need to make PostmasterContext don't go > away after InitPostgres() or load_hba shouldn't use it and rather use > CurrentMemroyContext similar to ProcessConfigFile or may be use > TopMemoryContext instead of PostmasterContext if possible. I think > this needs some more thoughts. > > Apart from above, this patch doesn't seem to work on Windows or > for EXEC_BACKEND builds as we are loading the hba file in a > temporary context (PostmasterContext, refer PerformAuthentication) > which won't be alive for the backends life. This works on linux because > of fork/exec mechanism which allows to inherit the parsed file > (parsed_hba_lines). This is slightly tricky problem to solve and we > have couple of options (a) use TopMemoryContext instead of Postmaster > Context to load hba; (b) Use CurrentMemoryContext (c) pass the parsed > hba file for Windows/Exec_Backend using save_backend_variables/ > restore_backend_variables mechanism or if you have any other idea. > If you don't have any better idea, then you can evaluate above ideas > and see which one makes more sense.
Reverting the context release patch is already provided in the first mail of this thread [1]. Forgot to mention about the same in further mails. Here I attached the same patch. This patch needs to be applied first before pg_hba_lookup patch. I tested it in windows version also. [1] - http://www.postgresql.org/message-id/cajrrpgffyf45mfk7ub+qhwhxn_ttmknrvhtudefqzuzzrwe...@mail.gmail.com Regards, Hari Babu Fujitsu Australia
revert_hba_context_release_in_backend.patch
Description: Binary data
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers