You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2022/04/06 06:05:38 UTC

[iotdb] branch xingtanzjr/query_execution updated (ad4569e174 -> db89c036f9)

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

xingtanzjr pushed a change to branch xingtanzjr/query_execution
in repository https://gitbox.apache.org/repos/asf/iotdb.git


 discard ad4569e174 add more test for QueryStateMachine
     new db89c036f9 add more test for QueryStateMachine

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (ad4569e174)
            \
             N -- N -- N   refs/heads/xingtanzjr/query_execution (db89c036f9)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 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:
 .../org/apache/iotdb/db/mpp/execution/QueryExecution.java     | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)


[iotdb] 01/01: add more test for QueryStateMachine

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

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

commit db89c036f91815e84a4ddf9246510e72554d2eea
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Wed Apr 6 13:45:39 2022 +0800

    add more test for QueryStateMachine
---
 .../org/apache/iotdb/db/mpp/execution/QueryExecution.java | 11 ++++++-----
 .../iotdb/db/mpp/execution/QueryStateMachineTest.java     | 15 +++++++++++++++
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/QueryExecution.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/QueryExecution.java
index 7d49fe8e9a..bb37be005b 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/QueryExecution.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/QueryExecution.java
@@ -34,8 +34,6 @@ import org.apache.iotdb.db.mpp.sql.statement.Statement;
 import org.apache.iotdb.rpc.RpcUtils;
 import org.apache.iotdb.rpc.TSStatusCode;
 
-import com.google.common.util.concurrent.ListenableFuture;
-
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.List;
@@ -138,13 +136,16 @@ public class QueryExecution {
     releaseResource();
   }
 
-  /** Release the resources that current QueryExecution hold. */
-  private void releaseResource() {}
+  /**
+   * Release the resources that current QueryExecution hold.
+   */
+  private void releaseResource() {
+  }
 
   /**
    * This method will be called by the request thread from client connection. This method will block
    * until one of these conditions occurs: 1. There is a batch of result 2. There is no more result
-   * 3. The query has been cancelled 4. The query is timeout This method wil l fetch the result from
+   * 3. The query has been cancelled 4. The query is timeout This method will fetch the result from
    * DataStreamManager use the virtual ResultOperator's ID (This part will be designed and
    * implemented with DataStreamManager)
    */
diff --git a/server/src/test/java/org/apache/iotdb/db/mpp/execution/QueryStateMachineTest.java b/server/src/test/java/org/apache/iotdb/db/mpp/execution/QueryStateMachineTest.java
index dde44f0d64..c183655ce5 100644
--- a/server/src/test/java/org/apache/iotdb/db/mpp/execution/QueryStateMachineTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/mpp/execution/QueryStateMachineTest.java
@@ -19,6 +19,7 @@
 
 package org.apache.iotdb.db.mpp.execution;
 
+import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
 import org.apache.iotdb.commons.concurrent.IoTDBThreadPoolFactory;
 import org.apache.iotdb.db.mpp.common.FragmentInstanceId;
@@ -32,6 +33,8 @@ import java.util.List;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import static com.google.common.util.concurrent.MoreExecutors.directExecutor;
+
 public class QueryStateMachineTest {
 
   @Test
@@ -97,6 +100,18 @@ public class QueryStateMachineTest {
     Assert.assertEquals(stateChangeCounter.get(), 2);
   }
 
+  @Test
+  public void TestGetStateChange() throws ExecutionException, InterruptedException {
+    AtomicInteger stateChangeCounter = new AtomicInteger(0);
+    QueryStateMachine stateMachine = genQueryStateMachine();
+    ListenableFuture<QueryState> future = stateMachine.getStateChange(QueryState.QUEUED);
+    future.addListener(stateChangeCounter::getAndIncrement, directExecutor());
+    Assert.assertEquals(stateChangeCounter.get(), 0);
+    stateMachine.transitionToRunning();
+    future.get();
+    Assert.assertEquals(stateChangeCounter.get(), 1);
+  }
+
   private QueryStateMachine genQueryStateMachine() {
     return new QueryStateMachine(genQueryId(), IoTDBThreadPoolFactory.newSingleThreadExecutor("TestQueryStateMachine"));
   }