Hi all,Currently, gpdb supports two ways to synchronize the GUCs between master and segments.1. Using `SET` command, which call DispatchSetPGVariable() after set_config_option() on QD.
It only handles two GucAction type: GUC_ACTION_SET and GUC_ACTION_LOCAL which corresponds to `SET` and `SET LOCAL` command. But GUC_ACTION_SAVE is missing.2. Sync GUC when creating gang. By calling makeOptions(), all the gucs will be passed to QEs from QD.The above two methods both failed to handle the following case: `create extension xxx with schema yyy;`It will set the search_path inside the create extension statement only on master. No explicit `SET` or `SET LOCAL` command will be called. Currently, it only calls set_config_option() which set the search_path on master. It leads to issues6716
Hi,A rough search on the codes shows that execute_extension_script() is notexecuted by QE, so the search_path with action GUC_ACTION_SAVE is not set onQE.So I'm thinking how about we execute execute_extension_script() on QE too,to set up the search path to contain the target schema on QE. Meanwhile, weneed to prevent execute_sql_string() from being executed on QE.
I think we should change our approach, wrt. keeping GUCs in sync in all the processes. Instead of immediately dispatching the SET command, I think we should have a per-connection flag, to indicate whether the GUCs in that QE process are in sync with the QD process. If the GUCs become out of sync for any reason, for example because the user issues a SET command, or because the connection was just established and the GUCs haven't been set yet, clear the flag. Check the flag before dispatching any command, and issue the required SETs at that point, if needed.
And instead of trying to keep track of which GUCs are in sync, dispatch all the GUCs that are different from the default values.
Will the potential approach resolve the problem?