This is an automated email from the ASF dual-hosted git repository.
lta pushed a commit to branch cluster
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
The following commit(s) were added to refs/heads/cluster by this push:
new 6a567e4 complete set file level function and test pass
6a567e4 is described below
commit 6a567e47c032cdaa7e4e87ddf1d407997572aed7
Author: lta <[email protected]>
AuthorDate: Thu Mar 28 14:51:38 2019 +0800
complete set file level function and test pass
---
.../cluster/qp/executor/NonQueryExecutor.java | 14 ++++++++--
.../cluster/rpc/service/TSServiceClusterImpl.java | 31 +++++++++-------------
.../org/apache/iotdb/db/service/TSServiceImpl.java | 13 +++++++++
3 files changed, 38 insertions(+), 20 deletions(-)
diff --git
a/cluster/src/main/java/org/apache/iotdb/cluster/qp/executor/NonQueryExecutor.java
b/cluster/src/main/java/org/apache/iotdb/cluster/qp/executor/NonQueryExecutor.java
index f8aa192..25d83d4 100644
---
a/cluster/src/main/java/org/apache/iotdb/cluster/qp/executor/NonQueryExecutor.java
+++
b/cluster/src/main/java/org/apache/iotdb/cluster/qp/executor/NonQueryExecutor.java
@@ -19,6 +19,7 @@
package org.apache.iotdb.cluster.qp.executor;
import com.alipay.sofa.jraft.entity.PeerId;
+import com.alipay.sofa.jraft.option.CliOptions;
import com.alipay.sofa.jraft.rpc.impl.cli.BoltCliClientService;
import java.io.IOException;
import org.apache.iotdb.cluster.callback.SingleTask;
@@ -71,8 +72,13 @@ public class NonQueryExecutor extends ClusterQPExecutor {
*/
private static final int SUB_TASK_NUM = 1;
- public NonQueryExecutor(BoltCliClientService cliClientService) {
- this.cliClientService = cliClientService;
+ public NonQueryExecutor() {
+
+ }
+
+ public void init(){
+ this.cliClientService = new BoltCliClientService();
+ this.cliClientService.init(new CliOptions());
}
public boolean processNonQuery(PhysicalPlan plan) throws ProcessorException {
@@ -236,4 +242,8 @@ public class NonQueryExecutor extends ClusterQPExecutor {
return task.getResponse().isSuccess();
}
+ public void shutdown(){
+ cliClientService.shutdown();
+ }
+
}
diff --git
a/cluster/src/main/java/org/apache/iotdb/cluster/rpc/service/TSServiceClusterImpl.java
b/cluster/src/main/java/org/apache/iotdb/cluster/rpc/service/TSServiceClusterImpl.java
index 1c97a09..da418d1 100644
---
a/cluster/src/main/java/org/apache/iotdb/cluster/rpc/service/TSServiceClusterImpl.java
+++
b/cluster/src/main/java/org/apache/iotdb/cluster/rpc/service/TSServiceClusterImpl.java
@@ -37,21 +37,16 @@ public class TSServiceClusterImpl extends TSServiceImpl {
private static final Logger LOGGER =
LoggerFactory.getLogger(TSServiceClusterImpl.class);
- /**
- *
- */
- private BoltCliClientService cliClientService = new BoltCliClientService();
- /**
- *
- */
- private NonQueryExecutor nonQueryExecutor = new
NonQueryExecutor(cliClientService);
-
- private ThreadLocal<String> username = new ThreadLocal<>();
- private ThreadLocal<ZoneId> zoneIds = new ThreadLocal<>();
+ private ThreadLocal<NonQueryExecutor> nonQueryExecutor = new ThreadLocal<>();
public TSServiceClusterImpl() throws IOException {
super();
- cliClientService.init(new CliOptions());
+ }
+
+ @Override
+ public void initClusterService(){
+ nonQueryExecutor.set(new NonQueryExecutor());
+ nonQueryExecutor.get().init();
}
// //TODO
@@ -89,13 +84,13 @@ public class TSServiceClusterImpl extends TSServiceImpl {
@Override
public boolean executeNonQuery(PhysicalPlan plan) throws ProcessorException {
- return nonQueryExecutor.processNonQuery(plan);
+ return nonQueryExecutor.get().processNonQuery(plan);
}
- //TODO
- public void handleClientExit() throws TException {
- cliClientService.shutdown();
- closeOperation(null);
- closeSession(null);
+ /**
+ * Close cluster service
+ */
+ public void closeClusterService() {
+ nonQueryExecutor.get().shutdown();
}
}
diff --git a/iotdb/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
b/iotdb/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
index 541b1e2..4af6121 100644
--- a/iotdb/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
+++ b/iotdb/src/main/java/org/apache/iotdb/db/service/TSServiceImpl.java
@@ -114,6 +114,7 @@ public class TSServiceImpl implements TSIService.Iface,
ServerContext {
LOGGER.info("{}: receive open session request from username {}",
IoTDBConstant.GLOBAL_DB_NAME,
req.getUsername());
+ initClusterService();
boolean status;
IAuthorizer authorizer = null;
try {
@@ -155,6 +156,10 @@ public class TSServiceImpl implements TSIService.Iface,
ServerContext {
queryRet.set(new HashMap<>());
}
+ public void initClusterService(){
+
+ }
+
@Override
public TSCloseSessionResp closeSession(TSCloseSessionReq req) throws
TException {
LOGGER.info("{}: receive close session", IoTDBConstant.GLOBAL_DB_NAME);
@@ -744,10 +749,18 @@ public class TSServiceImpl implements TSIService.Iface,
ServerContext {
}
public void handleClientExit() throws TException {
+ closeClusterService();
closeOperation(null);
closeSession(null);
}
+ /**
+ * Close cluster service
+ */
+ public void closeClusterService(){
+
+ }
+
@Override
public TSGetTimeZoneResp getTimeZone() throws TException {
TS_Status tsStatus = null;