You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2022/08/03 12:15:14 UTC

[iotdb] 01/01: remove useless code

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

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

commit 9f1e32caaea28fdbab7d4bbac61a612532392003
Author: qiaojialin <64...@qq.com>
AuthorDate: Wed Aug 3 20:14:54 2022 +0800

    remove useless code
---
 .../db/mpp/plan/execution/QueryExecution.java      |  3 +--
 .../scheduler/AbstractFragInsStateTracker.java     |  4 ----
 .../db/mpp/plan/scheduler/ClusterScheduler.java    |  3 +--
 .../scheduler/FixedRateFragInsStateTracker.java    |  4 +---
 .../mpp/plan/scheduler/SimpleQueryTerminator.java  |  4 ----
 .../db/mpp/plan/scheduler/StandaloneScheduler.java | 28 +++++-----------------
 .../plan/scheduler/StandaloneSchedulerTest.java    |  5 ----
 7 files changed, 9 insertions(+), 42 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
index 4534b7b740..842352a7b6 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/execution/QueryExecution.java
@@ -98,7 +98,7 @@ public class QueryExecution implements IQueryExecution {
 
   private final List<PlanOptimizer> planOptimizers;
 
-  private Statement rawStatement;
+  private final Statement rawStatement;
   private Analysis analysis;
   private LogicalQueryPlan logicalPlan;
   private DistributedQueryPlan distributedPlan;
@@ -252,7 +252,6 @@ public class QueryExecution implements IQueryExecution {
                 stateMachine,
                 distributedPlan.getInstances(),
                 context.getQueryType(),
-                executor,
                 scheduledExecutor,
                 internalServiceClientManager);
     this.scheduler.start();
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/AbstractFragInsStateTracker.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/AbstractFragInsStateTracker.java
index 1be7c12ab0..50031dc9b3 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/AbstractFragInsStateTracker.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/AbstractFragInsStateTracker.java
@@ -33,13 +33,11 @@ import org.apache.thrift.TException;
 
 import java.io.IOException;
 import java.util.List;
-import java.util.concurrent.ExecutorService;
 import java.util.concurrent.ScheduledExecutorService;
 
 public abstract class AbstractFragInsStateTracker implements IFragInstanceStateTracker {
 
   protected QueryStateMachine stateMachine;
-  protected ExecutorService executor;
   protected ScheduledExecutorService scheduledExecutor;
   protected List<FragmentInstance> instances;
 
@@ -48,12 +46,10 @@ public abstract class AbstractFragInsStateTracker implements IFragInstanceStateT
 
   public AbstractFragInsStateTracker(
       QueryStateMachine stateMachine,
-      ExecutorService executor,
       ScheduledExecutorService scheduledExecutor,
       List<FragmentInstance> instances,
       IClientManager<TEndPoint, SyncDataNodeInternalServiceClient> internalServiceClientManager) {
     this.stateMachine = stateMachine;
-    this.executor = executor;
     this.scheduledExecutor = scheduledExecutor;
     this.instances = instances;
     this.internalServiceClientManager = internalServiceClientManager;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/ClusterScheduler.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/ClusterScheduler.java
index f2d36f093d..e9829cc637 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/ClusterScheduler.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/ClusterScheduler.java
@@ -80,10 +80,9 @@ public class ClusterScheduler implements IScheduler {
     if (queryType == QueryType.READ) {
       this.stateTracker =
           new FixedRateFragInsStateTracker(
-              stateMachine, executor, scheduledExecutor, instances, internalServiceClientManager);
+              stateMachine, scheduledExecutor, instances, internalServiceClientManager);
       this.queryTerminator =
           new SimpleQueryTerminator(
-              executor,
               scheduledExecutor,
               queryContext.getQueryId(),
               instances,
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/FixedRateFragInsStateTracker.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/FixedRateFragInsStateTracker.java
index 59dbce1208..f000add3ba 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/FixedRateFragInsStateTracker.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/FixedRateFragInsStateTracker.java
@@ -34,7 +34,6 @@ import org.slf4j.LoggerFactory;
 
 import java.io.IOException;
 import java.util.List;
-import java.util.concurrent.ExecutorService;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledFuture;
 import java.util.concurrent.TimeUnit;
@@ -54,11 +53,10 @@ public class FixedRateFragInsStateTracker extends AbstractFragInsStateTracker {
 
   public FixedRateFragInsStateTracker(
       QueryStateMachine stateMachine,
-      ExecutorService executor,
       ScheduledExecutorService scheduledExecutor,
       List<FragmentInstance> instances,
       IClientManager<TEndPoint, SyncDataNodeInternalServiceClient> internalServiceClientManager) {
-    super(stateMachine, executor, scheduledExecutor, instances, internalServiceClientManager);
+    super(stateMachine, scheduledExecutor, instances, internalServiceClientManager);
     this.aborted = false;
   }
 
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/SimpleQueryTerminator.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/SimpleQueryTerminator.java
index 0a459f2e0f..32b329d640 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/SimpleQueryTerminator.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/SimpleQueryTerminator.java
@@ -35,7 +35,6 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Future;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
@@ -44,7 +43,6 @@ import java.util.stream.Collectors;
 public class SimpleQueryTerminator implements IQueryTerminator {
   private static final Logger logger = LoggerFactory.getLogger(SimpleQueryTerminator.class);
   private static final long TERMINATION_GRACE_PERIOD_IN_MS = 1000L;
-  private final ExecutorService executor;
   protected ScheduledExecutorService scheduledExecutor;
   private final QueryId queryId;
   private List<TEndPoint> relatedHost;
@@ -54,12 +52,10 @@ public class SimpleQueryTerminator implements IQueryTerminator {
       internalServiceClientManager;
 
   public SimpleQueryTerminator(
-      ExecutorService executor,
       ScheduledExecutorService scheduledExecutor,
       QueryId queryId,
       List<FragmentInstance> fragmentInstances,
       IClientManager<TEndPoint, SyncDataNodeInternalServiceClient> internalServiceClientManager) {
-    this.executor = executor;
     this.scheduledExecutor = scheduledExecutor;
     this.queryId = queryId;
     this.internalServiceClientManager = internalServiceClientManager;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/StandaloneScheduler.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/StandaloneScheduler.java
index 328cbaa32f..09c7da7b43 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/StandaloneScheduler.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/StandaloneScheduler.java
@@ -49,7 +49,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.List;
-import java.util.concurrent.ExecutorService;
 import java.util.concurrent.ScheduledExecutorService;
 
 public class StandaloneScheduler implements IScheduler {
@@ -60,44 +59,29 @@ public class StandaloneScheduler implements IScheduler {
 
   private static final Logger LOGGER = LoggerFactory.getLogger(StandaloneScheduler.class);
 
-  private MPPQueryContext queryContext;
+  private final MPPQueryContext queryContext;
   // The stateMachine of the QueryExecution owned by this QueryScheduler
-  private QueryStateMachine stateMachine;
-  private QueryType queryType;
+  private final QueryStateMachine stateMachine;
+  private final QueryType queryType;
   // The fragment instances which should be sent to corresponding Nodes.
-  private List<FragmentInstance> instances;
+  private final List<FragmentInstance> instances;
 
-  private ExecutorService executor;
-  private ScheduledExecutorService scheduledExecutor;
-
-  private IFragInstanceDispatcher dispatcher;
-  private IFragInstanceStateTracker stateTracker;
-  private IQueryTerminator queryTerminator;
+  private final IFragInstanceStateTracker stateTracker;
 
   public StandaloneScheduler(
       MPPQueryContext queryContext,
       QueryStateMachine stateMachine,
       List<FragmentInstance> instances,
       QueryType queryType,
-      ExecutorService executor,
       ScheduledExecutorService scheduledExecutor,
       IClientManager<TEndPoint, SyncDataNodeInternalServiceClient> internalServiceClientManager) {
     this.queryContext = queryContext;
     this.instances = instances;
     this.queryType = queryType;
-    this.executor = executor;
-    this.scheduledExecutor = scheduledExecutor;
     this.stateMachine = stateMachine;
     this.stateTracker =
         new FixedRateFragInsStateTracker(
-            stateMachine, executor, scheduledExecutor, instances, internalServiceClientManager);
-    this.queryTerminator =
-        new SimpleQueryTerminator(
-            executor,
-            scheduledExecutor,
-            queryContext.getQueryId(),
-            instances,
-            internalServiceClientManager);
+            stateMachine, scheduledExecutor, instances, internalServiceClientManager);
   }
 
   @SuppressWarnings("squid:S3776") // Suppress high Cognitive Complexity warning
diff --git a/server/src/test/java/org/apache/iotdb/db/mpp/plan/scheduler/StandaloneSchedulerTest.java b/server/src/test/java/org/apache/iotdb/db/mpp/plan/scheduler/StandaloneSchedulerTest.java
index a5c65def26..34e2a9e85f 100644
--- a/server/src/test/java/org/apache/iotdb/db/mpp/plan/scheduler/StandaloneSchedulerTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/mpp/plan/scheduler/StandaloneSchedulerTest.java
@@ -157,7 +157,6 @@ public class StandaloneSchedulerTest {
             stateMachine,
             Collections.singletonList(fragmentInstance),
             QueryType.WRITE,
-            executor,
             null,
             null);
     try {
@@ -261,7 +260,6 @@ public class StandaloneSchedulerTest {
             stateMachine,
             Collections.singletonList(fragmentInstance),
             QueryType.WRITE,
-            executor,
             null,
             null);
     try {
@@ -375,7 +373,6 @@ public class StandaloneSchedulerTest {
             stateMachine,
             Collections.singletonList(fragmentInstance),
             QueryType.WRITE,
-            executor,
             null,
             null);
     try {
@@ -428,7 +425,6 @@ public class StandaloneSchedulerTest {
             stateMachine,
             Collections.singletonList(fragmentInstance),
             QueryType.WRITE,
-            executor,
             null,
             null);
     try {
@@ -510,7 +506,6 @@ public class StandaloneSchedulerTest {
             stateMachine,
             Collections.singletonList(fragmentInstance),
             QueryType.WRITE,
-            executor,
             null,
             null);
     try {