You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2022/10/17 11:58:13 UTC

[iotdb] branch IOTDB-4619 updated (ebb6ce53ee -> d77bd7792d)

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

jackietien pushed a change to branch IOTDB-4619
in repository https://gitbox.apache.org/repos/asf/iotdb.git


    from ebb6ce53ee Add more logs in CQScheduleTask
     new 723ba9bd3b order show cq response
     new d77bd7792d Add UT for CQScheduleTask#getFirstExecutionTime

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../confignode/consensus/response/ShowCQResp.java  |  2 ++
 .../confignode/manager/cq/CQScheduleTask.java      |  6 ++++-
 .../iotdb/confignode/cq/CQScheduleTaskTest.java    | 26 ++++++++++++++++------
 3 files changed, 26 insertions(+), 8 deletions(-)
 copy testcontainer/src/test/java/org/apache/iotdb/db/sql/nodes5/FiveNodeCluster2IT.java => confignode/src/test/java/org/apache/iotdb/confignode/cq/CQScheduleTaskTest.java (57%)


[iotdb] 01/02: order show cq response

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch IOTDB-4619
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 723ba9bd3b3fcede973072f37e5eaa53e8d9e118
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Mon Oct 17 17:12:52 2022 +0800

    order show cq response
---
 .../java/org/apache/iotdb/confignode/consensus/response/ShowCQResp.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/ShowCQResp.java b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/ShowCQResp.java
index 44a8de0080..e59cc9eb04 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/ShowCQResp.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/consensus/response/ShowCQResp.java
@@ -26,6 +26,7 @@ import org.apache.iotdb.consensus.common.DataSet;
 
 import javax.validation.constraints.NotNull;
 
+import java.util.Comparator;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -44,6 +45,7 @@ public class ShowCQResp implements DataSet {
         status,
         cqList.stream()
             .map(entry -> new TCQEntry(entry.getCqId(), entry.getSql(), entry.getState().getType()))
+            .sorted(Comparator.comparing(entry -> entry.cqId))
             .collect(Collectors.toList()));
   }
 


[iotdb] 02/02: Add UT for CQScheduleTask#getFirstExecutionTime

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jackietien pushed a commit to branch IOTDB-4619
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit d77bd7792d4ca04ad8f3889c8d5c1c2e8fe932a8
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Mon Oct 17 19:58:02 2022 +0800

    Add UT for CQScheduleTask#getFirstExecutionTime
---
 .../confignode/manager/cq/CQScheduleTask.java      |  6 ++-
 .../iotdb/confignode/cq/CQScheduleTaskTest.java    | 44 ++++++++++++++++++++++
 2 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/manager/cq/CQScheduleTask.java b/confignode/src/main/java/org/apache/iotdb/confignode/manager/cq/CQScheduleTask.java
index e0c734fc2a..48ab4e3b8e 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/manager/cq/CQScheduleTask.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/manager/cq/CQScheduleTask.java
@@ -125,8 +125,12 @@ public class CQScheduleTask implements Runnable {
   }
 
   public static long getFirstExecutionTime(long boundaryTime, long everyInterval) {
-    // TODO may need to consider nano precision
     long now = System.currentTimeMillis();
+    return getFirstExecutionTime(boundaryTime, everyInterval, now);
+  }
+
+  public static long getFirstExecutionTime(long boundaryTime, long everyInterval, long now) {
+    // TODO may need to consider nano precision
     if (now <= boundaryTime) {
       return boundaryTime;
     } else {
diff --git a/confignode/src/test/java/org/apache/iotdb/confignode/cq/CQScheduleTaskTest.java b/confignode/src/test/java/org/apache/iotdb/confignode/cq/CQScheduleTaskTest.java
new file mode 100644
index 0000000000..44f8536ee0
--- /dev/null
+++ b/confignode/src/test/java/org/apache/iotdb/confignode/cq/CQScheduleTaskTest.java
@@ -0,0 +1,44 @@
+/*
+ * 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.confignode.cq;
+
+import org.apache.iotdb.confignode.manager.cq.CQScheduleTask;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class CQScheduleTaskTest {
+
+  @Test
+  public void testGetFirstExecutionTime1() {
+    long now = 100L;
+    long boundaryTime = 0L;
+    long everyInterval = 30L;
+    assertEquals(120L, CQScheduleTask.getFirstExecutionTime(boundaryTime, everyInterval, now));
+  }
+
+  @Test
+  public void testGetFirstExecutionTime2() {
+    long now = 100L;
+    long boundaryTime = 110L;
+    long everyInterval = 30L;
+    assertEquals(110L, CQScheduleTask.getFirstExecutionTime(boundaryTime, everyInterval, now));
+  }
+}