You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/06/30 03:47:50 UTC
[GitHub] [iotdb] wangchao316 commented on a diff in pull request #6524: [IOTDB-3648] Reinforce ConfigNode startup process
wangchao316 commented on code in PR #6524:
URL: https://github.com/apache/iotdb/pull/6524#discussion_r910578344
##########
confignode/src/main/java/org/apache/iotdb/confignode/persistence/NodeInfo.java:
##########
@@ -93,7 +85,7 @@ public class NodeInfo implements SnapshotProcessor {
// Online DataNodes
private final ReentrantReadWriteLock dataNodeInfoReadWriteLock;
- private final AtomicInteger nextNodeId = new AtomicInteger(1);
+ private final AtomicInteger nextNodeId = new AtomicInteger(0);
Review Comment:
why is 0? if isseednode , nodeid is 0.
##########
confignode/src/main/java/org/apache/iotdb/confignode/client/SyncConfigNodeClientPool.java:
##########
@@ -83,26 +83,39 @@ public TConfigNodeRegisterResp registerConfigNode(
.setMessage("All retry failed due to " + lastException.getMessage()));
}
- public TSStatus addConsensusGroup(
- TEndPoint endPoint, List<TConfigNodeLocation> configNodeLocation) {
+ public void addConsensusGroup(TEndPoint endPoint, List<TConfigNodeLocation> configNodeLocation)
+ throws Exception {
// TODO: Unified retry logic
- Throwable lastException = null;
+ Exception lastException = null;
for (int retry = 0; retry < retryNum; retry++) {
try (SyncConfigNodeIServiceClient client = clientManager.borrowClient(endPoint)) {
TConfigNodeRegisterResp registerResp = new TConfigNodeRegisterResp();
registerResp.setConfigNodeList(configNodeLocation);
registerResp.setStatus(StatusUtils.OK);
- return client.addConsensusGroup(registerResp);
- } catch (Throwable e) {
+ client.addConsensusGroup(registerResp);
+ return;
+ } catch (Exception e) {
lastException = e;
LOGGER.warn(
"Add Consensus Group failed because {}, retrying {} ...", e.getMessage(), retry);
doRetryWait(retry);
}
}
- LOGGER.error("Add ConsensusGroup failed", lastException);
- return new TSStatus(TSStatusCode.ALL_RETRY_FAILED.getStatusCode())
- .setMessage("All retry failed due to " + lastException.getMessage());
+
+ throw lastException;
Review Comment:
does not throw exception in last code
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org