You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by hx...@apache.org on 2021/05/03 03:20:20 UTC
[iotdb] branch test_container updated: temprory submit
This is an automated email from the ASF dual-hosted git repository.
hxd pushed a commit to branch test_container
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/test_container by this push:
new 3bb61e5 temprory submit
3bb61e5 is described below
commit 3bb61e52fa6b952575a52488a6b4e0537de0a61d
Author: xiangdong huang <sa...@gmail.com>
AuthorDate: Mon May 3 11:19:46 2021 +0800
temprory submit
---
.../cluster/server/ClusterInfoClientServer.java | 62 ++++++++++++++++++++++
.../iotdb/cluster/server/MetaClusterServer.java | 19 ++-----
.../cluster/utils/nodetool/ClusterMonitor.java | 5 +-
thrift-cluster/src/main/thrift/cluster.thrift | 31 +++--------
4 files changed, 77 insertions(+), 40 deletions(-)
diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/server/ClusterInfoClientServer.java b/cluster/src/main/java/org/apache/iotdb/cluster/server/ClusterInfoClientServer.java
new file mode 100644
index 0000000..cff7fe9
--- /dev/null
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/server/ClusterInfoClientServer.java
@@ -0,0 +1,62 @@
+/*
+ * 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.cluster.server;
+
+import org.apache.iotdb.cluster.rpc.thrift.ClusterInfoService;
+import org.apache.iotdb.cluster.rpc.thrift.Node;
+import org.apache.iotdb.cluster.utils.nodetool.ClusterMonitor;
+import org.apache.thrift.TException;
+
+import java.util.List;
+import java.util.Map;
+
+public class ClusterInfoClientServer implements ClusterInfoService.Iface {
+
+ @Override
+ public List<Node> getRing() throws TException {
+ return ClusterMonitor.INSTANCE.getRing();
+ }
+
+ @Override
+ public Map<Long, List<Node>> getDataPartition(String path, long startTime, long endTime)
+ throws TException {
+ // Map<Long, PartitionGroup> result =
+ // ClusterMonitor.INSTANCE.getDataPartition(path, startTime, endTime);
+
+ return null;
+ }
+
+ @Override
+ public List<Node> getMetaPartition(String path) throws TException {
+ return null;
+ }
+
+ @Override
+ public Map<Node, Boolean> getAllNodeStatus() throws TException {
+ return null;
+ }
+
+ @Override
+ public String getInstrumentingInfo() throws TException {
+ return null;
+ }
+
+ @Override
+ public void resetInstrumenting() throws TException {}
+}
diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/server/MetaClusterServer.java b/cluster/src/main/java/org/apache/iotdb/cluster/server/MetaClusterServer.java
index 12e286f..84bb15f 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/server/MetaClusterServer.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/server/MetaClusterServer.java
@@ -24,20 +24,7 @@ import org.apache.iotdb.cluster.exception.ConfigInconsistentException;
import org.apache.iotdb.cluster.exception.StartUpCheckFailureException;
import org.apache.iotdb.cluster.metadata.CMManager;
import org.apache.iotdb.cluster.metadata.MetaPuller;
-import org.apache.iotdb.cluster.rpc.thrift.AddNodeResponse;
-import org.apache.iotdb.cluster.rpc.thrift.AppendEntriesRequest;
-import org.apache.iotdb.cluster.rpc.thrift.AppendEntryRequest;
-import org.apache.iotdb.cluster.rpc.thrift.CheckStatusResponse;
-import org.apache.iotdb.cluster.rpc.thrift.ElectionRequest;
-import org.apache.iotdb.cluster.rpc.thrift.ExecutNonQueryReq;
-import org.apache.iotdb.cluster.rpc.thrift.HeartBeatRequest;
-import org.apache.iotdb.cluster.rpc.thrift.HeartBeatResponse;
-import org.apache.iotdb.cluster.rpc.thrift.Node;
-import org.apache.iotdb.cluster.rpc.thrift.RequestCommitIndexResponse;
-import org.apache.iotdb.cluster.rpc.thrift.SendSnapshotRequest;
-import org.apache.iotdb.cluster.rpc.thrift.StartUpStatus;
-import org.apache.iotdb.cluster.rpc.thrift.TNodeStatus;
-import org.apache.iotdb.cluster.rpc.thrift.TSMetaService;
+import org.apache.iotdb.cluster.rpc.thrift.*;
import org.apache.iotdb.cluster.rpc.thrift.TSMetaService.AsyncProcessor;
import org.apache.iotdb.cluster.rpc.thrift.TSMetaService.Processor;
import org.apache.iotdb.cluster.server.heartbeat.MetaHeartbeatServer;
@@ -50,7 +37,6 @@ import org.apache.iotdb.db.exception.query.QueryProcessException;
import org.apache.iotdb.db.service.IoTDB;
import org.apache.iotdb.db.service.RegisterManager;
import org.apache.iotdb.service.rpc.thrift.TSStatus;
-
import org.apache.thrift.TException;
import org.apache.thrift.TProcessor;
import org.apache.thrift.async.AsyncMethodCallback;
@@ -112,7 +98,10 @@ public class MetaClusterServer extends RaftServer
((CMManager) IoTDB.metaManager).setCoordinator(coordinator);
ioTDB.active();
member.start();
+ // JMX based DBA API
registerManager.register(ClusterMonitor.INSTANCE);
+ // as JMX based API is enabled here, we also enabled the thrift-based cluster info API here.
+
}
/** Also stops the IoTDB instance, the MetaGroupMember and the ClusterMonitor. */
diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/utils/nodetool/ClusterMonitor.java b/cluster/src/main/java/org/apache/iotdb/cluster/utils/nodetool/ClusterMonitor.java
index e72a33a..4dbbb5e 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/utils/nodetool/ClusterMonitor.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/utils/nodetool/ClusterMonitor.java
@@ -18,6 +18,7 @@
*/
package org.apache.iotdb.cluster.utils.nodetool;
+import org.apache.commons.collections4.map.MultiKeyMap;
import org.apache.iotdb.cluster.ClusterMain;
import org.apache.iotdb.cluster.partition.PartitionGroup;
import org.apache.iotdb.cluster.partition.PartitionTable;
@@ -33,8 +34,6 @@ import org.apache.iotdb.db.metadata.PartialPath;
import org.apache.iotdb.db.service.IService;
import org.apache.iotdb.db.service.JMXService;
import org.apache.iotdb.db.service.ServiceType;
-
-import org.apache.commons.collections4.map.MultiKeyMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -52,6 +51,8 @@ public class ClusterMonitor implements ClusterMonitorMBean, IService {
String.format(
"%s:%s=%s", IoTDBConstant.IOTDB_PACKAGE, IoTDBConstant.JMX_TYPE, getID().getJmxName());
+ private ClusterMonitor() {}
+
@Override
public void start() throws StartupException {
try {
diff --git a/thrift-cluster/src/main/thrift/cluster.thrift b/thrift-cluster/src/main/thrift/cluster.thrift
index 775786b..e3985c6 100644
--- a/thrift-cluster/src/main/thrift/cluster.thrift
+++ b/thrift-cluster/src/main/thrift/cluster.thrift
@@ -368,7 +368,7 @@ service TSDataService extends RaftService {
* @return a map containing key-value,the serialized time-value pairs or an empty buffer if there
* are not more results.
**/
- map<string,binary> fetchMultSeries(1:Node header, 2:long readerId, list<string> paths)
+ map<string,binary> fetchMultSeries(1:Node header, 2:long readerId, 3:list<string> paths)
/**
* Query a time series and generate an IReaderByTimestamp.
@@ -508,26 +508,26 @@ service TSMetaService extends RaftService {
* cannot know when another node resumes, and handshakes are mainly used to update node status
* on coordinator side.
**/
- void handshake(Node sender);
+ void handshake(1:Node sender);
}
/**
* for cluster maintainer.
* The interface will replace the JMX based NodeTool APIs.
**/
-service DBA {
+service ClusterInfoService {
/**
* Get physical hash ring
*/
- List<Node> getRing();
+ list<Node> getRing();
/**
* Get data partition information of input path and time range.
* @param path input path
* @return data partition information
*/
- map<long, list<Node>> getDataPartition(String path, long startTime, long endTime);
+ map<long, list<Node>> getDataPartition(1:string path, 2:long startTime, 3:long endTime);
/**
* Get metadata partition information of input path
@@ -535,35 +535,20 @@ service DBA {
* @param path input path
* @return metadata partition information
*/
- list<Node> getMetaPartition(String path);
-
- /**
- * Get data partition groups that input node belongs to and the slot number in each partition
- * group.
- *
- * @return key: the partition group, value: the slot number
- */
- Map<list<Node>, int> getSlotNumOfCurNode();
-
- /**
- * Get all data partition groups and the slot number in each partition group.
- *
- * @return key: the partition group, value: the slot number
- */
- Map<list<Node>, int> getSlotNumOfAllNode();
+ list<Node> getMetaPartition(1:string path);
/**
* Get status of all nodes
*
* @return key: node, value: live or not
*/
- Map<Node, bool> getAllNodeStatus();
+ map<Node, bool> getAllNodeStatus();
/**
* @return A multi-line string with each line representing the total time consumption, invocation
* number, and average time consumption.
*/
- String getInstrumentingInfo();
+ string getInstrumentingInfo();
/** Reset all instrumenting statistics in Timer. */
void resetInstrumenting();