### Question:
HBaseFsck { public HBaseFsck(Configuration conf) throws MasterNotRunningException, ZooKeeperConnectionException, IOException { this.conf = conf; HBaseAdmin admin = new HBaseAdmin(conf); status = admin.getMaster().getClusterStatus(); connection = admin.getConnection(); numThreads = conf.getInt("hbasefsck.numthreads", numThreads); executor = new ThreadPoolExecutor(0, numThreads, THREADS_KEEP_ALIVE_SECONDS, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()); } HBaseFsck(Configuration conf); static void main(String [] args); static final long DEFAULT_TIME_LAG; static final long DEFAULT_SLEEP_BEFORE_RERUN; }### Answer:
@Test public void testHBaseFsck() throws Exception { int result = doFsck(false); assertEquals(0, result); TEST_UTIL.createTable(TABLE, FAM); result = doFsck(false); assertEquals(0, result); HTable meta = new HTable(conf, HTableDescriptor.META_TABLEDESC.getName()); ResultScanner scanner = meta.getScanner(new Scan()); resforloop : for (Result res : scanner) { long startCode = Bytes.toLong(res.getValue(HConstants.CATALOG_FAMILY, HConstants.STARTCODE_QUALIFIER)); for (JVMClusterUtil.RegionServerThread rs : TEST_UTIL.getHBaseCluster().getRegionServerThreads()) { HServerInfo hsi = rs.getRegionServer().getServerInfo(); if (startCode != hsi.getStartCode()) { Put put = new Put(res.getRow()); put.add(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER, Bytes.toBytes(hsi.getHostnamePort())); put.add(HConstants.CATALOG_FAMILY, HConstants.STARTCODE_QUALIFIER, Bytes.toBytes(hsi.getStartCode())); meta.put(put); break resforloop; } } } result = doFsck(true); assertEquals(-1, result); Thread.sleep(15000); result = doFsck(false); assertEquals(0, result); new HTable(conf, TABLE).getScanner(new Scan()); }