You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2020/06/28 04:12:14 UTC

[GitHub] [hbase] saintstack commented on a change in pull request #1987: HBASE-24646 Set the log level for ScheduledChore to INFO in HBTU

saintstack commented on a change in pull request #1987:
URL: https://github.com/apache/hbase/pull/1987#discussion_r446597627



##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
##########
@@ -1106,22 +1108,24 @@ public MiniHBaseCluster startMiniHBaseCluster(StartMiniClusterOption option)
       conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MAXTOSTART, option.getNumRegionServers());
     }
 
+    // Avoid log flooded with chore execution time, see HBASE-24646 for more details.
+    Log4jUtils.setLogLevel(org.apache.hadoop.hbase.ScheduledChore.class.getName(), "INFO");
+
     Configuration c = new Configuration(this.conf);
     TraceUtil.initTracer(c);
-    this.hbaseCluster =
-        new MiniHBaseCluster(c, option.getNumMasters(), option.getNumAlwaysStandByMasters(),
-            option.getNumRegionServers(), option.getRsPorts(), option.getMasterClass(),
-            option.getRsClass());
+    this.hbaseCluster = new MiniHBaseCluster(c, option.getNumMasters(),
+      option.getNumAlwaysStandByMasters(), option.getNumRegionServers(), option.getRsPorts(),
+      option.getMasterClass(), option.getRsClass());
     // Populate the master address configuration from mini cluster configuration.
     conf.set(HConstants.MASTER_ADDRS_KEY, MasterRegistry.getMasterAddr(c));
     // Don't leave here till we've done a successful scan of the hbase:meta
-    Table t = getConnection().getTable(TableName.META_TABLE_NAME);
-    ResultScanner s = t.getScanner(new Scan());
-    while (s.next() != null) {
-      continue;
+    try (Table t = getConnection().getTable(TableName.META_TABLE_NAME);
+      ResultScanner s = t.getScanner(new Scan())) {
+      while (s.next() != null) {
+        continue;

Review comment:
       I like 'continue' instead of empty loop.

##########
File path: hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java
##########
@@ -1106,22 +1108,24 @@ public MiniHBaseCluster startMiniHBaseCluster(StartMiniClusterOption option)
       conf.setInt(ServerManager.WAIT_ON_REGIONSERVERS_MAXTOSTART, option.getNumRegionServers());
     }
 
+    // Avoid log flooded with chore execution time, see HBASE-24646 for more details.
+    Log4jUtils.setLogLevel(org.apache.hadoop.hbase.ScheduledChore.class.getName(), "INFO");
+
     Configuration c = new Configuration(this.conf);
     TraceUtil.initTracer(c);
-    this.hbaseCluster =
-        new MiniHBaseCluster(c, option.getNumMasters(), option.getNumAlwaysStandByMasters(),
-            option.getNumRegionServers(), option.getRsPorts(), option.getMasterClass(),
-            option.getRsClass());
+    this.hbaseCluster = new MiniHBaseCluster(c, option.getNumMasters(),
+      option.getNumAlwaysStandByMasters(), option.getNumRegionServers(), option.getRsPorts(),
+      option.getMasterClass(), option.getRsClass());
     // Populate the master address configuration from mini cluster configuration.
     conf.set(HConstants.MASTER_ADDRS_KEY, MasterRegistry.getMasterAddr(c));
     // Don't leave here till we've done a successful scan of the hbase:meta
-    Table t = getConnection().getTable(TableName.META_TABLE_NAME);
-    ResultScanner s = t.getScanner(new Scan());
-    while (s.next() != null) {
-      continue;
+    try (Table t = getConnection().getTable(TableName.META_TABLE_NAME);
+      ResultScanner s = t.getScanner(new Scan())) {
+      while (s.next() != null) {
+        continue;

Review comment:
       ... makes the intent clear.




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