This is an automated email from the ASF dual-hosted git repository.
qiaojialin pushed a commit to branch rel/1.0
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rel/1.0 by this push:
new 85470ec1f5 [To rel/1.0][IOTDB-5127]Separate ISession and ISessionPool
as a module (#8560)
85470ec1f5 is described below
commit 85470ec1f5e345ed158e580f5ceaf9b3d03c72a4
Author: Zhijia Cao <[email protected]>
AuthorDate: Wed Dec 21 21:10:54 2022 +0800
[To rel/1.0][IOTDB-5127]Separate ISession and ISessionPool as a module
(#8560)
---
isession/pom.xml | 37 +++
.../java/org/apache/iotdb/session/ISession.java | 9 +-
.../org/apache/iotdb/session/SessionConfig.java | 0
.../org/apache/iotdb/session/SessionDataSet.java | 0
.../apache/iotdb/session/pool/ISessionPool.java | 351 ++++++++++-----------
.../iotdb/session/pool/SessionDataSetWrapper.java | 13 +-
.../apache/iotdb/session/template/Template.java | 0
.../iotdb/session/template/TemplateNode.java | 0
.../org/apache/iotdb/session/util/Version.java | 0
pom.xml | 1 +
session/pom.xml | 6 +
.../java/org/apache/iotdb/session/Session.java | 3 +-
.../org/apache/iotdb/session/pool/SessionPool.java | 295 +++++++++++------
13 files changed, 428 insertions(+), 287 deletions(-)
diff --git a/isession/pom.xml b/isession/pom.xml
new file mode 100644
index 0000000000..35b200bc30
--- /dev/null
+++ b/isession/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ 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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>iotdb-parent</artifactId>
+ <groupId>org.apache.iotdb</groupId>
+ <version>1.0.1-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>isession</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.iotdb</groupId>
+ <artifactId>service-rpc</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/session/src/main/java/org/apache/iotdb/session/ISession.java
b/isession/src/main/java/org/apache/iotdb/session/ISession.java
similarity index 98%
copy from session/src/main/java/org/apache/iotdb/session/ISession.java
copy to isession/src/main/java/org/apache/iotdb/session/ISession.java
index dc9ba47934..8666797a36 100644
--- a/session/src/main/java/org/apache/iotdb/session/ISession.java
+++ b/isession/src/main/java/org/apache/iotdb/session/ISession.java
@@ -18,7 +18,6 @@
*/
package org.apache.iotdb.session;
-import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.rpc.IoTDBConnectionException;
import org.apache.iotdb.rpc.StatementExecutionException;
import org.apache.iotdb.service.rpc.thrift.TSBackupConfigurationResp;
@@ -33,7 +32,6 @@ import org.apache.iotdb.tsfile.write.record.Tablet;
import org.apache.thrift.TException;
import java.io.IOException;
-import java.time.ZoneId;
import java.util.List;
import java.util.Map;
@@ -56,9 +54,6 @@ public interface ISession extends AutoCloseable {
void close() throws IoTDBConnectionException;
- SessionConnection constructSessionConnection(Session session, TEndPoint
endpoint, ZoneId zoneId)
- throws IoTDBConnectionException;
-
String getTimeZone();
void setTimeZone(String zoneId) throws StatementExecutionException,
IoTDBConnectionException;
@@ -463,4 +458,8 @@ public interface ISession extends AutoCloseable {
throws IoTDBConnectionException, StatementExecutionException;
TSConnectionInfoResp fetchAllConnections() throws IoTDBConnectionException;
+
+ void setQueryTimeout(long timeoutInMs);
+
+ long getQueryTimeout();
}
diff --git a/session/src/main/java/org/apache/iotdb/session/SessionConfig.java
b/isession/src/main/java/org/apache/iotdb/session/SessionConfig.java
similarity index 100%
rename from session/src/main/java/org/apache/iotdb/session/SessionConfig.java
rename to isession/src/main/java/org/apache/iotdb/session/SessionConfig.java
diff --git a/session/src/main/java/org/apache/iotdb/session/SessionDataSet.java
b/isession/src/main/java/org/apache/iotdb/session/SessionDataSet.java
similarity index 100%
rename from session/src/main/java/org/apache/iotdb/session/SessionDataSet.java
rename to isession/src/main/java/org/apache/iotdb/session/SessionDataSet.java
diff --git a/session/src/main/java/org/apache/iotdb/session/ISession.java
b/isession/src/main/java/org/apache/iotdb/session/pool/ISessionPool.java
similarity index 83%
rename from session/src/main/java/org/apache/iotdb/session/ISession.java
rename to isession/src/main/java/org/apache/iotdb/session/pool/ISessionPool.java
index dc9ba47934..d6c299cb2a 100644
--- a/session/src/main/java/org/apache/iotdb/session/ISession.java
+++ b/isession/src/main/java/org/apache/iotdb/session/pool/ISessionPool.java
@@ -16,9 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.iotdb.session;
+package org.apache.iotdb.session.pool;
-import org.apache.iotdb.common.rpc.thrift.TEndPoint;
import org.apache.iotdb.rpc.IoTDBConnectionException;
import org.apache.iotdb.rpc.StatementExecutionException;
import org.apache.iotdb.service.rpc.thrift.TSBackupConfigurationResp;
@@ -30,205 +29,82 @@ import
org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
import org.apache.iotdb.tsfile.file.metadata.enums.TSEncoding;
import org.apache.iotdb.tsfile.write.record.Tablet;
-import org.apache.thrift.TException;
-
import java.io.IOException;
import java.time.ZoneId;
import java.util.List;
import java.util.Map;
-public interface ISession extends AutoCloseable {
-
- Version getVersion();
-
- void setVersion(Version version);
-
- int getFetchSize();
-
- void setFetchSize(int fetchSize);
-
- void open() throws IoTDBConnectionException;
-
- void open(boolean enableRPCCompression) throws IoTDBConnectionException;
-
- void open(boolean enableRPCCompression, int connectionTimeoutInMs)
- throws IoTDBConnectionException;
-
- void close() throws IoTDBConnectionException;
-
- SessionConnection constructSessionConnection(Session session, TEndPoint
endpoint, ZoneId zoneId)
- throws IoTDBConnectionException;
-
- String getTimeZone();
-
- void setTimeZone(String zoneId) throws StatementExecutionException,
IoTDBConnectionException;
-
- void setTimeZoneOfSession(String zoneId);
-
- /** @deprecated Use {@link #createDatabase(String)} instead. */
- @Deprecated
- void setStorageGroup(String storageGroup)
- throws IoTDBConnectionException, StatementExecutionException;
-
- /** @deprecated Use {@link #deleteDatabase(String)} instead. */
- @Deprecated
- void deleteStorageGroup(String storageGroup)
- throws IoTDBConnectionException, StatementExecutionException;
-
- /** @deprecated Use {@link #deleteDatabases(List)} instead. */
- @Deprecated
- void deleteStorageGroups(List<String> storageGroups)
- throws IoTDBConnectionException, StatementExecutionException;
-
- void createDatabase(String database) throws IoTDBConnectionException,
StatementExecutionException;
-
- void deleteDatabase(String database) throws IoTDBConnectionException,
StatementExecutionException;
-
- void deleteDatabases(List<String> databases)
- throws IoTDBConnectionException, StatementExecutionException;
+public interface ISessionPool {
- void createTimeseries(
- String path, TSDataType dataType, TSEncoding encoding, CompressionType
compressor)
- throws IoTDBConnectionException, StatementExecutionException;
+ int currentAvailableSize();
- void createTimeseries(
- String path,
- TSDataType dataType,
- TSEncoding encoding,
- CompressionType compressor,
- Map<String, String> props,
- Map<String, String> tags,
- Map<String, String> attributes,
- String measurementAlias)
- throws IoTDBConnectionException, StatementExecutionException;
+ int currentOccupiedSize();
- void createAlignedTimeseries(
- String deviceId,
- List<String> measurements,
- List<TSDataType> dataTypes,
- List<TSEncoding> encodings,
- List<CompressionType> compressors,
- List<String> measurementAliasList)
- throws IoTDBConnectionException, StatementExecutionException;
+ void close();
- void createAlignedTimeseries(
- String deviceId,
- List<String> measurements,
- List<TSDataType> dataTypes,
- List<TSEncoding> encodings,
- List<CompressionType> compressors,
- List<String> measurementAliasList,
- List<Map<String, String>> tagsList,
- List<Map<String, String>> attributesList)
- throws IoTDBConnectionException, StatementExecutionException;
+ void closeResultSet(SessionDataSetWrapper wrapper);
- void createMultiTimeseries(
- List<String> paths,
- List<TSDataType> dataTypes,
- List<TSEncoding> encodings,
- List<CompressionType> compressors,
- List<Map<String, String>> propsList,
- List<Map<String, String>> tagsList,
- List<Map<String, String>> attributesList,
- List<String> measurementAliasList)
- throws IoTDBConnectionException, StatementExecutionException;
+ void insertTablet(Tablet tablet) throws IoTDBConnectionException,
StatementExecutionException;
- boolean checkTimeseriesExists(String path)
+ void insertTablet(Tablet tablet, boolean sorted)
throws IoTDBConnectionException, StatementExecutionException;
- SessionDataSet executeQueryStatement(String sql)
- throws StatementExecutionException, IoTDBConnectionException;
-
- SessionDataSet executeQueryStatement(String sql, long timeoutInMs)
- throws StatementExecutionException, IoTDBConnectionException;
-
- void executeNonQueryStatement(String sql)
+ void insertAlignedTablet(Tablet tablet)
throws IoTDBConnectionException, StatementExecutionException;
- SessionDataSet executeRawDataQuery(List<String> paths, long startTime, long
endTime, long timeOut)
- throws StatementExecutionException, IoTDBConnectionException;
-
- SessionDataSet executeRawDataQuery(List<String> paths, long startTime, long
endTime)
- throws StatementExecutionException, IoTDBConnectionException;
-
- SessionDataSet executeLastDataQuery(List<String> paths, long lastTime)
- throws StatementExecutionException, IoTDBConnectionException;
-
- SessionDataSet executeLastDataQuery(List<String> paths, long lastTime, long
timeOut)
- throws StatementExecutionException, IoTDBConnectionException;
-
- SessionDataSet executeLastDataQuery(List<String> paths)
- throws StatementExecutionException, IoTDBConnectionException;
-
- void insertRecord(
- String deviceId,
- long time,
- List<String> measurements,
- List<TSDataType> types,
- Object... values)
+ void insertAlignedTablet(Tablet tablet, boolean sorted)
throws IoTDBConnectionException, StatementExecutionException;
- void insertRecord(
- String deviceId,
- long time,
- List<String> measurements,
- List<TSDataType> types,
- List<Object> values)
+ void insertTablets(Map<String, Tablet> tablets)
throws IoTDBConnectionException, StatementExecutionException;
- void insertAlignedRecord(
- String deviceId,
- long time,
- List<String> measurements,
- List<TSDataType> types,
- List<Object> values)
+ void insertAlignedTablets(Map<String, Tablet> tablets)
throws IoTDBConnectionException, StatementExecutionException;
- void insertRecord(String deviceId, long time, List<String> measurements,
List<String> values)
+ void insertTablets(Map<String, Tablet> tablets, boolean sorted)
throws IoTDBConnectionException, StatementExecutionException;
- String getTimestampPrecision() throws TException;
-
- void insertAlignedRecord(
- String deviceId, long time, List<String> measurements, List<String>
values)
+ void insertAlignedTablets(Map<String, Tablet> tablets, boolean sorted)
throws IoTDBConnectionException, StatementExecutionException;
void insertRecords(
List<String> deviceIds,
List<Long> times,
List<List<String>> measurementsList,
- List<List<String>> valuesList)
+ List<List<TSDataType>> typesList,
+ List<List<Object>> valuesList)
throws IoTDBConnectionException, StatementExecutionException;
void insertAlignedRecords(
- List<String> deviceIds,
+ List<String> multiSeriesIds,
List<Long> times,
- List<List<String>> measurementsList,
- List<List<String>> valuesList)
+ List<List<String>> multiMeasurementComponentsList,
+ List<List<TSDataType>> typesList,
+ List<List<Object>> valuesList)
throws IoTDBConnectionException, StatementExecutionException;
- void insertRecords(
- List<String> deviceIds,
+ void insertRecordsOfOneDevice(
+ String deviceId,
List<Long> times,
List<List<String>> measurementsList,
List<List<TSDataType>> typesList,
List<List<Object>> valuesList)
throws IoTDBConnectionException, StatementExecutionException;
- void insertAlignedRecords(
- List<String> deviceIds,
+ @Deprecated
+ void insertOneDeviceRecords(
+ String deviceId,
List<Long> times,
List<List<String>> measurementsList,
List<List<TSDataType>> typesList,
List<List<Object>> valuesList)
throws IoTDBConnectionException, StatementExecutionException;
- void insertRecordsOfOneDevice(
+ void insertStringRecordsOfOneDevice(
String deviceId,
List<Long> times,
List<List<String>> measurementsList,
- List<List<TSDataType>> typesList,
- List<List<Object>> valuesList)
+ List<List<String>> valuesList)
throws IoTDBConnectionException, StatementExecutionException;
void insertRecordsOfOneDevice(
@@ -240,11 +116,13 @@ public interface ISession extends AutoCloseable {
boolean haveSorted)
throws IoTDBConnectionException, StatementExecutionException;
- void insertStringRecordsOfOneDevice(
+ @Deprecated
+ void insertOneDeviceRecords(
String deviceId,
List<Long> times,
List<List<String>> measurementsList,
- List<List<String>> valuesList,
+ List<List<TSDataType>> typesList,
+ List<List<Object>> valuesList,
boolean haveSorted)
throws IoTDBConnectionException, StatementExecutionException;
@@ -252,7 +130,8 @@ public interface ISession extends AutoCloseable {
String deviceId,
List<Long> times,
List<List<String>> measurementsList,
- List<List<String>> valuesList)
+ List<List<String>> valuesList,
+ boolean haveSorted)
throws IoTDBConnectionException, StatementExecutionException;
void insertAlignedRecordsOfOneDevice(
@@ -263,6 +142,13 @@ public interface ISession extends AutoCloseable {
List<List<Object>> valuesList)
throws IoTDBConnectionException, StatementExecutionException;
+ void insertAlignedStringRecordsOfOneDevice(
+ String deviceId,
+ List<Long> times,
+ List<List<String>> measurementsList,
+ List<List<String>> valuesList)
+ throws IoTDBConnectionException, StatementExecutionException;
+
void insertAlignedRecordsOfOneDevice(
String deviceId,
List<Long> times,
@@ -280,34 +166,41 @@ public interface ISession extends AutoCloseable {
boolean haveSorted)
throws IoTDBConnectionException, StatementExecutionException;
- void insertAlignedStringRecordsOfOneDevice(
- String deviceId,
+ void insertRecords(
+ List<String> deviceIds,
List<Long> times,
List<List<String>> measurementsList,
List<List<String>> valuesList)
throws IoTDBConnectionException, StatementExecutionException;
- void insertTablet(Tablet tablet) throws StatementExecutionException,
IoTDBConnectionException;
-
- void insertTablet(Tablet tablet, boolean sorted)
- throws IoTDBConnectionException, StatementExecutionException;
-
- void insertAlignedTablet(Tablet tablet)
- throws StatementExecutionException, IoTDBConnectionException;
-
- void insertAlignedTablet(Tablet tablet, boolean sorted)
+ void insertAlignedRecords(
+ List<String> multiSeriesIds,
+ List<Long> times,
+ List<List<String>> multiMeasurementComponentsList,
+ List<List<String>> valuesList)
throws IoTDBConnectionException, StatementExecutionException;
- void insertTablets(Map<String, Tablet> tablets)
+ void insertRecord(
+ String deviceId,
+ long time,
+ List<String> measurements,
+ List<TSDataType> types,
+ List<Object> values)
throws IoTDBConnectionException, StatementExecutionException;
- void insertTablets(Map<String, Tablet> tablets, boolean sorted)
+ void insertAlignedRecord(
+ String multiSeriesId,
+ long time,
+ List<String> multiMeasurementComponents,
+ List<TSDataType> types,
+ List<Object> values)
throws IoTDBConnectionException, StatementExecutionException;
- void insertAlignedTablets(Map<String, Tablet> tablets)
+ void insertRecord(String deviceId, long time, List<String> measurements,
List<String> values)
throws IoTDBConnectionException, StatementExecutionException;
- void insertAlignedTablets(Map<String, Tablet> tablets, boolean sorted)
+ void insertAlignedRecord(
+ String multiSeriesId, long time, List<String>
multiMeasurementComponents, List<String> values)
throws IoTDBConnectionException, StatementExecutionException;
void testInsertTablet(Tablet tablet) throws IoTDBConnectionException,
StatementExecutionException;
@@ -352,16 +245,61 @@ public interface ISession extends AutoCloseable {
void deleteTimeseries(List<String> paths)
throws IoTDBConnectionException, StatementExecutionException;
- void deleteData(String path, long endTime)
+ void deleteData(String path, long time)
throws IoTDBConnectionException, StatementExecutionException;
- void deleteData(List<String> paths, long endTime)
+ void deleteData(List<String> paths, long time)
throws IoTDBConnectionException, StatementExecutionException;
void deleteData(List<String> paths, long startTime, long endTime)
throws IoTDBConnectionException, StatementExecutionException;
- void setSchemaTemplate(String templateName, String prefixPath)
+ @Deprecated
+ void setStorageGroup(String storageGroupId)
+ throws IoTDBConnectionException, StatementExecutionException;
+
+ @Deprecated
+ void deleteStorageGroup(String storageGroup)
+ throws IoTDBConnectionException, StatementExecutionException;
+
+ @Deprecated
+ void deleteStorageGroups(List<String> storageGroup)
+ throws IoTDBConnectionException, StatementExecutionException;
+
+ void createDatabase(String database) throws IoTDBConnectionException,
StatementExecutionException;
+
+ void deleteDatabase(String database) throws IoTDBConnectionException,
StatementExecutionException;
+
+ void deleteDatabases(List<String> databases)
+ throws IoTDBConnectionException, StatementExecutionException;
+
+ void createTimeseries(
+ String path, TSDataType dataType, TSEncoding encoding, CompressionType
compressor)
+ throws IoTDBConnectionException, StatementExecutionException;
+
+ void createTimeseries(
+ String path,
+ TSDataType dataType,
+ TSEncoding encoding,
+ CompressionType compressor,
+ Map<String, String> props,
+ Map<String, String> tags,
+ Map<String, String> attributes,
+ String measurementAlias)
+ throws IoTDBConnectionException, StatementExecutionException;
+
+ void createMultiTimeseries(
+ List<String> paths,
+ List<TSDataType> dataTypes,
+ List<TSEncoding> encodings,
+ List<CompressionType> compressors,
+ List<Map<String, String>> propsList,
+ List<Map<String, String>> tagsList,
+ List<Map<String, String>> attributesList,
+ List<String> measurementAliasList)
+ throws IoTDBConnectionException, StatementExecutionException;
+
+ boolean checkTimeseriesExists(String path)
throws IoTDBConnectionException, StatementExecutionException;
void createSchemaTemplate(Template template)
@@ -376,6 +314,7 @@ public interface ISession extends AutoCloseable {
boolean isAligned)
throws IOException, IoTDBConnectionException,
StatementExecutionException;
+ @Deprecated
void createSchemaTemplate(
String name,
List<String> schemaNames,
@@ -443,24 +382,82 @@ public interface ISession extends AutoCloseable {
List<String> showPathsTemplateUsingOn(String templateName)
throws StatementExecutionException, IoTDBConnectionException;
+ void setSchemaTemplate(String templateName, String prefixPath)
+ throws StatementExecutionException, IoTDBConnectionException;
+
void unsetSchemaTemplate(String prefixPath, String templateName)
- throws IoTDBConnectionException, StatementExecutionException;
+ throws StatementExecutionException, IoTDBConnectionException;
void dropSchemaTemplate(String templateName)
+ throws StatementExecutionException, IoTDBConnectionException;
+
+ SessionDataSetWrapper executeQueryStatement(String sql)
throws IoTDBConnectionException, StatementExecutionException;
- boolean isEnableQueryRedirection();
+ SessionDataSetWrapper executeQueryStatement(String sql, long timeoutInMs)
+ throws IoTDBConnectionException, StatementExecutionException;
- void setEnableQueryRedirection(boolean enableQueryRedirection);
+ /**
+ * execute non query statement
+ *
+ * @param sql non query statement
+ */
+ void executeNonQueryStatement(String sql)
+ throws StatementExecutionException, IoTDBConnectionException;
- boolean isEnableRedirection();
+ @SuppressWarnings("squid:S2095") // Suppress wrapper not closed warning
+ SessionDataSetWrapper executeRawDataQuery(
+ List<String> paths, long startTime, long endTime, long timeOut)
+ throws IoTDBConnectionException, StatementExecutionException;
+
+ SessionDataSetWrapper executeLastDataQuery(List<String> paths, long
LastTime, long timeOut)
+ throws StatementExecutionException, IoTDBConnectionException;
+
+ SessionDataSetWrapper executeLastDataQuery(List<String> paths)
+ throws StatementExecutionException, IoTDBConnectionException;
+
+ int getMaxSize();
+
+ String getHost();
+
+ int getPort();
+
+ String getUser();
+
+ String getPassword();
+
+ void setFetchSize(int fetchSize);
+
+ int getFetchSize();
+
+ void setTimeZone(String zoneId) throws StatementExecutionException,
IoTDBConnectionException;
+
+ ZoneId getZoneId();
+
+ long getWaitToGetSessionTimeoutInMs();
+
+ boolean isEnableCompression();
void setEnableRedirection(boolean enableRedirection);
- void sortTablet(Tablet tablet);
+ boolean isEnableRedirection();
+
+ void setEnableQueryRedirection(boolean enableQueryRedirection);
+
+ boolean isEnableQueryRedirection();
+
+ int getConnectionTimeoutInMs();
TSBackupConfigurationResp getBackupConfiguration()
throws IoTDBConnectionException, StatementExecutionException;
TSConnectionInfoResp fetchAllConnections() throws IoTDBConnectionException;
+
+ void setVersion(Version version);
+
+ Version getVersion();
+
+ void setQueryTimeout(long timeoutInMs);
+
+ long getQueryTimeout();
}
diff --git
a/session/src/main/java/org/apache/iotdb/session/pool/SessionDataSetWrapper.java
b/isession/src/main/java/org/apache/iotdb/session/pool/SessionDataSetWrapper.java
similarity index 89%
rename from
session/src/main/java/org/apache/iotdb/session/pool/SessionDataSetWrapper.java
rename to
isession/src/main/java/org/apache/iotdb/session/pool/SessionDataSetWrapper.java
index e2e3b2c4d5..840150040d 100644
---
a/session/src/main/java/org/apache/iotdb/session/pool/SessionDataSetWrapper.java
+++
b/isession/src/main/java/org/apache/iotdb/session/pool/SessionDataSetWrapper.java
@@ -20,9 +20,8 @@ package org.apache.iotdb.session.pool;
import org.apache.iotdb.rpc.IoTDBConnectionException;
import org.apache.iotdb.rpc.StatementExecutionException;
-import org.apache.iotdb.session.Session;
+import org.apache.iotdb.session.ISession;
import org.apache.iotdb.session.SessionDataSet;
-import org.apache.iotdb.session.SessionDataSet.DataIterator;
import org.apache.iotdb.tsfile.read.common.RowRecord;
import java.util.List;
@@ -30,16 +29,16 @@ import java.util.List;
public class SessionDataSetWrapper implements AutoCloseable {
SessionDataSet sessionDataSet;
- Session session;
- SessionPool pool;
+ ISession session;
+ ISessionPool pool;
- public SessionDataSetWrapper(SessionDataSet sessionDataSet, Session session,
SessionPool pool) {
+ public SessionDataSetWrapper(SessionDataSet sessionDataSet, ISession
session, ISessionPool pool) {
this.sessionDataSet = sessionDataSet;
this.session = session;
this.pool = pool;
}
- protected Session getSession() {
+ protected ISession getSession() {
return session;
}
@@ -79,7 +78,7 @@ public class SessionDataSetWrapper implements AutoCloseable {
}
/** retrieve data set like jdbc */
- public DataIterator iterator() {
+ public SessionDataSet.DataIterator iterator() {
return sessionDataSet.iterator();
}
diff --git
a/session/src/main/java/org/apache/iotdb/session/template/Template.java
b/isession/src/main/java/org/apache/iotdb/session/template/Template.java
similarity index 100%
rename from
session/src/main/java/org/apache/iotdb/session/template/Template.java
rename to isession/src/main/java/org/apache/iotdb/session/template/Template.java
diff --git
a/session/src/main/java/org/apache/iotdb/session/template/TemplateNode.java
b/isession/src/main/java/org/apache/iotdb/session/template/TemplateNode.java
similarity index 100%
rename from
session/src/main/java/org/apache/iotdb/session/template/TemplateNode.java
rename to
isession/src/main/java/org/apache/iotdb/session/template/TemplateNode.java
diff --git a/session/src/main/java/org/apache/iotdb/session/util/Version.java
b/isession/src/main/java/org/apache/iotdb/session/util/Version.java
similarity index 100%
rename from session/src/main/java/org/apache/iotdb/session/util/Version.java
rename to isession/src/main/java/org/apache/iotdb/session/util/Version.java
diff --git a/pom.xml b/pom.xml
index 528a43fc59..d7d8c18126 100644
--- a/pom.xml
+++ b/pom.xml
@@ -122,6 +122,7 @@
<module>rewrite-tsfile-tool</module>
<module>external-api</module>
<module>schema-engine-tag</module>
+ <module>isession</module>
</modules>
<!-- Properties Management -->
<properties>
diff --git a/session/pom.xml b/session/pom.xml
index 8937a22911..7097aba703 100644
--- a/session/pom.xml
+++ b/session/pom.xml
@@ -81,6 +81,12 @@
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.apache.iotdb</groupId>
+ <artifactId>isession</artifactId>
+ <version>${project.version}</version>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
<profiles>
<profile>
diff --git a/session/src/main/java/org/apache/iotdb/session/Session.java
b/session/src/main/java/org/apache/iotdb/session/Session.java
index 1403772098..ebecbfa62e 100644
--- a/session/src/main/java/org/apache/iotdb/session/Session.java
+++ b/session/src/main/java/org/apache/iotdb/session/Session.java
@@ -420,7 +420,6 @@ public class Session implements ISession {
}
}
- @Override
public SessionConnection constructSessionConnection(
Session session, TEndPoint endpoint, ZoneId zoneId) throws
IoTDBConnectionException {
if (endpoint == null) {
@@ -668,10 +667,12 @@ public class Session implements ISession {
return defaultSessionConnection.checkTimeseriesExists(path,
queryTimeoutInMs);
}
+ @Override
public void setQueryTimeout(long timeoutInMs) {
this.queryTimeoutInMs = timeoutInMs;
}
+ @Override
public long getQueryTimeout() {
return queryTimeoutInMs;
}
diff --git
a/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java
b/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java
index 7331779791..6f9754dd9e 100644
--- a/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java
+++ b/session/src/main/java/org/apache/iotdb/session/pool/SessionPool.java
@@ -22,6 +22,7 @@ import org.apache.iotdb.rpc.IoTDBConnectionException;
import org.apache.iotdb.rpc.StatementExecutionException;
import org.apache.iotdb.service.rpc.thrift.TSBackupConfigurationResp;
import org.apache.iotdb.service.rpc.thrift.TSConnectionInfoResp;
+import org.apache.iotdb.session.ISession;
import org.apache.iotdb.session.Session;
import org.apache.iotdb.session.SessionConfig;
import org.apache.iotdb.session.SessionDataSet;
@@ -64,7 +65,7 @@ import java.util.concurrent.ConcurrentMap;
* <p>Another case that you have to manually call closeResultSet() is that
when there is exception
* when you call SessionDataSetWrapper.hasNext() or next()
*/
-public class SessionPool {
+public class SessionPool implements ISessionPool {
private static final Logger logger =
LoggerFactory.getLogger(SessionPool.class);
public static final String SESSION_POOL_IS_CLOSED = "Session pool is closed";
@@ -73,9 +74,9 @@ public class SessionPool {
private static final int RETRY = 3;
private static final int FINAL_RETRY = RETRY - 1;
- private final ConcurrentLinkedDeque<Session> queue = new
ConcurrentLinkedDeque<>();
+ private final ConcurrentLinkedDeque<ISession> queue = new
ConcurrentLinkedDeque<>();
// for session whose resultSet is not released.
- private final ConcurrentMap<Session, Session> occupied = new
ConcurrentHashMap<>();
+ private final ConcurrentMap<ISession, ISession> occupied = new
ConcurrentHashMap<>();
private int size = 0;
private int maxSize = 0;
private final long waitToGetSessionTimeoutInMs;
@@ -372,8 +373,8 @@ public class SessionPool {
// if this method throws an exception, either the server is broken, or the
ip/port/user/password
// is incorrect.
@SuppressWarnings({"squid:S3776", "squid:S2446"}) // Suppress high Cognitive
Complexity warning
- private Session getSession() throws IoTDBConnectionException {
- Session session = queue.poll();
+ private ISession getSession() throws IoTDBConnectionException {
+ ISession session = queue.poll();
if (closed) {
throw new IoTDBConnectionException(SESSION_POOL_IS_CLOSED);
}
@@ -472,16 +473,18 @@ public class SessionPool {
return session;
}
+ @Override
public int currentAvailableSize() {
return queue.size();
}
+ @Override
public int currentOccupiedSize() {
return occupied.size();
}
@SuppressWarnings({"squid:S2446"})
- private void putBack(Session session) {
+ private void putBack(ISession session) {
queue.push(session);
synchronized (this) {
// we do not need to notifyAll as any waited thread can continue to work
after waked up.
@@ -494,13 +497,14 @@ public class SessionPool {
}
}
- private void occupy(Session session) {
+ private void occupy(ISession session) {
occupied.put(session, session);
}
/** close all connections in the pool */
+ @Override
public synchronized void close() {
- for (Session session : queue) {
+ for (ISession session : queue) {
try {
session.close();
} catch (IoTDBConnectionException e) {
@@ -508,7 +512,7 @@ public class SessionPool {
logger.warn(CLOSE_THE_SESSION_FAILED, e);
}
}
- for (Session session : occupied.keySet()) {
+ for (ISession session : occupied.keySet()) {
try {
session.close();
} catch (IoTDBConnectionException e) {
@@ -522,6 +526,7 @@ public class SessionPool {
occupied.clear();
}
+ @Override
public void closeResultSet(SessionDataSetWrapper wrapper) {
boolean putback = true;
try {
@@ -530,7 +535,7 @@ public class SessionPool {
tryConstructNewSession();
putback = false;
} finally {
- Session session = occupied.remove(wrapper.session);
+ ISession session = occupied.remove(wrapper.session);
if (putback && session != null) {
putBack(wrapper.session);
}
@@ -564,7 +569,7 @@ public class SessionPool {
}
}
- private void closeSession(Session session) {
+ private void closeSession(ISession session) {
if (session != null) {
try {
session.close();
@@ -576,7 +581,7 @@ public class SessionPool {
}
private void cleanSessionAndMayThrowConnectionException(
- Session session, int times, IoTDBConnectionException e) throws
IoTDBConnectionException {
+ ISession session, int times, IoTDBConnectionException e) throws
IoTDBConnectionException {
closeSession(session);
tryConstructNewSession();
if (times == FINAL_RETRY) {
@@ -593,6 +598,7 @@ public class SessionPool {
*
* @param tablet data batch
*/
+ @Override
public void insertTablet(Tablet tablet)
throws IoTDBConnectionException, StatementExecutionException {
/*
@@ -616,6 +622,7 @@ public class SessionPool {
* @param tablet a tablet data of one device
* @param sorted whether times in Tablet are in ascending order
*/
+ @Override
public void insertTablet(Tablet tablet, boolean sorted)
throws IoTDBConnectionException, StatementExecutionException {
/*
@@ -628,7 +635,7 @@ public class SessionPool {
*/
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertTablet(tablet, sorted);
putBack(session);
@@ -651,6 +658,7 @@ public class SessionPool {
*
* @param tablet a tablet data of one device
*/
+ @Override
public void insertAlignedTablet(Tablet tablet)
throws IoTDBConnectionException, StatementExecutionException {
insertAlignedTablet(tablet, false);
@@ -664,10 +672,11 @@ public class SessionPool {
* @param tablet a tablet data of one device
* @param sorted whether times in Tablet are in ascending order
*/
+ @Override
public void insertAlignedTablet(Tablet tablet, boolean sorted)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertAlignedTablet(tablet, sorted);
putBack(session);
@@ -688,6 +697,7 @@ public class SessionPool {
*
* @param tablets multiple batch
*/
+ @Override
public void insertTablets(Map<String, Tablet> tablets)
throws IoTDBConnectionException, StatementExecutionException {
insertTablets(tablets, false);
@@ -698,6 +708,7 @@ public class SessionPool {
*
* @param tablets multiple batch
*/
+ @Override
public void insertAlignedTablets(Map<String, Tablet> tablets)
throws IoTDBConnectionException, StatementExecutionException {
insertAlignedTablets(tablets, false);
@@ -708,10 +719,11 @@ public class SessionPool {
*
* @param tablets multiple batch
*/
+ @Override
public void insertTablets(Map<String, Tablet> tablets, boolean sorted)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertTablets(tablets, sorted);
putBack(session);
@@ -732,10 +744,11 @@ public class SessionPool {
*
* @param tablets multiple batch
*/
+ @Override
public void insertAlignedTablets(Map<String, Tablet> tablets, boolean sorted)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertAlignedTablets(tablets, sorted);
putBack(session);
@@ -758,6 +771,7 @@ public class SessionPool {
*
* @see Session#insertTablet(Tablet)
*/
+ @Override
public void insertRecords(
List<String> deviceIds,
List<Long> times,
@@ -766,7 +780,7 @@ public class SessionPool {
List<List<Object>> valuesList)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertRecords(deviceIds, times, measurementsList, typesList,
valuesList);
putBack(session);
@@ -789,6 +803,7 @@ public class SessionPool {
*
* @see Session#insertTablet(Tablet)
*/
+ @Override
public void insertAlignedRecords(
List<String> multiSeriesIds,
List<Long> times,
@@ -797,7 +812,7 @@ public class SessionPool {
List<List<Object>> valuesList)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertAlignedRecords(
multiSeriesIds, times, multiMeasurementComponentsList, typesList,
valuesList);
@@ -821,6 +836,7 @@ public class SessionPool {
*
* @see Session#insertTablet(Tablet)
*/
+ @Override
public void insertRecordsOfOneDevice(
String deviceId,
List<Long> times,
@@ -829,7 +845,7 @@ public class SessionPool {
List<List<Object>> valuesList)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertRecordsOfOneDevice(
deviceId, times, measurementsList, typesList, valuesList, false);
@@ -854,6 +870,7 @@ public class SessionPool {
* @see Session#insertTablet(Tablet)
*/
@Deprecated
+ @Override
public void insertOneDeviceRecords(
String deviceId,
List<Long> times,
@@ -862,7 +879,7 @@ public class SessionPool {
List<List<Object>> valuesList)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertRecordsOfOneDevice(
deviceId, times, measurementsList, typesList, valuesList, false);
@@ -887,6 +904,7 @@ public class SessionPool {
*
* @see Session#insertTablet(Tablet)
*/
+ @Override
public void insertStringRecordsOfOneDevice(
String deviceId,
List<Long> times,
@@ -894,7 +912,7 @@ public class SessionPool {
List<List<String>> valuesList)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertStringRecordsOfOneDevice(
deviceId, times, measurementsList, valuesList, false);
@@ -919,6 +937,7 @@ public class SessionPool {
* @param haveSorted whether the times list has been ordered.
* @see Session#insertTablet(Tablet)
*/
+ @Override
public void insertRecordsOfOneDevice(
String deviceId,
List<Long> times,
@@ -928,7 +947,7 @@ public class SessionPool {
boolean haveSorted)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertRecordsOfOneDevice(
deviceId, times, measurementsList, typesList, valuesList,
haveSorted);
@@ -953,6 +972,7 @@ public class SessionPool {
* @param haveSorted whether the times list has been ordered.
* @see Session#insertTablet(Tablet)
*/
+ @Override
@Deprecated
public void insertOneDeviceRecords(
String deviceId,
@@ -963,7 +983,7 @@ public class SessionPool {
boolean haveSorted)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertRecordsOfOneDevice(
deviceId, times, measurementsList, typesList, valuesList,
haveSorted);
@@ -989,6 +1009,7 @@ public class SessionPool {
* @param haveSorted whether the times list has been ordered.
* @see Session#insertTablet(Tablet)
*/
+ @Override
public void insertStringRecordsOfOneDevice(
String deviceId,
List<Long> times,
@@ -997,7 +1018,7 @@ public class SessionPool {
boolean haveSorted)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertStringRecordsOfOneDevice(
deviceId, times, measurementsList, valuesList, haveSorted);
@@ -1022,6 +1043,7 @@ public class SessionPool {
*
* @see Session#insertTablet(Tablet)
*/
+ @Override
public void insertAlignedRecordsOfOneDevice(
String deviceId,
List<Long> times,
@@ -1030,7 +1052,7 @@ public class SessionPool {
List<List<Object>> valuesList)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertAlignedRecordsOfOneDevice(
deviceId, times, measurementsList, typesList, valuesList, false);
@@ -1055,6 +1077,7 @@ public class SessionPool {
*
* @see Session#insertTablet(Tablet)
*/
+ @Override
public void insertAlignedStringRecordsOfOneDevice(
String deviceId,
List<Long> times,
@@ -1062,7 +1085,7 @@ public class SessionPool {
List<List<String>> valuesList)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertAlignedStringRecordsOfOneDevice(
deviceId, times, measurementsList, valuesList);
@@ -1088,6 +1111,7 @@ public class SessionPool {
* @param haveSorted whether the times list has been ordered.
* @see Session#insertTablet(Tablet)
*/
+ @Override
public void insertAlignedRecordsOfOneDevice(
String deviceId,
List<Long> times,
@@ -1097,7 +1121,7 @@ public class SessionPool {
boolean haveSorted)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertAlignedRecordsOfOneDevice(
deviceId, times, measurementsList, typesList, valuesList,
haveSorted);
@@ -1123,6 +1147,7 @@ public class SessionPool {
* @param haveSorted whether the times list has been ordered.
* @see Session#insertTablet(Tablet)
*/
+ @Override
public void insertAlignedStringRecordsOfOneDevice(
String deviceId,
List<Long> times,
@@ -1131,7 +1156,7 @@ public class SessionPool {
boolean haveSorted)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertAlignedStringRecordsOfOneDevice(
deviceId, times, measurementsList, valuesList, haveSorted);
@@ -1155,6 +1180,7 @@ public class SessionPool {
*
* @see Session#insertTablet(Tablet)
*/
+ @Override
public void insertRecords(
List<String> deviceIds,
List<Long> times,
@@ -1162,7 +1188,7 @@ public class SessionPool {
List<List<String>> valuesList)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertRecords(deviceIds, times, measurementsList, valuesList);
putBack(session);
@@ -1185,6 +1211,7 @@ public class SessionPool {
*
* @see Session#insertTablet(Tablet)
*/
+ @Override
public void insertAlignedRecords(
List<String> multiSeriesIds,
List<Long> times,
@@ -1192,7 +1219,7 @@ public class SessionPool {
List<List<String>> valuesList)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertAlignedRecords(
multiSeriesIds, times, multiMeasurementComponentsList, valuesList);
@@ -1216,6 +1243,7 @@ public class SessionPool {
* @see Session#insertRecords(List, List, List, List, List)
* @see Session#insertTablet(Tablet)
*/
+ @Override
public void insertRecord(
String deviceId,
long time,
@@ -1224,7 +1252,7 @@ public class SessionPool {
List<Object> values)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertRecord(deviceId, time, measurements, types, values);
putBack(session);
@@ -1247,6 +1275,7 @@ public class SessionPool {
* @see Session#insertAlignedRecords(List, List, List, List, List)
* @see Session#insertTablet(Tablet)
*/
+ @Override
public void insertAlignedRecord(
String multiSeriesId,
long time,
@@ -1255,7 +1284,7 @@ public class SessionPool {
List<Object> values)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertAlignedRecord(multiSeriesId, time,
multiMeasurementComponents, types, values);
putBack(session);
@@ -1278,11 +1307,12 @@ public class SessionPool {
* @see Session#insertRecords(List, List, List, List, List)
* @see Session#insertTablet(Tablet)
*/
+ @Override
public void insertRecord(
String deviceId, long time, List<String> measurements, List<String>
values)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertRecord(deviceId, time, measurements, values);
putBack(session);
@@ -1305,11 +1335,12 @@ public class SessionPool {
* @see Session#insertAlignedRecords(List, List, List, List, List)
* @see Session#insertTablet(Tablet)
*/
+ @Override
public void insertAlignedRecord(
String multiSeriesId, long time, List<String>
multiMeasurementComponents, List<String> values)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.insertAlignedRecord(multiSeriesId, time,
multiMeasurementComponents, values);
putBack(session);
@@ -1329,10 +1360,11 @@ public class SessionPool {
* This method NOT insert data into database and the server just return
after accept the request,
* this method should be used to test other time cost in client
*/
+ @Override
public void testInsertTablet(Tablet tablet)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.testInsertTablet(tablet);
putBack(session);
@@ -1352,10 +1384,11 @@ public class SessionPool {
* This method NOT insert data into database and the server just return
after accept the request,
* this method should be used to test other time cost in client
*/
+ @Override
public void testInsertTablet(Tablet tablet, boolean sorted)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.testInsertTablet(tablet, sorted);
putBack(session);
@@ -1375,10 +1408,11 @@ public class SessionPool {
* This method NOT insert data into database and the server just return
after accept the request,
* this method should be used to test other time cost in client
*/
+ @Override
public void testInsertTablets(Map<String, Tablet> tablets)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.testInsertTablets(tablets);
putBack(session);
@@ -1398,10 +1432,11 @@ public class SessionPool {
* This method NOT insert data into database and the server just return
after accept the request,
* this method should be used to test other time cost in client
*/
+ @Override
public void testInsertTablets(Map<String, Tablet> tablets, boolean sorted)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.testInsertTablets(tablets, sorted);
putBack(session);
@@ -1421,6 +1456,7 @@ public class SessionPool {
* This method NOT insert data into database and the server just return
after accept the request,
* this method should be used to test other time cost in client
*/
+ @Override
public void testInsertRecords(
List<String> deviceIds,
List<Long> times,
@@ -1428,7 +1464,7 @@ public class SessionPool {
List<List<String>> valuesList)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.testInsertRecords(deviceIds, times, measurementsList,
valuesList);
putBack(session);
@@ -1448,6 +1484,7 @@ public class SessionPool {
* This method NOT insert data into database and the server just return
after accept the request,
* this method should be used to test other time cost in client
*/
+ @Override
public void testInsertRecords(
List<String> deviceIds,
List<Long> times,
@@ -1456,7 +1493,7 @@ public class SessionPool {
List<List<Object>> valuesList)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.testInsertRecords(deviceIds, times, measurementsList,
typesList, valuesList);
putBack(session);
@@ -1476,11 +1513,12 @@ public class SessionPool {
* This method NOT insert data into database and the server just return
after accept the request,
* this method should be used to test other time cost in client
*/
+ @Override
public void testInsertRecord(
String deviceId, long time, List<String> measurements, List<String>
values)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.testInsertRecord(deviceId, time, measurements, values);
putBack(session);
@@ -1500,6 +1538,7 @@ public class SessionPool {
* This method NOT insert data into database and the server just return
after accept the request,
* this method should be used to test other time cost in client
*/
+ @Override
public void testInsertRecord(
String deviceId,
long time,
@@ -1508,7 +1547,7 @@ public class SessionPool {
List<Object> values)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.testInsertRecord(deviceId, time, measurements, types, values);
putBack(session);
@@ -1529,10 +1568,11 @@ public class SessionPool {
*
* @param path timeseries to delete, should be a whole path
*/
+ @Override
public void deleteTimeseries(String path)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.deleteTimeseries(path);
putBack(session);
@@ -1553,10 +1593,11 @@ public class SessionPool {
*
* @param paths timeseries to delete, should be a whole path
*/
+ @Override
public void deleteTimeseries(List<String> paths)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.deleteTimeseries(paths);
putBack(session);
@@ -1578,10 +1619,11 @@ public class SessionPool {
* @param path data in which time series to delete
* @param time data with time stamp less than or equal to time will be
deleted
*/
+ @Override
public void deleteData(String path, long time)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.deleteData(path, time);
putBack(session);
@@ -1603,10 +1645,11 @@ public class SessionPool {
* @param paths data in which time series to delete
* @param time data with time stamp less than or equal to time will be
deleted
*/
+ @Override
public void deleteData(List<String> paths, long time)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.deleteData(paths, time);
putBack(session);
@@ -1629,10 +1672,11 @@ public class SessionPool {
* @param startTime delete range start time
* @param endTime delete range end time
*/
+ @Override
public void deleteData(List<String> paths, long startTime, long endTime)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.deleteData(paths, startTime, endTime);
putBack(session);
@@ -1650,10 +1694,11 @@ public class SessionPool {
/** @deprecated Use {@link #createDatabase(String)} instead. */
@Deprecated
+ @Override
public void setStorageGroup(String storageGroupId)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.setStorageGroup(storageGroupId);
putBack(session);
@@ -1671,10 +1716,11 @@ public class SessionPool {
/** @deprecated Use {@link #deleteDatabase(String)} instead. */
@Deprecated
+ @Override
public void deleteStorageGroup(String storageGroup)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.deleteStorageGroup(storageGroup);
putBack(session);
@@ -1692,10 +1738,11 @@ public class SessionPool {
/** @deprecated Use {@link #deleteDatabases(List)} instead. */
@Deprecated
+ @Override
public void deleteStorageGroups(List<String> storageGroup)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.deleteStorageGroups(storageGroup);
putBack(session);
@@ -1711,10 +1758,11 @@ public class SessionPool {
}
}
+ @Override
public void createDatabase(String database)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.createDatabase(database);
putBack(session);
@@ -1730,10 +1778,11 @@ public class SessionPool {
}
}
+ @Override
public void deleteDatabase(String database)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.deleteDatabase(database);
putBack(session);
@@ -1749,10 +1798,11 @@ public class SessionPool {
}
}
+ @Override
public void deleteDatabases(List<String> databases)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.deleteDatabases(databases);
putBack(session);
@@ -1768,11 +1818,12 @@ public class SessionPool {
}
}
+ @Override
public void createTimeseries(
String path, TSDataType dataType, TSEncoding encoding, CompressionType
compressor)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.createTimeseries(path, dataType, encoding, compressor);
putBack(session);
@@ -1788,6 +1839,7 @@ public class SessionPool {
}
}
+ @Override
public void createTimeseries(
String path,
TSDataType dataType,
@@ -1799,7 +1851,7 @@ public class SessionPool {
String measurementAlias)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.createTimeseries(
path, dataType, encoding, compressor, props, tags, attributes,
measurementAlias);
@@ -1816,6 +1868,7 @@ public class SessionPool {
}
}
+ @Override
public void createMultiTimeseries(
List<String> paths,
List<TSDataType> dataTypes,
@@ -1827,7 +1880,7 @@ public class SessionPool {
List<String> measurementAliasList)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.createMultiTimeseries(
paths,
@@ -1851,10 +1904,11 @@ public class SessionPool {
}
}
+ @Override
public boolean checkTimeseriesExists(String path)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
boolean resp = session.checkTimeseriesExists(path);
putBack(session);
@@ -1877,10 +1931,11 @@ public class SessionPool {
*
* @see Template
*/
+ @Override
public void createSchemaTemplate(Template template)
throws IOException, IoTDBConnectionException,
StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.createSchemaTemplate(template);
putBack(session);
@@ -1907,6 +1962,7 @@ public class SessionPool {
* @param compressors compression type of each measurement in the template
* @param isAligned specify whether these flat measurements are aligned
*/
+ @Override
public void createSchemaTemplate(
String templateName,
List<String> measurements,
@@ -1916,7 +1972,7 @@ public class SessionPool {
boolean isAligned)
throws IOException, IoTDBConnectionException,
StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.createSchemaTemplate(
templateName, measurements, dataTypes, encodings, compressors,
isAligned);
@@ -1952,6 +2008,7 @@ public class SessionPool {
* @throws StatementExecutionException
*/
@Deprecated
+ @Override
public void createSchemaTemplate(
String name,
List<String> schemaNames,
@@ -1961,7 +2018,7 @@ public class SessionPool {
List<CompressionType> compressors)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.createSchemaTemplate(
name, schemaNames, measurements, dataTypes, encodings,
compressors);
@@ -1978,6 +2035,7 @@ public class SessionPool {
}
}
+ @Override
public void addAlignedMeasurementsInTemplate(
String templateName,
List<String> measurementsPath,
@@ -1986,7 +2044,7 @@ public class SessionPool {
List<CompressionType> compressors)
throws IOException, IoTDBConnectionException,
StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.addAlignedMeasurementsInTemplate(
templateName, measurementsPath, dataTypes, encodings, compressors);
@@ -2003,6 +2061,7 @@ public class SessionPool {
}
}
+ @Override
public void addAlignedMeasurementInTemplate(
String templateName,
String measurementPath,
@@ -2011,7 +2070,7 @@ public class SessionPool {
CompressionType compressor)
throws IOException, IoTDBConnectionException,
StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.addAlignedMeasurementInTemplate(
templateName, measurementPath, dataType, encoding, compressor);
@@ -2028,6 +2087,7 @@ public class SessionPool {
}
}
+ @Override
public void addUnalignedMeasurementsInTemplate(
String templateName,
List<String> measurementsPath,
@@ -2036,7 +2096,7 @@ public class SessionPool {
List<CompressionType> compressors)
throws IOException, IoTDBConnectionException,
StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.addUnalignedMeasurementsInTemplate(
templateName, measurementsPath, dataTypes, encodings, compressors);
@@ -2053,6 +2113,7 @@ public class SessionPool {
}
}
+ @Override
public void addUnalignedMeasurementInTemplate(
String templateName,
String measurementPath,
@@ -2061,7 +2122,7 @@ public class SessionPool {
CompressionType compressor)
throws IOException, IoTDBConnectionException,
StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.addUnalignedMeasurementInTemplate(
templateName, measurementPath, dataType, encoding, compressor);
@@ -2078,10 +2139,11 @@ public class SessionPool {
}
}
+ @Override
public void deleteNodeInTemplate(String templateName, String path)
throws IOException, IoTDBConnectionException,
StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.deleteNodeInTemplate(templateName, path);
putBack(session);
@@ -2097,10 +2159,11 @@ public class SessionPool {
}
}
+ @Override
public int countMeasurementsInTemplate(String name)
throws StatementExecutionException, IoTDBConnectionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
int resp = session.countMeasurementsInTemplate(name);
putBack(session);
@@ -2117,10 +2180,11 @@ public class SessionPool {
return -1;
}
+ @Override
public boolean isMeasurementInTemplate(String templateName, String path)
throws StatementExecutionException, IoTDBConnectionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
boolean resp = session.isMeasurementInTemplate(templateName, path);
putBack(session);
@@ -2137,10 +2201,11 @@ public class SessionPool {
return false;
}
+ @Override
public boolean isPathExistInTemplate(String templateName, String path)
throws StatementExecutionException, IoTDBConnectionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
boolean resp = session.isPathExistInTemplate(templateName, path);
putBack(session);
@@ -2157,10 +2222,11 @@ public class SessionPool {
return false;
}
+ @Override
public List<String> showMeasurementsInTemplate(String templateName)
throws StatementExecutionException, IoTDBConnectionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
List<String> resp = session.showMeasurementsInTemplate(templateName);
putBack(session);
@@ -2177,10 +2243,11 @@ public class SessionPool {
return null;
}
+ @Override
public List<String> showMeasurementsInTemplate(String templateName, String
pattern)
throws StatementExecutionException, IoTDBConnectionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
List<String> resp = session.showMeasurementsInTemplate(templateName,
pattern);
putBack(session);
@@ -2197,10 +2264,11 @@ public class SessionPool {
return null;
}
+ @Override
public List<String> showAllTemplates()
throws StatementExecutionException, IoTDBConnectionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
List<String> resp = session.showAllTemplates();
putBack(session);
@@ -2217,10 +2285,11 @@ public class SessionPool {
return null;
}
+ @Override
public List<String> showPathsTemplateSetOn(String templateName)
throws StatementExecutionException, IoTDBConnectionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
List<String> resp = session.showPathsTemplateSetOn(templateName);
putBack(session);
@@ -2237,10 +2306,11 @@ public class SessionPool {
return null;
}
+ @Override
public List<String> showPathsTemplateUsingOn(String templateName)
throws StatementExecutionException, IoTDBConnectionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
List<String> resp = session.showPathsTemplateUsingOn(templateName);
putBack(session);
@@ -2257,10 +2327,11 @@ public class SessionPool {
return null;
}
+ @Override
public void setSchemaTemplate(String templateName, String prefixPath)
throws StatementExecutionException, IoTDBConnectionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.setSchemaTemplate(templateName, prefixPath);
putBack(session);
@@ -2277,10 +2348,11 @@ public class SessionPool {
}
}
+ @Override
public void unsetSchemaTemplate(String prefixPath, String templateName)
throws StatementExecutionException, IoTDBConnectionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.unsetSchemaTemplate(prefixPath, templateName);
putBack(session);
@@ -2297,10 +2369,11 @@ public class SessionPool {
}
}
+ @Override
public void dropSchemaTemplate(String templateName)
throws StatementExecutionException, IoTDBConnectionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.dropSchemaTemplate(templateName);
putBack(session);
@@ -2326,10 +2399,11 @@ public class SessionPool {
* happen
*/
@SuppressWarnings("squid:S2095") // Suppress wrapper not closed warning
+ @Override
public SessionDataSetWrapper executeQueryStatement(String sql)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
SessionDataSet resp = session.executeQueryStatement(sql);
SessionDataSetWrapper wrapper = new SessionDataSetWrapper(resp,
session, this);
@@ -2359,10 +2433,11 @@ public class SessionPool {
* happen
*/
@SuppressWarnings("squid:S2095") // Suppress wrapper not closed warning
+ @Override
public SessionDataSetWrapper executeQueryStatement(String sql, long
timeoutInMs)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
SessionDataSet resp = session.executeQueryStatement(sql, timeoutInMs);
SessionDataSetWrapper wrapper = new SessionDataSetWrapper(resp,
session, this);
@@ -2386,10 +2461,11 @@ public class SessionPool {
*
* @param sql non query statement
*/
+ @Override
public void executeNonQueryStatement(String sql)
throws StatementExecutionException, IoTDBConnectionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.executeNonQueryStatement(sql);
putBack(session);
@@ -2406,11 +2482,12 @@ public class SessionPool {
}
@SuppressWarnings("squid:S2095") // Suppress wrapper not closed warning
+ @Override
public SessionDataSetWrapper executeRawDataQuery(
List<String> paths, long startTime, long endTime, long timeOut)
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
SessionDataSet resp = session.executeRawDataQuery(paths, startTime,
endTime, timeOut);
SessionDataSetWrapper wrapper = new SessionDataSetWrapper(resp,
session, this);
@@ -2429,10 +2506,11 @@ public class SessionPool {
return null;
}
+ @Override
public SessionDataSetWrapper executeLastDataQuery(List<String> paths, long
LastTime, long timeOut)
throws StatementExecutionException, IoTDBConnectionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
SessionDataSet resp = session.executeLastDataQuery(paths, LastTime,
timeOut);
SessionDataSetWrapper wrapper = new SessionDataSetWrapper(resp,
session, this);
@@ -2451,10 +2529,11 @@ public class SessionPool {
return null;
}
+ @Override
public SessionDataSetWrapper executeLastDataQuery(List<String> paths)
throws StatementExecutionException, IoTDBConnectionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
SessionDataSet resp = session.executeLastDataQuery(paths);
SessionDataSetWrapper wrapper = new SessionDataSetWrapper(resp,
session, this);
@@ -2473,44 +2552,52 @@ public class SessionPool {
return null;
}
+ @Override
public int getMaxSize() {
return maxSize;
}
+ @Override
public String getHost() {
return host;
}
+ @Override
public int getPort() {
return port;
}
+ @Override
public String getUser() {
return user;
}
+ @Override
public String getPassword() {
return password;
}
+ @Override
public void setFetchSize(int fetchSize) {
this.fetchSize = fetchSize;
- for (Session session : queue) {
+ for (ISession session : queue) {
session.setFetchSize(fetchSize);
}
- for (Session session : occupied.keySet()) {
+ for (ISession session : occupied.keySet()) {
session.setFetchSize(fetchSize);
}
}
+ @Override
public int getFetchSize() {
return fetchSize;
}
+ @Override
public void setTimeZone(String zoneId)
throws StatementExecutionException, IoTDBConnectionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
session.setTimeZone(zoneId);
putBack(session);
@@ -2524,62 +2611,71 @@ public class SessionPool {
}
}
this.zoneId = ZoneId.of(zoneId);
- for (Session session : queue) {
+ for (ISession session : queue) {
session.setTimeZoneOfSession(zoneId);
}
- for (Session session : occupied.keySet()) {
+ for (ISession session : occupied.keySet()) {
session.setTimeZoneOfSession(zoneId);
}
}
+ @Override
public ZoneId getZoneId() {
return zoneId;
}
+ @Override
public long getWaitToGetSessionTimeoutInMs() {
return waitToGetSessionTimeoutInMs;
}
+ @Override
public boolean isEnableCompression() {
return enableCompression;
}
+ @Override
public void setEnableRedirection(boolean enableRedirection) {
this.enableRedirection = enableRedirection;
- for (Session session : queue) {
+ for (ISession session : queue) {
session.setEnableRedirection(enableRedirection);
}
- for (Session session : occupied.keySet()) {
+ for (ISession session : occupied.keySet()) {
session.setEnableRedirection(enableRedirection);
}
}
+ @Override
public boolean isEnableRedirection() {
return enableRedirection;
}
+ @Override
public void setEnableQueryRedirection(boolean enableQueryRedirection) {
this.enableQueryRedirection = enableQueryRedirection;
- for (Session session : queue) {
+ for (ISession session : queue) {
session.setEnableQueryRedirection(enableQueryRedirection);
}
- for (Session session : occupied.keySet()) {
+ for (ISession session : occupied.keySet()) {
session.setEnableQueryRedirection(enableQueryRedirection);
}
}
+ @Override
public boolean isEnableQueryRedirection() {
return enableQueryRedirection;
}
+ @Override
public int getConnectionTimeoutInMs() {
return connectionTimeoutInMs;
}
+ @Override
public TSBackupConfigurationResp getBackupConfiguration()
throws IoTDBConnectionException, StatementExecutionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
TSBackupConfigurationResp resp = session.getBackupConfiguration();
putBack(session);
@@ -2595,10 +2691,11 @@ public class SessionPool {
return null;
}
+ @Override
public TSConnectionInfoResp fetchAllConnections() throws
IoTDBConnectionException {
for (int i = 0; i < RETRY; i++) {
- Session session = getSession();
+ ISession session = getSession();
try {
TSConnectionInfoResp resp = session.fetchAllConnections();
putBack(session);
@@ -2615,30 +2712,34 @@ public class SessionPool {
return null;
}
+ @Override
public void setVersion(Version version) {
this.version = version;
- for (Session session : queue) {
+ for (ISession session : queue) {
session.setVersion(version);
}
- for (Session session : occupied.keySet()) {
+ for (ISession session : occupied.keySet()) {
session.setVersion(version);
}
}
+ @Override
public Version getVersion() {
return version;
}
+ @Override
public void setQueryTimeout(long timeoutInMs) {
this.queryTimeoutInMs = timeoutInMs;
- for (Session session : queue) {
+ for (ISession session : queue) {
session.setQueryTimeout(timeoutInMs);
}
- for (Session session : occupied.keySet()) {
+ for (ISession session : occupied.keySet()) {
session.setQueryTimeout(timeoutInMs);
}
}
+ @Override
public long getQueryTimeout() {
return queryTimeoutInMs;
}