You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/11/23 22:25:35 UTC

[GitHub] [pinot] Jackie-Jiang commented on a diff in pull request #9849: Combine the read access for replication config

Jackie-Jiang commented on code in PR #9849:
URL: https://github.com/apache/pinot/pull/9849#discussion_r1030839172


##########
pinot-spi/src/main/java/org/apache/pinot/spi/config/table/TableConfig.java:
##########
@@ -354,4 +356,31 @@ public Map<String, SegmentAssignmentConfig> getSegmentAssignmentConfigMap() {
   public void setSegmentAssignmentConfigMap(Map<String, SegmentAssignmentConfig> segmentAssignmentConfigMap) {
     _segmentAssignmentConfigMap = segmentAssignmentConfigMap;
   }
+
+  @JsonIgnore
+  public int getReplicationNumber() {
+    Preconditions.checkNotNull(_validationConfig, "Validation config should not be null.");

Review Comment:
   (minor) This check is redundant. It is already checked in the constructor



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java:
##########
@@ -813,7 +813,7 @@ public String getTableAggregateMetadata(
     TableConfig tableConfig = _pinotHelixResourceManager.getTableConfig(tableNameWithType);
     SegmentsValidationAndRetentionConfig segmentsConfig =
         tableConfig != null ? tableConfig.getValidationConfig() : null;
-    int numReplica = segmentsConfig == null ? 1 : Integer.parseInt(segmentsConfig.getReplication());
+    int numReplica = segmentsConfig == null ? 1 : tableConfig.getReplicationNumber();

Review Comment:
   ```suggestion
       int numReplica = tableConfig == null ? 1 : tableConfig.getReplicationNumber();
   ```



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotTableRestletResource.java:
##########
@@ -813,7 +813,7 @@ public String getTableAggregateMetadata(
     TableConfig tableConfig = _pinotHelixResourceManager.getTableConfig(tableNameWithType);
     SegmentsValidationAndRetentionConfig segmentsConfig =

Review Comment:
   Remove this line?



##########
pinot-spi/src/main/java/org/apache/pinot/spi/config/table/SegmentsValidationAndRetentionConfig.java:
##########
@@ -124,6 +124,9 @@ public void setSegmentPushType(String segmentPushType) {
     _segmentPushType = segmentPushType;
   }
 
+  /**

Review Comment:
   Don't deprecate them. The one in table config is just a helper method. They are also needed for json ser/de



##########
pinot-spi/src/main/java/org/apache/pinot/spi/config/table/TableConfig.java:
##########
@@ -354,4 +356,31 @@ public Map<String, SegmentAssignmentConfig> getSegmentAssignmentConfigMap() {
   public void setSegmentAssignmentConfigMap(Map<String, SegmentAssignmentConfig> segmentAssignmentConfigMap) {
     _segmentAssignmentConfigMap = segmentAssignmentConfigMap;
   }
+
+  @JsonIgnore
+  public int getReplicationNumber() {

Review Comment:
   (minor) Rename to `getReplication()`



-- 
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: commits-unsubscribe@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org