You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/08/25 16:11:12 UTC

[GitHub] [iotdb] THUMarkLau opened a new pull request, #7136: [IOTDB-3455] Make data_region_num takes effect in new standalone

THUMarkLau opened a new pull request, #7136:
URL: https://github.com/apache/iotdb/pull/7136

   See [IOTDB-3455](https://issues.apache.org/jira/browse/IOTDB-3455).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] sonarcloud[bot] commented on pull request #7136: [IOTDB-3455] Make data_region_num takes effect in new standalone

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #7136:
URL: https://github.com/apache/iotdb/pull/7136#issuecomment-1244958322

   SonarCloud Quality Gate failed.&nbsp; &nbsp; [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache_incubator-iotdb&pullRequest=7136)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=BUG) [![B](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/B-16px.png 'B')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=BUG) [2 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=CODE_SMELL) [8 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=CODE_SMELL)
   
   [![73.4%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '73.4%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_coverage&view=list) [73.4% Coverage](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_duplicated_lines_density&view=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] xingtanzjr merged pull request #7136: [IOTDB-3455] Make data_region_num takes effect in new standalone

Posted by GitBox <gi...@apache.org>.
xingtanzjr merged PR #7136:
URL: https://github.com/apache/iotdb/pull/7136


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] xingtanzjr commented on a diff in pull request #7136: [IOTDB-3455] Make data_region_num takes effect in new standalone

Posted by GitBox <gi...@apache.org>.
xingtanzjr commented on code in PR #7136:
URL: https://github.com/apache/iotdb/pull/7136#discussion_r965819052


##########
server/src/main/java/org/apache/iotdb/db/localconfignode/LocalConfigNode.java:
##########
@@ -141,7 +141,7 @@ public class LocalConfigNode {
 
   private final StorageEngineV2 storageEngine = StorageEngineV2.getInstance();
 
-  private final LocalDataPartitionTable dataPartitionTable = LocalDataPartitionTable.getInstance();
+  private final LocalDataPartitionInfo dataPartitionTable = LocalDataPartitionInfo.getInstance();

Review Comment:
   Align the variable table with class name



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] coveralls commented on pull request #7136: [IOTDB-3455] Make data_region_num takes effect in new standalone

Posted by GitBox <gi...@apache.org>.
coveralls commented on PR #7136:
URL: https://github.com/apache/iotdb/pull/7136#issuecomment-1231603899

   
   [![Coverage Status](https://coveralls.io/builds/52060190/badge)](https://coveralls.io/builds/52060190)
   
   Coverage decreased (-0.2%) to 42.132% when pulling **d851cc93da6938b578ca5906ba315203ac0f3c13 on IOTDB-3455** into **be3a931847e4107c740aef7314086792331114ad on master**.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] THUMarkLau commented on a diff in pull request #7136: [IOTDB-3455] Make data_region_num takes effect in new standalone

Posted by GitBox <gi...@apache.org>.
THUMarkLau commented on code in PR #7136:
URL: https://github.com/apache/iotdb/pull/7136#discussion_r969099135


##########
server/src/main/java/org/apache/iotdb/db/localconfignode/LocalDataPartitionInfo.java:
##########
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.localconfignode;
+
+import org.apache.iotdb.commons.consensus.DataRegionId;
+import org.apache.iotdb.commons.exception.IllegalPathException;
+import org.apache.iotdb.commons.path.PartialPath;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+// This class is used for data partition maintaining the map between storage group and
+// dataRegionIds.
+public class LocalDataPartitionInfo {

Review Comment:
   In IoTDB ConfigNode, the DataPartitionTable and PartitionInfo classes are used to record the data partition, so this design is borrowed in LocalConfigNode. Table is global and records the mapping between a logical storage group and PartitionInfo. Info is one for each logical storage group and records the mapping between each device in the logical storage group and the DataRegion.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] xingtanzjr commented on a diff in pull request #7136: [IOTDB-3455] Make data_region_num takes effect in new standalone

Posted by GitBox <gi...@apache.org>.
xingtanzjr commented on code in PR #7136:
URL: https://github.com/apache/iotdb/pull/7136#discussion_r965844622


##########
server/src/main/java/org/apache/iotdb/db/localconfignode/DataRegionIdGenerator.java:
##########
@@ -0,0 +1,46 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.localconfignode;
+
+import org.apache.iotdb.commons.utils.TestOnly;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+public class DataRegionIdGenerator {

Review Comment:
   Maybe we can put this class as a private static class inner LocalDataPartitionInfo as it is only used there



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] xingtanzjr commented on a diff in pull request #7136: [IOTDB-3455] Make data_region_num takes effect in new standalone

Posted by GitBox <gi...@apache.org>.
xingtanzjr commented on code in PR #7136:
URL: https://github.com/apache/iotdb/pull/7136#discussion_r965845348


##########
server/src/main/java/org/apache/iotdb/db/localconfignode/LocalDataPartitionInfo.java:
##########
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.localconfignode;
+
+import org.apache.iotdb.commons.consensus.DataRegionId;
+import org.apache.iotdb.commons.exception.IllegalPathException;
+import org.apache.iotdb.commons.path.PartialPath;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+// This class is used for data partition maintaining the map between storage group and
+// dataRegionIds.
+public class LocalDataPartitionInfo {

Review Comment:
   Why do we split the original LocalDataPartitionTable into two classes `Info` and `Table` ?
   
   These two classes are a litter bit confusing because their names are similar



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] HTHou commented on pull request #7136: [IOTDB-3455] Make data_region_num takes effect in new standalone

Posted by GitBox <gi...@apache.org>.
HTHou commented on PR #7136:
URL: https://github.com/apache/iotdb/pull/7136#issuecomment-1228115522

   Spotless...


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] sonarcloud[bot] commented on pull request #7136: [IOTDB-3455] Make data_region_num takes effect in new standalone

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #7136:
URL: https://github.com/apache/iotdb/pull/7136#issuecomment-1231608133

   SonarCloud Quality Gate failed.&nbsp; &nbsp; [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache_incubator-iotdb&pullRequest=7136)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=BUG) [![B](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/B-16px.png 'B')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=BUG) [2 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=CODE_SMELL) [5 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=CODE_SMELL)
   
   [![54.4%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/50-16px.png '54.4%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_coverage&view=list) [54.4% Coverage](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_duplicated_lines_density&view=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] sonarcloud[bot] commented on pull request #7136: [IOTDB-3455] Make data_region_num takes effect in new standalone

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #7136:
URL: https://github.com/apache/iotdb/pull/7136#issuecomment-1245308716

   SonarCloud Quality Gate failed.&nbsp; &nbsp; [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache_incubator-iotdb&pullRequest=7136)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=BUG) [![B](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/B-16px.png 'B')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=BUG) [1 Bug](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=CODE_SMELL) [30 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=CODE_SMELL)
   
   [![70.2%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '70.2%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_coverage&view=list) [70.2% Coverage](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_duplicated_lines_density&view=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] xingtanzjr commented on a diff in pull request #7136: [IOTDB-3455] Make data_region_num takes effect in new standalone

Posted by GitBox <gi...@apache.org>.
xingtanzjr commented on code in PR #7136:
URL: https://github.com/apache/iotdb/pull/7136#discussion_r965820256


##########
server/src/main/java/org/apache/iotdb/db/localconfignode/LocalConfigNode.java:
##########
@@ -950,7 +942,9 @@ public Map<String, Map<TSeriesPartitionSlot, TRegionReplicaSet>> getOrCreateSche
     return partitionSlotsMap;
   }
 
-  // endregion
+  private List<DataRegionId> getAllRegionForOneSg(PartialPath storageGroup) {

Review Comment:
   unused method



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] sonarcloud[bot] commented on pull request #7136: [IOTDB-3455] Make data_region_num takes effect in new standalone

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #7136:
URL: https://github.com/apache/iotdb/pull/7136#issuecomment-1245758119

   Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; [![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')](https://sonarcloud.io/dashboard?id=apache_incubator-iotdb&pullRequest=7136)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=CODE_SMELL) [5 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=CODE_SMELL)
   
   [![81.4%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '81.4%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_coverage&view=list) [81.4% Coverage](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_duplicated_lines_density&view=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] sonarcloud[bot] commented on pull request #7136: [IOTDB-3455] Make data_region_num takes effect in new standalone

Posted by GitBox <gi...@apache.org>.
sonarcloud[bot] commented on PR #7136:
URL: https://github.com/apache/iotdb/pull/7136#issuecomment-1237597632

   SonarCloud Quality Gate failed.&nbsp; &nbsp; [![Quality Gate failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/failed-16px.png 'Quality Gate failed')](https://sonarcloud.io/dashboard?id=apache_incubator-iotdb&pullRequest=7136)
   
   [![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=BUG) [![B](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/B-16px.png 'B')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=BUG) [2 Bugs](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=BUG)  
   [![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=VULNERABILITY)  
   [![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=SECURITY_HOTSPOT)  
   [![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=CODE_SMELL) [5 Code Smells](https://sonarcloud.io/project/issues?id=apache_incubator-iotdb&pullRequest=7136&resolved=false&types=CODE_SMELL)
   
   [![85.6%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/60-16px.png '85.6%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_coverage&view=list) [85.6% Coverage](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_coverage&view=list)  
   [![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=apache_incubator-iotdb&pullRequest=7136&metric=new_duplicated_lines_density&view=list)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [iotdb] xingtanzjr commented on a diff in pull request #7136: [IOTDB-3455] Make data_region_num takes effect in new standalone

Posted by GitBox <gi...@apache.org>.
xingtanzjr commented on code in PR #7136:
URL: https://github.com/apache/iotdb/pull/7136#discussion_r965852077


##########
server/src/main/java/org/apache/iotdb/db/localconfignode/LocalDataPartitionTable.java:
##########
@@ -19,116 +19,72 @@
 
 package org.apache.iotdb.db.localconfignode;
 
+import org.apache.iotdb.commons.consensus.ConsensusGroupId;
 import org.apache.iotdb.commons.consensus.DataRegionId;
-import org.apache.iotdb.commons.exception.IllegalPathException;
 import org.apache.iotdb.commons.path.PartialPath;
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
 
-import java.util.ArrayList;
-import java.util.Collections;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Arrays;
+import java.util.Comparator;
 import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.atomic.AtomicInteger;
 
-// This class is used for data partition maintaining the map between storage group and
-// dataRegionIds.
 public class LocalDataPartitionTable {
-
-  private AtomicInteger dataRegionIdGenerator;
-
-  private Map<PartialPath, List<DataRegionId>> table;
-
-  private static class LocalDataPartitionTableHolder {
-    private static final LocalDataPartitionTable INSTANCE = new LocalDataPartitionTable();
-
-    private LocalDataPartitionTableHolder() {};
-  }
-
-  private LocalDataPartitionTable() {}
-
-  public static LocalDataPartitionTable getInstance() {
-    return LocalDataPartitionTableHolder.INSTANCE;
-  }
-
-  public synchronized void init(Map<String, List<DataRegionId>> recoveredLocalDataRegionInfo)
-      throws IllegalPathException {
-    table = new ConcurrentHashMap<>();
-    dataRegionIdGenerator = new AtomicInteger(0);
-    for (Map.Entry<String, List<DataRegionId>> entry : recoveredLocalDataRegionInfo.entrySet()) {
-      String storageGroup = entry.getKey();
-      List<DataRegionId> dataRegionIdList = new CopyOnWriteArrayList<>();
-      table.put(new PartialPath(storageGroup), dataRegionIdList);
-      for (DataRegionId dataRegionId : recoveredLocalDataRegionInfo.get(storageGroup)) {
-        dataRegionIdList.add(dataRegionId);
-
-        if (dataRegionId.getId() >= dataRegionIdGenerator.get()) {
-          dataRegionIdGenerator.set(dataRegionId.getId() + 1);
-        }
-      }
+  private static final Logger LOG = LoggerFactory.getLogger(LocalDataPartitionTable.class);
+
+  private String storageGroupName;
+  private final int regionNum;
+  private DataRegionId[] regionIds;
+
+  public LocalDataPartitionTable(String storageGroupName, List<DataRegionId> regions) {
+    this.storageGroupName = storageGroupName;
+    this.regionNum = regions.size();
+    regions.sort(Comparator.comparingInt(ConsensusGroupId::getId));
+    this.regionIds = new DataRegionId[regions.size()];
+    for (int i = 0; i < regions.size(); ++i) {
+      regionIds[i] = regions.get(i);
     }
   }
 
-  public synchronized void clear() {
-    if (table != null) {
-      table.clear();
-      table = null;
-    }
-
-    if (dataRegionIdGenerator != null) {
-      dataRegionIdGenerator = null;
-    }
-  }
-
-  public synchronized void putDataRegionId(PartialPath storageGroup, DataRegionId dataRegionId) {
-    table.get(storageGroup).add(dataRegionId);
-  }
-
-  public synchronized void removeDataRegionId(PartialPath storageGroup, DataRegionId dataRegionId) {
-    table.get(storageGroup).remove(dataRegionId);
-  }
-
-  public DataRegionId getDataRegionId(PartialPath storageGroup, PartialPath path) {
-    if (!table.containsKey(storageGroup)) {
-      return null;
-    }
-    return table.get(storageGroup).get(0);
-  }
-
-  public List<DataRegionId> getInvolvedDataRegionIds(
-      PartialPath storageGroup, PartialPath pathPattern, boolean isPrefixMatch) {
-    List<DataRegionId> result = new ArrayList<>();
-    if (table.containsKey(storageGroup)) {
-      result.addAll(table.get(storageGroup));
-    }
-    return result;
+  public LocalDataPartitionTable(String storageGroupName) {
+    this.storageGroupName = storageGroupName;
+    this.regionNum = IoTDBDescriptor.getInstance().getConfig().getDataRegionNum();
+    this.regionIds = new DataRegionId[regionNum];
   }
 
-  public List<DataRegionId> getDataRegionIdsByStorageGroup(PartialPath storageGroup) {
-    return table.getOrDefault(storageGroup, Collections.emptyList());
+  /**
+   * Get the data region id which the path located in.
+   *
+   * @param path The full path for the series.
+   * @return The region id for the path.
+   */
+  public DataRegionId getDataRegionId(PartialPath path) {
+    int idx = Math.abs(path.hashCode()) % regionNum;

Review Comment:
   We need to use a common method to calculate the `index` for partition algorithm to avoid the inconsistent calculation ways in other places such as line 78.
   
   Furthermore, the Math.abs(path.hashCode()) may generate negative value so it is not safe here. Try to use a more safe way to calculate the index



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org