mcvsubbu commented on a change in pull request #4193: Creation/deletion flow 
for replica groups sets in realtime
URL: https://github.com/apache/incubator-pinot/pull/4193#discussion_r284057394
 
 

 ##########
 File path: 
pinot-core/src/main/java/org/apache/pinot/core/util/ReplicationUtils.java
 ##########
 @@ -0,0 +1,68 @@
+/**
+ * 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.pinot.core.util;
+
+import org.apache.pinot.common.config.SegmentsValidationAndRetentionConfig;
+import org.apache.pinot.common.config.TableConfig;
+import org.apache.pinot.common.utils.CommonConstants.Helix.TableType;
+import org.apache.pinot.core.realtime.stream.StreamConfig;
+
+
+/**
+ * Methods related to replication
+ */
+public class ReplicationUtils {
+
+  /**
+   * Decides if {@link 
SegmentsValidationAndRetentionConfig::getReplicationNumber} should be used
+   */
+  public static boolean useReplication(TableConfig tableConfig) {
+
+    TableType tableType = tableConfig.getTableType();
+    if (tableType.equals(TableType.REALTIME)) {
+      StreamConfig streamConfig = new 
StreamConfig(tableConfig.getIndexingConfig().getStreamConfigs());
+      return streamConfig.hasHighLevelConsumerType();
+    }
+    return true;
+  }
+
+  /**
+   * Decides if {@link 
SegmentsValidationAndRetentionConfig::getReplicasPerPartitionNumber} should be 
used
+   */
+  public static boolean useReplicasPerPartition(TableConfig tableConfig) {
 
 Review comment:
   Good question, and good to add comments here to reflect the reason for this.
   The config setting 'replication' is used in HLC to support 'split' kafka 
topics. So, if we have 6 realtime servers, and the 'replication' is 3, then 
each realtime server will receive half of the events in a topic.  See 
PinotTableIdealStateBuilder.setuoInstanceConfigForHighLevelConsumer() 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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to