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/20 14:16:43 UTC

[iotdb] 01/01: add log for test check CI

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

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

commit 2f9ef103c2e6b96f3606e536d45b1ee413b674a5
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Wed Apr 20 22:15:59 2022 +0800

    add log for test check CI
---
 .../db/mpp/execution/config/ConfigExecution.java      |  7 ++++++-
 .../iotdb/db/mpp/execution/ConfigExecutionTest.java   | 19 +++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/execution/config/ConfigExecution.java b/server/src/main/java/org/apache/iotdb/db/mpp/execution/config/ConfigExecution.java
index fcb955010f..7d6f24733d 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/execution/config/ConfigExecution.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/execution/config/ConfigExecution.java
@@ -37,6 +37,7 @@ import com.google.common.util.concurrent.ListenableFuture;
 import jersey.repackaged.com.google.common.util.concurrent.SettableFuture;
 import org.jetbrains.annotations.NotNull;
 
+import java.util.concurrent.CancellationException;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ExecutorService;
 
@@ -82,17 +83,20 @@ public class ConfigExecution implements IQueryExecution {
           new FutureCallback<ConfigTaskResult>() {
             @Override
             public void onSuccess(ConfigTaskResult taskRet) {
+              System.out.println("on success");
               stateMachine.transitionToFinished();
               taskFuture.set(taskRet);
             }
 
             @Override
             public void onFailure(@NotNull Throwable throwable) {
+              System.out.println("on fail");
               fail(throwable);
             }
           },
           executor);
     } catch (Throwable e) {
+      System.out.println(Thread.currentThread().getName() + " - re-interrupt");
       Thread.currentThread().interrupt();
       fail(e);
     }
@@ -118,7 +122,8 @@ public class ConfigExecution implements IQueryExecution {
       String message =
           statusCode == TSStatusCode.SUCCESS_STATUS ? "" : stateMachine.getFailureMessage();
       return new ExecutionResult(context.getQueryId(), RpcUtils.getStatus(statusCode, message));
-    } catch (InterruptedException | ExecutionException e) {
+    } catch (InterruptedException | ExecutionException | CancellationException e) {
+      System.out.println("taskResult is cancelled");
       Thread.currentThread().interrupt();
       return new ExecutionResult(
           context.getQueryId(),
diff --git a/server/src/test/java/org/apache/iotdb/db/mpp/execution/ConfigExecutionTest.java b/server/src/test/java/org/apache/iotdb/db/mpp/execution/ConfigExecutionTest.java
index 9a1c36beb5..ac3d2c316b 100644
--- a/server/src/test/java/org/apache/iotdb/db/mpp/execution/ConfigExecutionTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/mpp/execution/ConfigExecutionTest.java
@@ -122,6 +122,7 @@ public class ConfigExecutionTest {
   public void exceptionAfterInvokeGetStatusTest() {
     IConfigTask task =
         () -> {
+          System.out.println(Thread.currentThread().getName() + " - throw RuntimeException");
           throw new RuntimeException("task throw exception when executing");
         };
     ConfigExecution execution =
@@ -129,16 +130,34 @@ public class ConfigExecutionTest {
     Thread resultThread =
         new Thread(
             () -> {
+              System.out.println(Thread.currentThread().getName() + " - start get status");
               ExecutionResult result = execution.getStatus();
+              System.out.println(Thread.currentThread().getName() + " - status got");
               Assert.assertEquals(
                   TSStatusCode.INTERNAL_SERVER_ERROR.getStatusCode(), result.status.code);
             });
     resultThread.start();
     execution.start();
     try {
+      System.out.println(Thread.currentThread().getName() + " - resultThread start join");
       resultThread.join();
+      System.out.println(
+          Thread.currentThread().getName()
+              + " - resultThread interrupted: "
+              + resultThread.isInterrupted());
+      System.out.println(Thread.currentThread().getName() + " - resultThread end join");
       Assert.fail("InterruptedException should be threw here");
     } catch (InterruptedException e) {
+      System.out.println(
+          Thread.currentThread().getName() + " - Exception, caught interrupted exception");
+      System.out.println(
+          Thread.currentThread().getName()
+              + " - Exception, current Thread interrupted: "
+              + Thread.currentThread().isInterrupted());
+      System.out.println(
+          Thread.currentThread().getName()
+              + " - Exception, resultThread interrupted: "
+              + resultThread.isInterrupted());
       execution.stop();
     }
   }