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 2022/01/25 01:03:55 UTC

[GitHub] [ozone] umamaheswararao commented on a change in pull request #2990: HDDS-6184: EC: put command should create EC key if bucket is EC

umamaheswararao commented on a change in pull request #2990:
URL: https://github.com/apache/ozone/pull/2990#discussion_r791272779



##########
File path: hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/shell/keys/PutKeyHandler.java
##########
@@ -83,8 +87,20 @@ protected void execute(OzoneClient client, OzoneAddress address)
       }
     }
 
-    ReplicationConfig replicationConfig =
-        ReplicationConfig.parse(replicationType, replication, getConf());
+    String clientConfiguredDefaultType = getConf().get(OZONE_REPLICATION_TYPE);
+    if (replicationType == null && clientConfiguredDefaultType != null) {

Review comment:
       Good catch. I already moved these checks inside OzoneClientUtils.validateAndGetClientReplicationConfig. 
   There are just redundant here and removed them now.

##########
File path: hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java
##########
@@ -910,6 +910,27 @@ public void testCreateBucketWithECReplicationConfig() throws Exception {
     }
   }
 
+  @Test
+  public void testPutKeyOnBucketWithECReplicationConfig() throws Exception {
+    final String volumeName = "volume1000";
+    getVolume(volumeName);
+    String[] args =
+        new String[] {"bucket", "create", "/volume1000/bucket0", "-t", "EC",
+            "-r", "rs-3-2-1024k"};
+    execute(ozoneShell, args);
+
+    args = new String[] {"key", "put", "/volume1000/bucket0/newECKey1",
+        testFilePathString};
+    execute(ozoneShell, args);
+    OzoneVolume volume =
+        cluster.getClient().getObjectStore().getVolume(volumeName);
+    OzoneBucket bucket = volume.getBucket("bucket0");
+    try (OzoneOutputStream out = bucket.createKey("newECKey1", 1024)) {

Review comment:
       You are right. I supposed to reopen key and check type. I did that correction now. Thanks

##########
File path: hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java
##########
@@ -910,6 +910,27 @@ public void testCreateBucketWithECReplicationConfig() throws Exception {
     }
   }
 
+  @Test
+  public void testPutKeyOnBucketWithECReplicationConfig() throws Exception {
+    final String volumeName = "volume1000";
+    getVolume(volumeName);
+    String[] args =
+        new String[] {"bucket", "create", "/volume1000/bucket0", "-t", "EC",
+            "-r", "rs-3-2-1024k"};
+    execute(ozoneShell, args);
+
+    args = new String[] {"key", "put", "/volume1000/bucket0/newECKey1",
+        testFilePathString};
+    execute(ozoneShell, args);
+    OzoneVolume volume =
+        cluster.getClient().getObjectStore().getVolume(volumeName);
+    OzoneBucket bucket = volume.getBucket("bucket0");
+    try (OzoneOutputStream out = bucket.createKey("newECKey1", 1024)) {
+      Assert.assertTrue(out.getOutputStream().getClass().getName()

Review comment:
       changed this assert to check types now on KeyDetails.




-- 
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: issues-unsubscribe@ozone.apache.org

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



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