sadanand48 commented on code in PR #7164:
URL: https://github.com/apache/ozone/pull/7164#discussion_r1750384310


##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicOzoneClientAdapterImpl.java:
##########
@@ -811,4 +817,36 @@ public boolean setSafeMode(SafeModeAction action, boolean 
isChecked)
     return ozoneClient.getProxy().getOzoneManagerClient().setSafeMode(
         action, isChecked);
   }
+
+  @Override
+  public void setReplication(String key, short replication) throws IOException 
{
+    OzoneKeyDetails keyDetails = null;

Review Comment:
   Done.



##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/fs/ozone/AbstractOzoneFileSystemTest.java:
##########
@@ -2289,4 +2293,30 @@ void testSnapshotRead() throws Exception {
     assertEquals(2, f2.length);
     assertEquals(3, f3.length);
   }
+
+  @Test
+  public void testSetReplication() throws IOException {
+    String testKeyName = "testKey" + RandomStringUtils.randomNumeric(4);
+    Path testKeyPath = new Path("/" + testKeyName);
+    try (OzoneOutputStream outputStream = client.getObjectStore()
+        .getVolume(volumeName).getBucket(bucketName)
+        .createKey(testKeyName, 1,
+            
RatisReplicationConfig.getInstance(HddsProtos.ReplicationFactor.ONE),
+            new HashMap<>())) {
+      outputStream.write(RandomUtils.nextBytes(1));
+    }
+    OzoneKeyDetails key = getKey(testKeyPath, false);
+    assertEquals(HddsProtos.ReplicationType.RATIS,
+        key.getReplicationConfig().getReplicationType());
+    assertEquals(ReplicationFactor.ONE.toString(),
+        key.getReplicationConfig().getReplication());
+    o3fs.setReplication(testKeyPath, (short) 3);
+    key = getKey(testKeyPath, false);
+    assertEquals(ReplicationFactor.THREE.toString(),
+        key.getReplicationConfig().getReplication());
+    IOException exception = assertThrows(IOException.class,
+        () -> o3fs.setReplication(testKeyPath, (short) 5),
+        "Does not throw IOException");
+    assertTrue(exception.getMessage().contains("not supported"));

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]

Reply via email to