What is CoordinatorPools used for?

Asked by Alvin Peng

Hi,

I see in CoordinatorAgent.initDatabase(), it will call CoordinatorPools.initPool to initialize the "coordinator pools"; and in SysDatabase.getCoordinatorNodeID(), it uses chooseTempNodeId() to pick a node "that has the most tables".

My questions are:
1. What is the coordinatorPools used for? I can not find reference to it in later steps.
2. Per my understanding, the coordinator id is 0 (stado uses SysAgent.getAgent(0) as CoordinatorAgent). So why need to chooseTempNodeId for the CoordinatorNodeID?

Thanks in advance!

Regards,
Alvin

Question information

Language:
English Edit question
Status:
Solved
For:
Stado Edit question
Assignee:
No assignee Edit question
Solved by:
Andrei Martsinchyk
Solved:
Last query:
Last reply:
Revision history for this message
Best Andrei Martsinchyk (andrei-martsinchyk) said :
#1

Hi Alvin,
1. To execute some complex queries coordinator needs to store intermediate temporary data to a database. One of the node databases is used for that. CoordinatorPool is holding connections to that database. XDBSessionContext.coordConnection is taken from that. You can look into the code in the engine and queryproc packages to see how it is used.
2. The id you are talking about is used in messaging between Agents. Id of the Coordinator is 0, id of a Node is the node number.
The connection pool that is set up here is not related to the messaging. The chooseTempNodeId() returns node number of the Node which backend database should be used by the query executor as a temporary storage.

Andrei

Revision history for this message
Alvin Peng (pengalvin) said :
#2

Hi Andrei,

Thank you very much for you answer!

Alvin

Revision history for this message
Alvin Peng (pengalvin) said :
#3

Thanks Andrei Martsinchyk, that solved my question.