cameronlee314 commented on a change in pull request #1157: SAMZA-2325 : Adding 
logic to read system config for repl-factor when creating a topic
URL: https://github.com/apache/samza/pull/1157#discussion_r325376637
 
 

 ##########
 File path: 
samza-kafka/src/main/java/org/apache/samza/system/kafka/KafkaSystemAdmin.java
 ##########
 @@ -546,6 +546,19 @@ public KafkaStreamSpec toKafkaSpec(StreamSpec spec) {
       kafkaSpec = kafkaSpec.copyWithProperties(properties);
     } else {
       kafkaSpec = KafkaStreamSpec.fromSpec(spec);
+
+      // we check if there is a system-level rf config specified, else we use 
KafkaConfig.topic-default-rf
+      int replicationFactorFromSystemConfig = Integer.valueOf(
+          new 
KafkaConfig(config).getSystemDefaultReplicationFactor(spec.getSystemName(),
+              KafkaConfig.TOPIC_DEFAULT_REPLICATION_FACTOR()));
+
+      LOG.info("Using replication-factor: {} for StreamSpec: {}", 
replicationFactorFromSystemConfig, spec);
+
+      return new KafkaStreamSpec( kafkaSpec.getId(),
+          kafkaSpec.getPhysicalName(),
+          kafkaSpec.getSystemName(),
+          kafkaSpec.getPartitionCount(),
+          replicationFactorFromSystemConfig,kafkaSpec.getProperties());
 
 Review comment:
   Minor: whitespace and/or newline

----------------------------------------------------------------
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

Reply via email to