adoroszlai commented on code in PR #9320:
URL: https://github.com/apache/ozone/pull/9320#discussion_r2593416172


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHAWithFollowerRead.java:
##########
@@ -68,4 +68,27 @@ public void testAllowLeaderSkipLinearizableRead() throws 
Exception {
 
     getCluster().getOMLeader().setConfiguration(oldConf);
   }
+
+  @Test
+  public void testAllowFollowerReadLocalLease() throws Exception {
+    OzoneConfiguration oldConf = getCluster().getConf();
+    OzoneConfiguration newConf1 = new OzoneConfiguration(oldConf);
+    newConf1.setBoolean("ozone.om.follower.read.local.lease.enabled", true);
+    OzoneConfiguration newConf2 = new OzoneConfiguration(newConf1);
+    newConf2.setLong("ozone.om.follower.read.local.lease.time.ms", -1000);
+
+    getCluster().getOzoneManager(1).setConfiguration(newConf1);
+    getCluster().getOzoneManager(2).setConfiguration(newConf2);
+
+    String[] args = new String[] {"volume", "list"};
+    for (int i = 0; i < 100; i++) {
+      execute(getOzoneShell(), args);
+    }
+    
Assertions.assertTrue(getCluster().getOzoneManager(1).getMetrics().getNumFollowerReadLocalLeaseSuccess()
 > 0);
+    Assertions.assertEquals(0, 
getCluster().getOzoneManager(2).getMetrics().getNumFollowerReadLocalLeaseSuccess());
+    
Assertions.assertTrue(getCluster().getOzoneManager(2).getMetrics().getNumFollowerReadLocalLeaseFailTime()
 > 0);

Review Comment:
   nit, can be fixed in follow-up
   
   - please use `assertThat(...).isPositive()` instead of `assertTrue(... > 0)`
   - please add `import static` for `assert...`



##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHAWithFollowerRead.java:
##########
@@ -68,4 +68,27 @@ public void testAllowLeaderSkipLinearizableRead() throws 
Exception {
 
     getCluster().getOMLeader().setConfiguration(oldConf);
   }
+
+  @Test
+  public void testAllowFollowerReadLocalLease() throws Exception {
+    OzoneConfiguration oldConf = getCluster().getConf();
+    OzoneConfiguration newConf1 = new OzoneConfiguration(oldConf);
+    newConf1.setBoolean("ozone.om.follower.read.local.lease.enabled", true);
+    OzoneConfiguration newConf2 = new OzoneConfiguration(newConf1);
+    newConf2.setLong("ozone.om.follower.read.local.lease.time.ms", -1000);
+
+    getCluster().getOzoneManager(1).setConfiguration(newConf1);
+    getCluster().getOzoneManager(2).setConfiguration(newConf2);
+
+    String[] args = new String[] {"volume", "list"};
+    for (int i = 0; i < 100; i++) {
+      execute(getOzoneShell(), args);
+    }
+    
Assertions.assertTrue(getCluster().getOzoneManager(1).getMetrics().getNumFollowerReadLocalLeaseSuccess()
 > 0);
+    Assertions.assertEquals(0, 
getCluster().getOzoneManager(2).getMetrics().getNumFollowerReadLocalLeaseSuccess());
+    
Assertions.assertTrue(getCluster().getOzoneManager(2).getMetrics().getNumFollowerReadLocalLeaseFailTime()
 > 0);
+
+    getCluster().getOzoneManager(1).setConfiguration(oldConf);
+    getCluster().getOzoneManager(2).setConfiguration(oldConf);

Review Comment:
   nit, can be fixed in follow-up
   
   Restore original state in `finally` block.



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