From: Michael P. <mic...@gm...> - 2010-12-10 00:02:53
|
Hi all, I had a look at the code to try to understand how it could be able to fix EXECUTE DIRECT. It is going to be needed to implement some HA features, and I believe users would find this functionality useful if fixed. I am seeing two ways to fix it now. The first one could be to do the implementation out of Portal as we did before moving XC query execution there. This was the first implementation of EXECUTE DIRECT that was done. It looks to be an easy solution, but if we have a look long-term, it does not follow the will to move query execution inside portal. So here are the main lines I propose to fix that, with an implementation inside portal. First, since DDL synchronize commit, it is possible Coordinators to interact between themselves, so the query should be extended to: -- EXECUTE DIRECT ON (COORDINATOR num | NODE num, ...) query to be compared to what is in the current code: -- EXECUTE DIRECT ON (COORDINATOR | NODE num, ...) query Then, we have to modify query analyze in analyze.c. There is an API in the code called transformExecDirectStmt that transforms the query and changes its shape. In the analyze part, you have to check if the query is launched locally or not. If it is not local, change the node type to Remote Query to make it run in ExecRemoteQuery when launching it. If it is local, you have to parse the query with parse_query and then to analyze it with parse_analyze. After parsing and analyzing, change its node type to Query, to make it launch locally. The difficult part of this implementation does not seem to be the analyze and parsing part, it is in the planner. The question is: Should the query go through pgxc_planner or normal planner if it is local? Here is my proposal: pgxc_planner looks to be better but we have to put a flag (when analyzing) in the query to be sure to launch the query on the correct nodes when determining execution nodes in get_plan_nodes. Regards, ------ Michael Paquier http://michaelpq.users.sourceforge.net |