...
- Start-up script `start-node.sh` creates ClusterMain, the program entry point of a cluster node;
- ClusterMain creates a MetaClusterServer, which receives MetaGroup RPCs from internal_meta_port;
- MetaClusterServer checks its configuration with other nodes, ensuring that at least over half of the nodes have consistent configuration;
- MetaClusterServer initializes the underlying IoTDB;
- MetaClusterServer creates a MetaMember, which is initialized as an ELECTOR, handles MetaGroup RPCs, and manages a partition table; a Coordinator, which is a coordinator for non-query;
- MetaMember tries to load the partition table from the local storage if it exists;
- MetaMember creates its MetaHeartbeatThread;
- MetaHeartbeatThread sends election requests to other cluster nodes;
- The quorum of the MetaGroup agree with the election and send responses to MetaClusterServer;
- MetaClusterServer lets MetaMember handle these responses;
- MetaMember gathers the responses and confirms that it has become a LEADER, then create a partition table if there is none;
- MetaMember creates DataClusterServer, which receives DataGroup RPCs from internal_data_port;
- DataClusterServer creates DataMembers depending on the partition table and the number of replications k; k DataMembers will be created, each for a DataGroup the node is in;
- DataMembers establish their own DataHeartbeatThreads, and by following similar procedures, they become FOLLOWERs or LEADERs;
- MetaMember creates ClientServer, which receives requests from clients, so by now, the node is ready to serve.
...
- Start-up script `start-node.sh` creates ClusterMain, the program entry point of a cluster node;
- ClusterMain creates a MetaClusterServer, which receives MetaGroup RPCs from internal_meta_port;
- MetaClusterServer checks its configuration with other nodes, ensuring that at least over half of the nodes have consistent configuration;
- MetaClusterServer initializes the underlying IoTDB;
- MetaClusterServer creates a MetaMember, which is initialized as an ELECTOR, handles MetaGroup RPCs, and manages a partition table;a Coordinator, which is a coordinator for non-query;
- MetaMember tries to load the partition table from the local storage if it exists;
- MetaMember creates its MetaHeartbeatThread;
- The leader of MetaGroup sends a heartbeat to MetaClusterServer;
- MetaClusterServer lets MetaMember handle the heartbeat;
- MetaMember becomes a LEADER, then update its partition table from the heartbeat if the heartbeat provides a newer heartbeat;
- MetaMember creates DataClusterServer, which receives DataGroup RPCs from internal_data_port;
- DataClusterServer creates DataMembers depending on the partition table and the number of replications k; k DataMembers will be created, each for a DataGroup the node is in;
- DataMembers establish their own DataHeartbeatThreads, and by following similar procedures, they become FOLLOWERs or LEADERs;
- MetaMember creates ClientServer, which receives requests from clients, so by now, the node is ready to serve.
...
- A client sends a request to ClientServer;
- ClientServer reads the request of a socket and lets Coordinator handle it;
- Coordinator lets MetaMember handle the request;
- MetaMember creates a log for the operation and appends it to its RaftLogManager;
- MetaMember sends the log to its followers;
- When MetaMember gathers enough responses from the followers, it commits the log through its RaftLogManager;
- Depending on what the operation is, its RaftLogManager applies the log to the underlying IoTDB or the partition table;
- The result of the operation is returned to the client;
...
Data in the cluster module means both timeseries schemas and timeseries data since they are partitioned into multiple DataGroups and not stored globally, so coordinators may be necessary to find the right nodes that should store the corresponding data. As the partition table is the sole data structure that may help coordination, its owner, MetaMember, works as a coordinator in the cluster moduleCoordinator need the help of MetaMember. Fig.5 shows the whole procedure involving cluster data related operations.
...
- A client sends a request to the coordinator's ClientServer;
- ClientServer parses the request and lets MetaMember Coordinator handle it;
- MetaMember Coordinator routes the request with the help of its coordinatormetaMember;
- MetaMember Coordinator sends the request to the DataGroup(s) that should process it; the request may be split before sending to each DataGroup;
- The receivers process the request and return their responses to MetaMemberCoordinator;
- MetaMember Coordinator concludes the results and return it to the client;
...
- A client sends a request to the leader's ClientServer;
- ClientServer parses the request and lets MetaMember Coordinator handle it;
- MetaMember Coordinator routes the request with the help of its coordinatormetaMember;
- Finding out that the node should process the request, MetaMember forwards the request to its DataClusterServer;
- DataClusterServer finds the associated DataMember that should process it;
- DataMember creates a log for the request and appends it to its RaftLogManager;
- DataMember sends the log to other nodes in its DataGroup;
- After sending to enough replicas, DataMember commit the log to its RaftLogManager;
- RaftLogManager then applies the log to the underlying IoTDB;
- The result is returned to the client.
...