aryangupta1998 commented on code in PR #10157:
URL: https://github.com/apache/ozone/pull/10157#discussion_r3440879011
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/BackgroundPipelineCreator.java:
##########
@@ -255,6 +236,59 @@ private void createPipelines() throws RuntimeException {
LOG.debug("BackgroundPipelineCreator createPipelines finished.");
}
+ @VisibleForTesting
+ List<ReplicationConfig> getReplicationConfigs(boolean autoCreateFactorOne) {
+ List<ReplicationConfig> list = new ArrayList<>();
+ ReplicationConfig defaultReplicationConfig = getDefaultReplicationConfig();
+ if (defaultReplicationConfig == null) {
+ LOG.warn("Skipping background pipeline creation: default replication "
+ + "config is invalid.");
+ return list;
+ }
+ // TODO: #CLUTIL Different replication factor may need to be supported
+ HddsProtos.ReplicationType type =
+ defaultReplicationConfig.getReplicationType();
+ if (type == EC) {
+ if (createRatisThreeForEcDefault) {
+ list.add(ReplicationConfig.fromProtoTypeAndFactor(RATIS,
+ ReplicationFactor.THREE));
+ }
+ return list;
+ }
+
+ for (HddsProtos.ReplicationFactor factor
+ : HddsProtos.ReplicationFactor.values()) {
+ if (factor == ReplicationFactor.ZERO) {
+ continue; // Ignore it.
+ }
+ final ReplicationConfig replicationConfig =
+ ReplicationConfig.fromProtoTypeAndFactor(type, factor);
+ if (skipCreation(replicationConfig, autoCreateFactorOne)) {
+ // Skip this iteration for creating pipeline
+ continue;
+ }
+ if (!list.contains(replicationConfig)) {
+ list.add(replicationConfig);
+ }
+ }
+ return list;
+ }
+
+ private ReplicationConfig getDefaultReplicationConfig() {
Review Comment:
Done
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]