@Test
  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(regionServer.getServerName());
    Admin admin = TEST_UTIL.getAdmin();

    // 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);

    try (ResultScanner scanner = table.getScanner(scan)) {
      scanner.next();
    }

    List<LogEntry> entries = admin.getLogEntries(server, "LARGE_LOG", ServerType.REGION_SERVER, 100,
      Collections.emptyMap());

    assertEquals(1, entries.size());

    OnlineLogRecord record = (OnlineLogRecord) entries.get(0);

    assertTrue("expected " + record.getBlockBytesScanned() + " to be >= 100",
      record.getBlockBytesScanned() >= 100);
    assertTrue("expected " + record.getResponseSize() + " to be < 100",
      record.getResponseSize() < 100);
    assertTrue("expected " + record.getFsReadTime() + " to be > 0", record.getFsReadTime() > 0);
  }
Tests that we can trigger based on blocks scanned, and also that we properly pass the block
bytes scanned value through to the client.
hbase-server/src/test/java/org/apache/hadoop/hbase/namequeues/TestTooLargeLog.java