You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/02/26 08:38:35 UTC

[GitHub] [hadoop-ozone] ChenSammi commented on a change in pull request #590: HDDS-3049. Fix Replication factor passed in create API doesn't take effect

ChenSammi commented on a change in pull request #590: HDDS-3049. Fix Replication factor passed in create API doesn't take effect
URL: https://github.com/apache/hadoop-ozone/pull/590#discussion_r384339032
 
 

 ##########
 File path: hadoop-ozone/ozonefs/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java
 ##########
 @@ -210,13 +210,33 @@ protected void incrementCounter(Statistic objectsRead) {
   }
 
   @Override
-  public OzoneFSOutputStream createFile(String key, boolean overWrite,
+  public OzoneFSOutputStream createFile(String key,
+      short replication,
+      boolean overWrite,
       boolean recursive) throws IOException {
     incrementCounter(Statistic.OBJECTS_CREATED);
     try {
-      OzoneOutputStream ozoneOutputStream = bucket
-          .createFile(key, 0, replicationType, replicationFactor, overWrite,
-              recursive);
+      OzoneOutputStream ozoneOutputStream = null;
+      if (replication == ReplicationFactor.ONE.getValue()
+          || replication == ReplicationFactor.THREE.getValue()) {
+        ReplicationFactor clientReplication
+            = ReplicationFactor.valueOf(replication);
+        ozoneOutputStream = bucket.createFile(
+            key,
+            0,
+            replicationType,
+            clientReplication,
+            overWrite,
+            recursive);
+      } else {
+        ozoneOutputStream = bucket.createFile(
+            key,
+            0,
+            replicationType,
+            replicationFactor,
 
 Review comment:
   If the replicationFactor is 2, will the bucket create the key using system default replication here? 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org