This is an automated email from the ASF dual-hosted git repository.

qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new a42631f  add deleteData Func in session pool (#2388)
a42631f is described below

commit a42631f02cbf13d0bfd1d253e73655d10e6f6bab
Author: Xiangwei Wei <[email protected]>
AuthorDate: Wed Dec 30 19:03:10 2020 +0800

    add deleteData Func in session pool (#2388)
---
 .../org/apache/iotdb/session/pool/SessionPool.java | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)

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 0f8bb56..87d48eb 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
@@ -735,6 +735,32 @@ public class SessionPool {
     }
   }
 
+  /**
+   * delete data >= startTime and data <= endTime in multiple timeseries
+   *
+   * @param paths     data in which time series to delete
+   * @param startTime delete range start time
+   * @param endTime   delete range end time
+   */
+  public void deleteData(List<String> paths, long startTime, long endTime)
+      throws IoTDBConnectionException, StatementExecutionException {
+    for (int i = 0; i < RETRY; i++) {
+      Session session = getSession();
+      try {
+        session.deleteData(paths, startTime, endTime);
+        putBack(session);
+        return;
+      } catch (IoTDBConnectionException e) {
+        // TException means the connection is broken, remove it and get a new 
one.
+        logger.warn("deleteData failed", e);
+        cleanSessionAndMayThrowConnectionException(session, i, e);
+      } catch (StatementExecutionException e) {
+        putBack(session);
+        throw e;
+      }
+    }
+  }
+
   public void setStorageGroup(String storageGroupId)
       throws IoTDBConnectionException, StatementExecutionException {
     for (int i = 0; i < RETRY; i++) {

Reply via email to