36
36
import org .apache .hadoop .hbase .client .Scan ;
37
37
import org .apache .hadoop .hbase .client .ServerType ;
38
38
import org .apache .hadoop .hbase .client .Table ;
39
+ import org .apache .hadoop .hbase .regionserver .HRegionServer ;
39
40
import org .apache .hadoop .hbase .testclassification .MediumTests ;
40
41
import org .apache .hadoop .hbase .testclassification .RegionServerTests ;
41
42
import org .apache .hadoop .hbase .util .Bytes ;
43
+ import org .junit .AfterClass ;
42
44
import org .junit .BeforeClass ;
43
45
import org .junit .ClassRule ;
44
46
import org .junit .Rule ;
@@ -61,27 +63,42 @@ public class TestTooLargeLog {
61
63
62
64
@ BeforeClass
63
65
public static void setUpBeforeClass () throws Exception {
66
+ // Slow log needs to be enabled initially to spin up the SlowLogQueueService
64
67
TEST_UTIL .getConfiguration ().setBoolean (HConstants .SLOW_LOG_BUFFER_ENABLED_KEY , true );
65
- TEST_UTIL .getConfiguration ().setInt ("hbase.ipc.warn.response.size" , 100 );
68
+ TEST_UTIL .getConfiguration ().setInt ("hbase.ipc.warn.response.size" ,
69
+ HConstants .DEFAULT_BLOCKSIZE / 2 );
66
70
TEST_UTIL .startMiniCluster (1 );
67
71
ADMIN = TEST_UTIL .getAdmin ();
68
72
}
69
73
74
+ @ AfterClass
75
+ public static void afterClass () throws Exception {
76
+ TEST_UTIL .shutdownMiniCluster ();
77
+ }
78
+
70
79
/**
71
80
* Tests that we can trigger based on blocks scanned, and also that we properly pass the block
72
81
* bytes scanned value through to the client.
73
82
*/
74
83
@ Test
75
- public void testLogLargeBlockBytesScanned () throws IOException , InterruptedException {
84
+ public void testLogLargeBlockBytesScanned () throws IOException {
85
+ // Turn off slow log buffer for initial loadTable, because we were seeing core dump
86
+ // issues coming from that slow log entry. We will re-enable below.
87
+ HRegionServer regionServer = TEST_UTIL .getHBaseCluster ().getRegionServer (0 );
88
+ regionServer .getConfiguration ().setBoolean (HConstants .SLOW_LOG_BUFFER_ENABLED_KEY , false );
89
+ regionServer .updateConfiguration ();
90
+
76
91
byte [] family = Bytes .toBytes ("0" );
77
92
Table table = TEST_UTIL .createTable (TableName .valueOf ("testLogLargeBlockBytesScanned" ), family );
78
93
TEST_UTIL .loadTable (table , family );
79
94
TEST_UTIL .flush (table .getName ());
80
95
81
- Set <ServerName > server =
82
- Collections .singleton (TEST_UTIL .getHBaseCluster ().getRegionServer (0 ).getServerName ());
96
+ Set <ServerName > server = Collections .singleton (regionServer .getServerName ());
83
97
Admin admin = TEST_UTIL .getAdmin ();
84
- admin .clearSlowLogResponses (server );
98
+
99
+ // Turn on slow log so we capture large scan below
100
+ regionServer .getConfiguration ().setBoolean (HConstants .SLOW_LOG_BUFFER_ENABLED_KEY , true );
101
+ regionServer .updateConfiguration ();
85
102
86
103
Scan scan = new Scan ();
87
104
scan .setCaching (1 );
@@ -90,13 +107,12 @@ public void testLogLargeBlockBytesScanned() throws IOException, InterruptedExcep
90
107
scanner .next ();
91
108
}
92
109
93
- List <LogEntry > entries =
94
- admin . getLogEntries ( server , "LARGE_LOG" , ServerType . REGION_SERVER , 1 , Collections .emptyMap ());
110
+ List <LogEntry > entries = admin . getLogEntries ( server , "LARGE_LOG" , ServerType . REGION_SERVER , 100 ,
111
+ Collections .emptyMap ());
95
112
96
113
assertEquals (1 , entries .size ());
97
114
98
115
OnlineLogRecord record = (OnlineLogRecord ) entries .get (0 );
99
- System .out .println (record .toJsonPrettyPrint ());
100
116
101
117
assertTrue ("expected " + record .getBlockBytesScanned () + " to be >= 100" ,
102
118
record .getBlockBytesScanned () >= 100 );
0 commit comments