You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by bb...@apache.org on 2023/02/08 15:57:07 UTC

[hbase] branch branch-2 updated: HBASE-27534 Addendum fix test crash (#5011)

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

bbeaudreault pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2 by this push:
     new 3436ab9d299 HBASE-27534 Addendum fix test crash (#5011)
3436ab9d299 is described below

commit 3436ab9d29905c77a37e39ff524d1633f28aedac
Author: Bryan Beaudreault <bb...@apache.org>
AuthorDate: Tue Feb 7 17:05:01 2023 -0500

    HBASE-27534 Addendum fix test crash (#5011)
---
 .../hadoop/hbase/namequeues/TestTooLargeLog.java   | 32 ++++++++++++++++------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/namequeues/TestTooLargeLog.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/namequeues/TestTooLargeLog.java
index d865131deb8..7aaeecb95c3 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/namequeues/TestTooLargeLog.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/namequeues/TestTooLargeLog.java
@@ -36,9 +36,11 @@ import org.apache.hadoop.hbase.client.ResultScanner;
 import org.apache.hadoop.hbase.client.Scan;
 import org.apache.hadoop.hbase.client.ServerType;
 import org.apache.hadoop.hbase.client.Table;
+import org.apache.hadoop.hbase.regionserver.HRegionServer;
 import org.apache.hadoop.hbase.testclassification.MediumTests;
 import org.apache.hadoop.hbase.testclassification.RegionServerTests;
 import org.apache.hadoop.hbase.util.Bytes;
+import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.ClassRule;
 import org.junit.Rule;
@@ -61,27 +63,42 @@ public class TestTooLargeLog {
 
   @BeforeClass
   public static void setUpBeforeClass() throws Exception {
+    // Slow log needs to be enabled initially to spin up the SlowLogQueueService
     TEST_UTIL.getConfiguration().setBoolean(HConstants.SLOW_LOG_BUFFER_ENABLED_KEY, true);
-    TEST_UTIL.getConfiguration().setInt("hbase.ipc.warn.response.size", 100);
+    TEST_UTIL.getConfiguration().setInt("hbase.ipc.warn.response.size",
+      HConstants.DEFAULT_BLOCKSIZE / 2);
     TEST_UTIL.startMiniCluster(1);
     ADMIN = TEST_UTIL.getAdmin();
   }
 
+  @AfterClass
+  public static void afterClass() throws Exception {
+    TEST_UTIL.shutdownMiniCluster();
+  }
+
   /**
    * Tests that we can trigger based on blocks scanned, and also that we properly pass the block
    * bytes scanned value through to the client.
    */
   @Test
-  public void testLogLargeBlockBytesScanned() throws IOException, InterruptedException {
+  public void testLogLargeBlockBytesScanned() throws IOException {
+    // Turn off slow log buffer for initial loadTable, because we were seeing core dump
+    // issues coming from that slow log entry. We will re-enable below.
+    HRegionServer regionServer = TEST_UTIL.getHBaseCluster().getRegionServer(0);
+    regionServer.getConfiguration().setBoolean(HConstants.SLOW_LOG_BUFFER_ENABLED_KEY, false);
+    regionServer.updateConfiguration();
+
     byte[] family = Bytes.toBytes("0");
     Table table = TEST_UTIL.createTable(TableName.valueOf("testLogLargeBlockBytesScanned"), family);
     TEST_UTIL.loadTable(table, family);
     TEST_UTIL.flush(table.getName());
 
-    Set<ServerName> server =
-      Collections.singleton(TEST_UTIL.getHBaseCluster().getRegionServer(0).getServerName());
+    Set<ServerName> server = Collections.singleton(regionServer.getServerName());
     Admin admin = TEST_UTIL.getAdmin();
-    admin.clearSlowLogResponses(server);
+
+    // Turn on slow log so we capture large scan below
+    regionServer.getConfiguration().setBoolean(HConstants.SLOW_LOG_BUFFER_ENABLED_KEY, true);
+    regionServer.updateConfiguration();
 
     Scan scan = new Scan();
     scan.setCaching(1);
@@ -90,13 +107,12 @@ public class TestTooLargeLog {
       scanner.next();
     }
 
-    List<LogEntry> entries =
-      admin.getLogEntries(server, "LARGE_LOG", ServerType.REGION_SERVER, 1, Collections.emptyMap());
+    List<LogEntry> entries = admin.getLogEntries(server, "LARGE_LOG", ServerType.REGION_SERVER, 100,
+      Collections.emptyMap());
 
     assertEquals(1, entries.size());
 
     OnlineLogRecord record = (OnlineLogRecord) entries.get(0);
-    System.out.println(record.toJsonPrettyPrint());
 
     assertTrue("expected " + record.getBlockBytesScanned() + " to be >= 100",
       record.getBlockBytesScanned() >= 100);