[ 
https://issues.apache.org/jira/browse/IOTDB-5218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17653380#comment-17653380
 ] 

Yongzao Dan commented on IOTDB-5218:
------------------------------------

We can't mark a DataNode as started until there exists at least one Region been 
assigned to it for the following reasons:

 
 # When there exist only 1 ConfigNode and 1 DataNode. We need user to insert 
some data to activate this DataNode(i.e. create some Regions on this DataNode). 
Therefore, we should take this DataNode as started successfully first. 
Otherwise, the user can't connect to this DataNode and insert data on it.
 # The ConfigNode-leader will not mark a DataNode as started successfully until 
the ConfigNode-leader receive the first heartbeat that push by this DataNode. 
We can't take the DataNode as started successfully even though all 
communication in startup process are success. Because during the startup 
communication, the DataNode is took as the RPC-client while the 
ConfigNode-leader is took as the RPC-server. Therefore, we should mark the 
DataNode as started until the ConfigNode-leader receive the first heartbeat 
that push by this DataNode, in which the DataNode is took as the RPC-server and 
the ConfigNode-leader is took as the RPC-client. Thus we can finally ensure 
that these two kinds of RPC communication are all feasible.

> DataNode should marked started successfully until the region is assigned 
> -------------------------------------------------------------------------
>
>                 Key: IOTDB-5218
>                 URL: https://issues.apache.org/jira/browse/IOTDB-5218
>             Project: Apache IoTDB
>          Issue Type: Bug
>    Affects Versions: 1.0.0
>            Reporter: Xiangdong Huang
>            Assignee: Yongzao Dan
>            Priority: Major
>              Labels: DataNode
>
> A scenario:
>  * start a configNode
>  * start a datanode immediatelly
>  * write data immediatelly
> Then there will be error:
> org.apache.iotdb.commons.exception.IoTDBException: ConfigNode failed to 
> extend Region because there are not enough DataNodes
>  
> Can use the following codes to reproduct:
> {code:java}
> IoTDBService service = IoTDBService.getInstance();
> service.startConfigNodeService();
> IoTDBService.getInstance().startDataNodeService();
> long time = System.currentTimeMillis();
> IoTDBService.getInstance().insertRecord("root.test.d1", time,
>     Collections.singletonList("s1"), Collections.singletonList("1.0")); {code}
> IoTDBService is a wrapper to wrap CongfigNode's main() and DataNode's main().
>  
> IMO, the datanode server is really ready only when there is a region for it.
> Besides, if the process is time consuming, we can add a status check method 
> to check whether datanode is ready.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to