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/05/06 02:58:41 UTC

[GitHub] [iotdb] qiaojialin commented on a diff in pull request #5802: [IOTDB-2987] Optimize ConfigNodeGroup startup process

qiaojialin commented on code in PR #5802:
URL: https://github.com/apache/iotdb/pull/5802#discussion_r865815252


##########
thrift-confignode/src/main/thrift/confignode.thrift:
##########
@@ -134,19 +135,38 @@ struct TAuthorizerReq {
 }
 
 struct TAuthorizerResp {
-    1: required common.TSStatus status
-    2: required map<string, list<string>> authorizerInfo
+  1: required common.TSStatus status
+  2: required map<string, list<string>> authorizerInfo
 }
 
 struct TLoginReq {
-    1: required string userrname
-    2: required string password
+  1: required string userrname
+  2: required string password
 }
 
 struct TCheckUserPrivilegesReq{
-    1: required string username;
-    2: required list<string> paths
-    3: required i32 permission
+  1: required string username;
+  2: required list<string> paths
+  3: required i32 permission
+}
+
+// ConfigNode
+struct TConfigNodeLocation {
+  1: required common.TEndPoint internalEndPoint
+  2: required common.TEndPoint consensusEndPoint
+}
+
+struct TConfigNodeRegisterReq {
+  1: required TConfigNodeLocation configNodeLocation
+  2: required string dataNodeConsensusProtocolClass

Review Comment:
   add replication_factor



##########
node-commons/src/main/java/org/apache/iotdb/commons/utils/ThriftConfigNodeSerDeUtils.java:
##########
@@ -66,4 +67,23 @@ public static TStorageGroupSchema readTStorageGroupSchema(ByteBuffer buffer) {
     }
     return storageGroupSchema;
   }
+
+  public static void writeTConfigNodeLocation(

Review Comment:
   ```suggestion
     public static void serializeTConfigNodeLocation(
   ```



##########
confignode/src/main/java/org/apache/iotdb/confignode/service/ConfigNode.java:
##########
@@ -103,4 +108,17 @@ public void deactivate() throws IOException {
   public void stop() throws IOException {
     deactivate();
   }
+
+  private static class ConfigNodeHolder {
+
+    private static final ConfigNode INSTANCE = new ConfigNode();

Review Comment:
   why add a singleton



##########
node-commons/src/main/java/org/apache/iotdb/commons/utils/ThriftConfigNodeSerDeUtils.java:
##########
@@ -66,4 +67,23 @@ public static TStorageGroupSchema readTStorageGroupSchema(ByteBuffer buffer) {
     }
     return storageGroupSchema;
   }
+
+  public static void writeTConfigNodeLocation(
+      TConfigNodeLocation configNodeLocation, ByteBuffer buffer) {
+    try {
+      configNodeLocation.write(generateWriteProtocol(buffer));
+    } catch (TException e) {
+      throw new ThriftSerDeException("Write TConfigNodeLocation failed: ", e);
+    }
+  }
+
+  public static TConfigNodeLocation readTConfigNodeLocation(ByteBuffer buffer) {

Review Comment:
   ```suggestion
     public static TConfigNodeLocation deserializeTConfigNodeLocation(ByteBuffer buffer) {
   ```



##########
node-commons/src/main/java/org/apache/iotdb/commons/utils/NodeUrlParseConvertUtils.java:
##########
@@ -0,0 +1,188 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.commons.utils;
+
+import org.apache.iotdb.common.rpc.thrift.TEndPoint;
+import org.apache.iotdb.commons.exception.BadNodeUrlException;
+import org.apache.iotdb.confignode.rpc.thrift.TConfigNodeLocation;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.StringJoiner;
+
+public class NodeUrlParseConvertUtils {

Review Comment:
   ```suggestion
   public class NodeUrlUtils {
   ```



-- 
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