You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ji...@apache.org on 2023/05/16 04:45:52 UTC

[iotdb] branch handle_redirection_during_dispatching updated: apply spotless

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

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


The following commit(s) were added to refs/heads/handle_redirection_during_dispatching by this push:
     new 1100327ef1 apply spotless
1100327ef1 is described below

commit 1100327ef1274e1c95a80eb0715df1775fe396c9
Author: Tian Jiang <jt...@163.com>
AuthorDate: Tue May 16 12:48:43 2023 +0800

    apply spotless
---
 .../iotdb/commons/partition/ExecutorType.java      | 11 ++--
 .../iotdb/commons/partition/StorageExecutor.java   | 17 +++---
 .../apache/iotdb/commons/utils/ThriftUtils.java    |  7 ++-
 .../planner/plan/node/write/InsertTabletNode.java  | 63 ++++++----------------
 .../db/mpp/plan/scheduler/AsyncPlanNodeSender.java |  3 +-
 .../scheduler/FragmentInstanceDispatcherImpl.java  | 15 +++---
 6 files changed, 41 insertions(+), 75 deletions(-)

diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/partition/ExecutorType.java b/node-commons/src/main/java/org/apache/iotdb/commons/partition/ExecutorType.java
index dafe6dfbc0..fd01bd2f3d 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/partition/ExecutorType.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/partition/ExecutorType.java
@@ -23,14 +23,10 @@ import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation;
 import org.apache.iotdb.common.rpc.thrift.TEndPoint;
 import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
 
-/**
- * The interface is used to indicate where to execute a FragmentInstance
- */
+/** The interface is used to indicate where to execute a FragmentInstance */
 public interface ExecutorType {
 
-  /**
-   * Indicate if ExecutorType is StorageExecutor
-   */
+  /** Indicate if ExecutorType is StorageExecutor */
   boolean isStorageExecutor();
 
   TDataNodeLocation getDataNodeLocation();
@@ -45,6 +41,5 @@ public interface ExecutorType {
    *
    * @param endPoint associated with the preferred location.
    */
-  default void updatePreferredLocation(TEndPoint endPoint) {
-  }
+  default void updatePreferredLocation(TEndPoint endPoint) {}
 }
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/partition/StorageExecutor.java b/node-commons/src/main/java/org/apache/iotdb/commons/partition/StorageExecutor.java
index e3f49f31da..1f0a8a9b82 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/partition/StorageExecutor.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/partition/StorageExecutor.java
@@ -19,21 +19,20 @@
 
 package org.apache.iotdb.commons.partition;
 
-import java.util.List;
 import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation;
 import org.apache.iotdb.common.rpc.thrift.TEndPoint;
 import org.apache.iotdb.common.rpc.thrift.TRegionReplicaSet;
+import org.apache.iotdb.commons.utils.ThriftUtils;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import javax.annotation.Nonnull;
 
+import java.util.List;
 import java.util.Objects;
-import org.apache.iotdb.commons.utils.ThriftUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
-/**
- * StorageExecutor indicates execution of this query need data from StorageEngine
- */
+/** StorageExecutor indicates execution of this query need data from StorageEngine */
 public class StorageExecutor implements ExecutorType {
 
   private static final Logger logger = LoggerFactory.getLogger(StorageExecutor.class);
@@ -95,7 +94,9 @@ public class StorageExecutor implements ExecutorType {
 
     if (i < dataNodeLocations.size() && regionReplicaSet.getPreferredLocation() != i) {
       regionReplicaSet.setPreferredLocation(i);
-      logger.info("Preferred location of {} has been set to {}", regionReplicaSet,
+      logger.info(
+          "Preferred location of {} has been set to {}",
+          regionReplicaSet,
           regionReplicaSet.getDataNodeLocations().get(i));
     }
   }
diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/utils/ThriftUtils.java b/node-commons/src/main/java/org/apache/iotdb/commons/utils/ThriftUtils.java
index f65ace4ec4..b3cbfe3163 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/utils/ThriftUtils.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/utils/ThriftUtils.java
@@ -18,13 +18,12 @@
  */
 package org.apache.iotdb.commons.utils;
 
-import java.util.Objects;
 import org.apache.iotdb.common.rpc.thrift.TDataNodeLocation;
 import org.apache.iotdb.common.rpc.thrift.TEndPoint;
 
-/**
- * Utils that extend thrift generated objects.
- */
+import java.util.Objects;
+
+/** Utils that extend thrift generated objects. */
 public class ThriftUtils {
   private ThriftUtils() {
     // Empty constructor
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertTabletNode.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertTabletNode.java
index 8348dbac45..9535670d22 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertTabletNode.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertTabletNode.java
@@ -160,8 +160,7 @@ public class InsertTabletNode extends InsertNode implements WALEntryValue, ISche
   }
 
   @Override
-  public void addChild(PlanNode child) {
-  }
+  public void addChild(PlanNode child) {}
 
   @Override
   public PlanNode clone() {
@@ -240,8 +239,8 @@ public class InsertTabletNode extends InsertNode implements WALEntryValue, ISche
             .getDataRegionReplicaSetForWriting(devicePath.getFullPath(), timePartitionSlots);
 
     // collect redirectInfo
-    TRegionReplicaSet tRegionReplicaSet = dataRegionReplicaSets
-        .get(dataRegionReplicaSets.size() - 1);
+    TRegionReplicaSet tRegionReplicaSet =
+        dataRegionReplicaSets.get(dataRegionReplicaSets.size() - 1);
     int preferredLocation =
         tRegionReplicaSet.isSetPreferredLocation() ? tRegionReplicaSet.preferredLocation : 0;
     analysis.addEndPointToRedirectNodeList(
@@ -448,9 +447,7 @@ public class InsertTabletNode extends InsertNode implements WALEntryValue, ISche
     ReadWriteIOUtils.write((byte) (isAligned ? 1 : 0), stream);
   }
 
-  /**
-   * Serialize measurements or measurement schemas, ignoring failed time series
-   */
+  /** Serialize measurements or measurement schemas, ignoring failed time series */
   private void writeMeasurementsOrSchemas(ByteBuffer buffer) {
     ReadWriteIOUtils.write(measurements.length - getFailedMeasurementNumber(), buffer);
     ReadWriteIOUtils.write((byte) (measurementSchemas != null ? 1 : 0), buffer);
@@ -469,9 +466,7 @@ public class InsertTabletNode extends InsertNode implements WALEntryValue, ISche
     }
   }
 
-  /**
-   * Serialize measurements or measurement schemas, ignoring failed time series
-   */
+  /** Serialize measurements or measurement schemas, ignoring failed time series */
   private void writeMeasurementsOrSchemas(DataOutputStream stream) throws IOException {
     ReadWriteIOUtils.write(measurements.length - getFailedMeasurementNumber(), stream);
     ReadWriteIOUtils.write((byte) (measurementSchemas != null ? 1 : 0), stream);
@@ -490,9 +485,7 @@ public class InsertTabletNode extends InsertNode implements WALEntryValue, ISche
     }
   }
 
-  /**
-   * Serialize data types, ignoring failed time series
-   */
+  /** Serialize data types, ignoring failed time series */
   private void writeDataTypes(ByteBuffer buffer) {
     for (int i = 0; i < dataTypes.length; i++) {
       // ignore failed partial insert
@@ -503,9 +496,7 @@ public class InsertTabletNode extends InsertNode implements WALEntryValue, ISche
     }
   }
 
-  /**
-   * Serialize data types, ignoring failed time series
-   */
+  /** Serialize data types, ignoring failed time series */
   private void writeDataTypes(DataOutputStream stream) throws IOException {
     for (int i = 0; i < dataTypes.length; i++) {
       // ignore failed partial insert
@@ -530,9 +521,7 @@ public class InsertTabletNode extends InsertNode implements WALEntryValue, ISche
     }
   }
 
-  /**
-   * Serialize bitmaps, ignoring failed time series
-   */
+  /** Serialize bitmaps, ignoring failed time series */
   private void writeBitMaps(ByteBuffer buffer) {
     ReadWriteIOUtils.write(BytesUtils.boolToByte(bitMaps != null), buffer);
     if (bitMaps != null) {
@@ -552,9 +541,7 @@ public class InsertTabletNode extends InsertNode implements WALEntryValue, ISche
     }
   }
 
-  /**
-   * Serialize bitmaps, ignoring failed time series
-   */
+  /** Serialize bitmaps, ignoring failed time series */
   private void writeBitMaps(DataOutputStream stream) throws IOException {
     ReadWriteIOUtils.write(BytesUtils.boolToByte(bitMaps != null), stream);
     if (bitMaps != null) {
@@ -574,9 +561,7 @@ public class InsertTabletNode extends InsertNode implements WALEntryValue, ISche
     }
   }
 
-  /**
-   * Serialize values, ignoring failed time series
-   */
+  /** Serialize values, ignoring failed time series */
   private void writeValues(ByteBuffer buffer) {
     for (int i = 0; i < columns.length; i++) {
       // ignore failed partial insert
@@ -587,9 +572,7 @@ public class InsertTabletNode extends InsertNode implements WALEntryValue, ISche
     }
   }
 
-  /**
-   * Serialize values, ignoring failed time series
-   */
+  /** Serialize values, ignoring failed time series */
   private void writeValues(DataOutputStream stream) throws IOException {
     for (int i = 0; i < columns.length; i++) {
       // ignore failed partial insert
@@ -737,17 +720,13 @@ public class InsertTabletNode extends InsertNode implements WALEntryValue, ISche
 
   // region serialize & deserialize methods for WAL
 
-  /**
-   * Serialized size for wal
-   */
+  /** Serialized size for wal */
   @Override
   public int serializedSize() {
     return serializedSize(0, rowCount);
   }
 
-  /**
-   * Serialized size for wal
-   */
+  /** Serialized size for wal */
   public int serializedSize(int start, int end) {
     return Short.BYTES + subSerializeSize(start, end);
   }
@@ -844,9 +823,7 @@ public class InsertTabletNode extends InsertNode implements WALEntryValue, ISche
     buffer.put((byte) (isAligned ? 1 : 0));
   }
 
-  /**
-   * Serialize measurement schemas, ignoring failed time series
-   */
+  /** Serialize measurement schemas, ignoring failed time series */
   private void writeMeasurementSchemas(IWALByteBufferView buffer) {
     buffer.putInt(measurements.length - getFailedMeasurementNumber());
     serializeMeasurementSchemasToWAL(buffer);
@@ -859,9 +836,7 @@ public class InsertTabletNode extends InsertNode implements WALEntryValue, ISche
     }
   }
 
-  /**
-   * Serialize bitmaps, ignoring failed time series
-   */
+  /** Serialize bitmaps, ignoring failed time series */
   private void writeBitMaps(IWALByteBufferView buffer, int start, int end) {
     buffer.put(BytesUtils.boolToByte(bitMaps != null));
     if (bitMaps != null) {
@@ -884,9 +859,7 @@ public class InsertTabletNode extends InsertNode implements WALEntryValue, ISche
     }
   }
 
-  /**
-   * Serialize values, ignoring failed time series
-   */
+  /** Serialize values, ignoring failed time series */
   private void writeValues(IWALByteBufferView buffer, int start, int end) {
     for (int i = 0; i < columns.length; i++) {
       // ignore failed partial insert
@@ -942,9 +915,7 @@ public class InsertTabletNode extends InsertNode implements WALEntryValue, ISche
     }
   }
 
-  /**
-   * Deserialize from wal
-   */
+  /** Deserialize from wal */
   public static InsertTabletNode deserializeFromWAL(DataInputStream stream) throws IOException {
     // we do not store plan node id in wal entry
     InsertTabletNode insertNode = new InsertTabletNode(new PlanNodeId(""));
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/AsyncPlanNodeSender.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/AsyncPlanNodeSender.java
index a858a25977..dd3ca95492 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/AsyncPlanNodeSender.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/AsyncPlanNodeSender.java
@@ -132,7 +132,8 @@ public class AsyncPlanNodeSender {
         }
       }
 
-      if (status != null && status.getCode() == TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) {
+      if (status != null
+          && status.getCode() == TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) {
         int instanceIndex = entry.getKey();
         FragmentInstance fragmentInstance = instances.get(instanceIndex);
         fragmentInstance.getExecutorType().updatePreferredLocation(status.getRedirectNode());
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/FragmentInstanceDispatcherImpl.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/FragmentInstanceDispatcherImpl.java
index 724cbf8ae2..bf2e095720 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/FragmentInstanceDispatcherImpl.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/scheduler/FragmentInstanceDispatcherImpl.java
@@ -28,8 +28,6 @@ import org.apache.iotdb.commons.client.async.AsyncDataNodeInternalServiceClient;
 import org.apache.iotdb.commons.client.exception.ClientManagerException;
 import org.apache.iotdb.commons.client.sync.SyncDataNodeInternalServiceClient;
 import org.apache.iotdb.commons.consensus.ConsensusGroupId;
-import org.apache.iotdb.commons.partition.QueryExecutor;
-import org.apache.iotdb.commons.partition.StorageExecutor;
 import org.apache.iotdb.commons.service.metric.enums.PerformanceOverviewMetrics;
 import org.apache.iotdb.commons.utils.ThriftUtils;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
@@ -98,9 +96,10 @@ public class FragmentInstanceDispatcherImpl implements IFragInstanceDispatcher {
     this.writeOperationExecutor = writeOperationExecutor;
     this.syncInternalServiceClientManager = syncInternalServiceClientManager;
     this.asyncInternalServiceClientManager = asyncInternalServiceClientManager;
-    this.localEndPoint = new TEndPoint(
-        IoTDBDescriptor.getInstance().getConfig().getInternalAddress(),
-        IoTDBDescriptor.getInstance().getConfig().getInternalPort());
+    this.localEndPoint =
+        new TEndPoint(
+            IoTDBDescriptor.getInstance().getConfig().getInternalAddress(),
+            IoTDBDescriptor.getInstance().getConfig().getInternalPort());
   }
 
   @Override
@@ -373,7 +372,8 @@ public class FragmentInstanceDispatcherImpl implements IFragInstanceDispatcher {
 
         TSStatus status = writeResult.getStatus();
         if (!writeResult.isAccepted()) {
-          if (status == null || status.getCode() != TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) {
+          if (status == null
+              || status.getCode() != TSStatusCode.REDIRECTION_RECOMMEND.getStatusCode()) {
             logger.warn(
                 "write locally failed. TSStatus: {}, message: {}",
                 status,
@@ -405,6 +405,5 @@ public class FragmentInstanceDispatcherImpl implements IFragInstanceDispatcher {
   }
 
   @Override
-  public void abort() {
-  }
+  public void abort() {}
 }