You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by xy...@apache.org on 2020/01/16 23:49:14 UTC

[hadoop-ozone] branch master updated: HDDS-2866. Intermittent failure in TestOzoneManagerRocksDBLogging (#427)

This is an automated email from the ASF dual-hosted git repository.

xyao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 1caf1e3  HDDS-2866. Intermittent failure in TestOzoneManagerRocksDBLogging (#427)
1caf1e3 is described below

commit 1caf1e30865aa2b380a7fca6d87f5ae8034fee4e
Author: Doroszlai, Attila <64...@users.noreply.github.com>
AuthorDate: Fri Jan 17 00:49:04 2020 +0100

    HDDS-2866. Intermittent failure in TestOzoneManagerRocksDBLogging (#427)
---
 .../ozone/om/TestOzoneManagerRocksDBLogging.java   | 46 ++++++++++------------
 1 file changed, 21 insertions(+), 25 deletions(-)

diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerRocksDBLogging.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerRocksDBLogging.java
index 5ca2eea..2fa87b9 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerRocksDBLogging.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerRocksDBLogging.java
@@ -19,7 +19,6 @@
 
 package org.apache.hadoop.ozone.om;
 
-import java.util.UUID;
 import java.util.concurrent.TimeoutException;
 
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
@@ -39,24 +38,18 @@ import org.junit.rules.Timeout;
 public class TestOzoneManagerRocksDBLogging {
   private MiniOzoneCluster cluster = null;
   private OzoneConfiguration conf;
-  private String clusterId;
-  private String scmId;
-  private String omId;
 
   @Rule
   public Timeout timeout = new Timeout(60000);
 
+  private static GenericTestUtils.LogCapturer logCapturer =
+      GenericTestUtils.LogCapturer.captureLogs(DBStoreBuilder.ROCKS_DB_LOGGER);
+
   @Before
   public void init() throws Exception {
     conf = new OzoneConfiguration();
-    conf.set("hadoop.hdds.db.rocksdb.logging.enabled", "true");
-    clusterId = UUID.randomUUID().toString();
-    scmId = UUID.randomUUID().toString();
-    omId = UUID.randomUUID().toString();
+    enableRocksDbLogging(false);
     cluster =  MiniOzoneCluster.newBuilder(conf)
-        .setClusterId(clusterId)
-        .setScmId(scmId)
-        .setOmId(omId)
         .build();
     cluster.waitForClusterToBeReady();
   }
@@ -73,25 +66,28 @@ public class TestOzoneManagerRocksDBLogging {
 
   @Test
   public void testOMRocksDBLoggingEnabled() throws Exception {
+    try {
+      waitForRocksDbLog();
+      Assert.fail("Unexpected RocksDB log: " + logCapturer.getOutput());
+    } catch (TimeoutException ex) {
+      Assert.assertTrue(ex.getMessage().contains("Timed out"));
+    }
 
-    GenericTestUtils.LogCapturer logCapturer = GenericTestUtils.LogCapturer
-        .captureLogs(DBStoreBuilder.ROCKS_DB_LOGGER);
+    enableRocksDbLogging(true);
     cluster.restartOzoneManager();
+
+    waitForRocksDbLog();
+  }
+
+  private void enableRocksDbLogging(boolean b) {
+    conf.setBoolean("hadoop.hdds.db.rocksdb.logging.enabled", b);
+  }
+
+  private static void waitForRocksDbLog()
+      throws TimeoutException, InterruptedException {
     GenericTestUtils.waitFor(() -> logCapturer.getOutput()
             .contains("db_impl.cc"),
         1000, 10000);
-
-    cluster.getConf().set("hadoop.hdds.db.rocksdb.logging.enabled", "false");
-    cluster.restartOzoneManager();
-    logCapturer.clearOutput();
-    try {
-      GenericTestUtils.waitFor(() -> logCapturer.getOutput()
-              .contains("db_impl.cc"),
-          1000, 10000);
-      Assert.fail();
-    } catch (TimeoutException ex) {
-      Assert.assertTrue(ex.getMessage().contains("Timed out"));
-    }
   }
 
 }


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