@Test public void testHBaseFsck() throws Exception { assertNoErrors(doFsck(conf, false)); String table = "tableBadMetaAssign"; TEST_UTIL.createTable(Bytes.toBytes(table), FAM); assertNoErrors(doFsck(conf, false)); HTable meta = new HTable(conf, HTableDescriptor.META_TABLEDESC.getTableName(), executorService); Scan scan = new Scan(); scan.setStartRow(Bytes.toBytes(table+",,")); ResultScanner scanner = meta.getScanner(scan); HRegionInfo hri = null; Result res = scanner.next(); ServerName currServer = ServerName.parseFrom(res.getValue(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER)); long startCode = Bytes.toLong(res.getValue(HConstants.CATALOG_FAMILY, HConstants.STARTCODE_QUALIFIER)); for (JVMClusterUtil.RegionServerThread rs : TEST_UTIL.getHBaseCluster().getRegionServerThreads()) { ServerName sn = rs.getRegionServer().getServerName(); if (!currServer.getHostAndPort().equals(sn.getHostAndPort()) || startCode != sn.getStartcode()) { Put put = new Put(res.getRow()); put.setDurability(Durability.SKIP_WAL); put.add(HConstants.CATALOG_FAMILY, HConstants.SERVER_QUALIFIER, Bytes.toBytes(sn.getHostAndPort())); put.add(HConstants.CATALOG_FAMILY, HConstants.STARTCODE_QUALIFIER, Bytes.toBytes(sn.getStartcode())); meta.put(put); hri = HRegionInfo.getHRegionInfo(res); break; } } assertErrors(doFsck(conf, true), new ERROR_CODE[]{ ERROR_CODE.SERVER_DOES_NOT_MATCH_META}); TEST_UTIL.getHBaseCluster().getMaster() .getAssignmentManager().waitForAssignment(hri); assertNoErrors(doFsck(conf, false)); HTable t = new HTable(conf, Bytes.toBytes(table), executorService); ResultScanner s = t.getScanner(new Scan()); s.close(); t.close(); scanner.close(); meta.close(); }
public HBaseFsck(Configuration conf) throws MasterNotRunningException, ZooKeeperConnectionException, IOException, ClassNotFoundException { super(conf); setConf(HBaseConfiguration.create(getConf())); getConf().setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0); errors = getErrorReporter(conf); int numThreads = conf.getInt("hbasefsck.numthreads", MAX_NUM_THREADS); executor = new ScheduledThreadPoolExecutor(numThreads, Threads.newDaemonThreadFactory("hbasefsck")); }
HBaseFsck extends Configured { public HBaseFsck(Configuration conf) throws MasterNotRunningException, ZooKeeperConnectionException, IOException, ClassNotFoundException { super(conf); setConf(HBaseConfiguration.create(getConf())); getConf().setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0); errors = getErrorReporter(conf); int numThreads = conf.getInt("hbasefsck.numthreads", MAX_NUM_THREADS); executor = new ScheduledThreadPoolExecutor(numThreads, Threads.newDaemonThreadFactory("hbasefsck")); } }
HBaseFsck extends Configured { public HBaseFsck(Configuration conf) throws MasterNotRunningException, ZooKeeperConnectionException, IOException, ClassNotFoundException { super(conf); setConf(HBaseConfiguration.create(getConf())); getConf().setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0); errors = getErrorReporter(conf); int numThreads = conf.getInt("hbasefsck.numthreads", MAX_NUM_THREADS); executor = new ScheduledThreadPoolExecutor(numThreads, Threads.newDaemonThreadFactory("hbasefsck")); } HBaseFsck(Configuration conf);  HBaseFsck(Configuration conf, ExecutorService exec); }
HBaseFsck extends Configured { public HBaseFsck(Configuration conf) throws MasterNotRunningException, ZooKeeperConnectionException, IOException, ClassNotFoundException { super(conf); setConf(HBaseConfiguration.create(getConf())); getConf().setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0); errors = getErrorReporter(conf); int numThreads = conf.getInt("hbasefsck.numthreads", MAX_NUM_THREADS); executor = new ScheduledThreadPoolExecutor(numThreads, Threads.newDaemonThreadFactory("hbasefsck")); } HBaseFsck(Configuration conf);  HBaseFsck(Configuration conf, ExecutorService exec); void connect(); void offlineHdfsIntegrityRepair(); int onlineConsistencyRepair(); int onlineHbck(); static byte[] keyOnly(byte[] b); void checkRegionBoundaries(); ErrorReporter getErrors(); void fixEmptyMetaCells(); void fixOrphanTables(); boolean rebuildMeta(boolean fix); void loadHdfsRegionDirs(); int mergeRegionDirs(Path targetRegionDir, HbckInfo contained); void dumpOverlapProblems(Multimap<byte[], HbckInfo> regions); void dumpSidelinedRegions(Map<Path, HbckInfo> regions); Multimap<byte[], HbckInfo> getOverlapGroups(
      TableName table); static void setDisplayFullReport(); void setFixTableLocks(boolean shouldFix); void setFixAssignments(boolean shouldFix); void setFixMeta(boolean shouldFix); void setFixEmptyMetaCells(boolean shouldFix); void setCheckHdfs(boolean checking); void setFixHdfsHoles(boolean shouldFix); void setFixTableOrphans(boolean shouldFix); void setFixHdfsOverlaps(boolean shouldFix); void setFixHdfsOrphans(boolean shouldFix); void setFixVersionFile(boolean shouldFix); boolean shouldFixVersionFile(); void setSidelineBigOverlaps(boolean sbo); boolean shouldSidelineBigOverlaps(); void setFixSplitParents(boolean shouldFix); void setFixReferenceFiles(boolean shouldFix); boolean shouldIgnorePreCheckPermission(); void setIgnorePreCheckPermission(boolean ignorePreCheckPermission); void setMaxMerge(int mm); int getMaxMerge(); void setMaxOverlapsToSideline(int mo); int getMaxOverlapsToSideline(); void includeTable(TableName table); void setTimeLag(long seconds); void setSidelineDir(String sidelineDir); HFileCorruptionChecker getHFilecorruptionChecker(); void setHFileCorruptionChecker(HFileCorruptionChecker hfcc); void setRetCode(int code); int getRetCode(); static void main(String[] args); HBaseFsck exec(ExecutorService exec, String[] args); static void debugLsr(Configuration conf,
      Path p); static void debugLsr(Configuration conf,
      Path p, ErrorReporter errors); }
HBaseFsck extends Configured { public HBaseFsck(Configuration conf) throws MasterNotRunningException, ZooKeeperConnectionException, IOException, ClassNotFoundException { super(conf); setConf(HBaseConfiguration.create(getConf())); getConf().setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0); errors = getErrorReporter(conf); int numThreads = conf.getInt("hbasefsck.numthreads", MAX_NUM_THREADS); executor = new ScheduledThreadPoolExecutor(numThreads, Threads.newDaemonThreadFactory("hbasefsck")); } HBaseFsck(Configuration conf);  HBaseFsck(Configuration conf, ExecutorService exec); void connect(); void offlineHdfsIntegrityRepair(); int onlineConsistencyRepair(); int onlineHbck(); static byte[] keyOnly(byte[] b); void checkRegionBoundaries(); ErrorReporter getErrors(); void fixEmptyMetaCells(); void fixOrphanTables(); boolean rebuildMeta(boolean fix); void loadHdfsRegionDirs(); int mergeRegionDirs(Path targetRegionDir, HbckInfo contained); void dumpOverlapProblems(Multimap<byte[], HbckInfo> regions); void dumpSidelinedRegions(Map<Path, HbckInfo> regions); Multimap<byte[], HbckInfo> getOverlapGroups(
      TableName table); static void setDisplayFullReport(); void setFixTableLocks(boolean shouldFix); void setFixAssignments(boolean shouldFix); void setFixMeta(boolean shouldFix); void setFixEmptyMetaCells(boolean shouldFix); void setCheckHdfs(boolean checking); void setFixHdfsHoles(boolean shouldFix); void setFixTableOrphans(boolean shouldFix); void setFixHdfsOverlaps(boolean shouldFix); void setFixHdfsOrphans(boolean shouldFix); void setFixVersionFile(boolean shouldFix); boolean shouldFixVersionFile(); void setSidelineBigOverlaps(boolean sbo); boolean shouldSidelineBigOverlaps(); void setFixSplitParents(boolean shouldFix); void setFixReferenceFiles(boolean shouldFix); boolean shouldIgnorePreCheckPermission(); void setIgnorePreCheckPermission(boolean ignorePreCheckPermission); void setMaxMerge(int mm); int getMaxMerge(); void setMaxOverlapsToSideline(int mo); int getMaxOverlapsToSideline(); void includeTable(TableName table); void setTimeLag(long seconds); void setSidelineDir(String sidelineDir); HFileCorruptionChecker getHFilecorruptionChecker(); void setHFileCorruptionChecker(HFileCorruptionChecker hfcc); void setRetCode(int code); int getRetCode(); static void main(String[] args); HBaseFsck exec(ExecutorService exec, String[] args); static void debugLsr(Configuration conf,
      Path p); static void debugLsr(Configuration conf,
      Path p, ErrorReporter errors); static final long DEFAULT_TIME_LAG; static final long DEFAULT_SLEEP_BEFORE_RERUN; }