@@ -662,10 +662,9 @@ public MiniDFSCluster startMiniDFSCluster(int servers, final String racks[], St
662
662
EditLogFileOutputStream .setShouldSkipFsyncForTesting (true );
663
663
664
664
// Error level to skip some warnings specific to the minicluster. See HBASE-4709
665
- org .apache .log4j .Logger .getLogger (org .apache .hadoop .metrics2 .util .MBeans .class ).
666
- setLevel (org .apache .log4j .Level .ERROR );
667
- org .apache .log4j .Logger .getLogger (org .apache .hadoop .metrics2 .impl .MetricsSystemImpl .class ).
668
- setLevel (org .apache .log4j .Level .ERROR );
665
+ Log4jUtils .setLogLevel (org .apache .hadoop .metrics2 .util .MBeans .class .getName (), "ERROR" );
666
+ Log4jUtils .setLogLevel (org .apache .hadoop .metrics2 .impl .MetricsSystemImpl .class .getName (),
667
+ "ERROR" );
669
668
670
669
TraceUtil .initTracer (conf );
671
670
@@ -689,6 +688,10 @@ public MiniDFSCluster startMiniDFSCluster(int servers, final String racks[], St
689
688
690
689
public MiniDFSCluster startMiniDFSClusterForTestWAL (int namenodePort ) throws IOException {
691
690
createDirsAndSetProperties ();
691
+ // Error level to skip some warnings specific to the minicluster. See HBASE-4709
692
+ Log4jUtils .setLogLevel (org .apache .hadoop .metrics2 .util .MBeans .class .getName (), "ERROR" );
693
+ Log4jUtils .setLogLevel (org .apache .hadoop .metrics2 .impl .MetricsSystemImpl .class .getName (),
694
+ "ERROR" );
692
695
dfsCluster = new MiniDFSCluster (namenodePort , conf , 5 , false , true , true , null ,
693
696
null , null , null );
694
697
return dfsCluster ;
@@ -1142,16 +1145,15 @@ public MiniHBaseCluster startMiniCluster(StartMiniClusterOption option) throws E
1142
1145
}
1143
1146
1144
1147
/**
1145
- * Starts up mini hbase cluster.
1146
- * Usually you won't want this. You'll usually want {@link #startMiniCluster()}.
1147
- * This is useful when doing stepped startup of clusters.
1148
+ * Starts up mini hbase cluster. Usually you won't want this. You'll usually want
1149
+ * {@link #startMiniCluster()}. This is useful when doing stepped startup of clusters.
1148
1150
* @return Reference to the hbase mini hbase cluster.
1149
1151
* @see #startMiniCluster(StartMiniClusterOption)
1150
1152
* @see #shutdownMiniHBaseCluster()
1151
1153
*/
1152
1154
public MiniHBaseCluster startMiniHBaseCluster (StartMiniClusterOption option )
1153
- throws IOException , InterruptedException {
1154
- // Now do the mini hbase cluster. Set the hbase.rootdir in config.
1155
+ throws IOException , InterruptedException {
1156
+ // Now do the mini hbase cluster. Set the hbase.rootdir in config.
1155
1157
createRootDir (option .isCreateRootDir ());
1156
1158
if (option .isCreateWALDir ()) {
1157
1159
createWALRootDir ();
@@ -1169,22 +1171,26 @@ public MiniHBaseCluster startMiniHBaseCluster(StartMiniClusterOption option)
1169
1171
conf .setInt (ServerManager .WAIT_ON_REGIONSERVERS_MAXTOSTART , option .getNumRegionServers ());
1170
1172
}
1171
1173
1174
+ // Avoid log flooded with chore execution time, see HBASE-24646 for more details.
1175
+ Log4jUtils .setLogLevel (org .apache .hadoop .hbase .ScheduledChore .class .getName (), "INFO" );
1176
+
1172
1177
Configuration c = new Configuration (this .conf );
1173
1178
TraceUtil .initTracer (c );
1174
- this .hbaseCluster =
1175
- new MiniHBaseCluster (c , option .getNumMasters (), option .getNumAlwaysStandByMasters (),
1176
- option .getNumRegionServers (), option .getRsPorts (), option .getMasterClass (),
1177
- option .getRsClass ());
1179
+ this .hbaseCluster = new MiniHBaseCluster (c , option .getNumMasters (),
1180
+ option .getNumAlwaysStandByMasters (), option .getNumRegionServers (), option .getRsPorts (),
1181
+ option .getMasterClass (), option .getRsClass ());
1178
1182
// Populate the master address configuration from mini cluster configuration.
1179
1183
conf .set (HConstants .MASTER_ADDRS_KEY , MasterRegistry .getMasterAddr (c ));
1180
1184
// Don't leave here till we've done a successful scan of the hbase:meta
1181
- Table t = getConnection ().getTable (TableName .META_TABLE_NAME );
1182
- ResultScanner s = t .getScanner (new Scan ());
1183
- while (s .next () != null ) {
1184
- continue ;
1185
+ try (Table t = getConnection ().getTable (TableName .META_TABLE_NAME );
1186
+ ResultScanner s = t .getScanner (new Scan ())) {
1187
+ for (;;) {
1188
+ if (s .next () == null ) {
1189
+ break ;
1190
+ }
1191
+ }
1185
1192
}
1186
- s .close ();
1187
- t .close ();
1193
+
1188
1194
1189
1195
getAdmin (); // create immediately the hbaseAdmin
1190
1196
LOG .info ("Minicluster is up; activeMaster={}" , getHBaseCluster ().getMaster ());
0 commit comments