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 2020/12/21 13:01:51 UTC

[iotdb] branch master updated: fix ArithmeticException (#2284)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new eed2a4a  fix ArithmeticException (#2284)
eed2a4a is described below

commit eed2a4a8c2e810e8551247e105db80c57d4206a9
Author: chaow <ru...@foxmail.com>
AuthorDate: Mon Dec 21 21:01:34 2020 +0800

    fix ArithmeticException (#2284)
---
 cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java b/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java
index 4d87317..f7472f2 100644
--- a/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java
+++ b/cluster/src/main/java/org/apache/iotdb/cluster/ClusterMain.java
@@ -278,7 +278,7 @@ public class ClusterMain {
   @SuppressWarnings("java:S125") // leaving examples
   private static void preStartCustomize() {
     // customize data distribution
-    // The given example tries to divide storage groups like "root.sg_0", "root.sg_1"... into k
+    // The given example tries to divide storage groups like "root.sg_1", "root.sg_2"... into k
     // nodes evenly, and use default strategy for other groups
     SlotPartitionTable.setSlotStrategy(new SlotStrategy() {
       SlotStrategy defaultStrategy = new SlotStrategy.DefaultStrategy();
@@ -286,7 +286,7 @@ public class ClusterMain {
       @Override
       public int calculateSlotByTime(String storageGroupName, long timestamp, int maxSlotNum) {
         int sgSerialNum = extractSerialNumInSGName(storageGroupName) % k;
-        if (sgSerialNum >= 0) {
+        if (sgSerialNum > 0) {
           return maxSlotNum / k * sgSerialNum;
         } else {
           return defaultStrategy.calculateSlotByTime(storageGroupName, timestamp, maxSlotNum);
@@ -297,7 +297,7 @@ public class ClusterMain {
       public int calculateSlotByPartitionNum(String storageGroupName, long partitionId,
           int maxSlotNum) {
         int sgSerialNum = extractSerialNumInSGName(storageGroupName) % k;
-        if (sgSerialNum >= 0) {
+        if (sgSerialNum > 0) {
           return maxSlotNum / k * sgSerialNum;
         } else {
           return defaultStrategy.calculateSlotByPartitionNum(storageGroupName, partitionId, maxSlotNum);