@Test public void testFindMissingRegionsInMETAOneMissing() throws Exception { ResultScanner mockedRS = Mockito.mock(ResultScanner.class); when(this.mockedTable.getScanner(any(Scan.class))).thenReturn(mockedRS); List<Cell> cells = new ArrayList<>(); Result result = Result.create(cells); when(mockedRS.next()).thenReturn(result,(Result)null); Path p = new Path(this.testTblDir+ "/182182182121"); FileStatus status = new FileStatus(0, true, 0, 0,0, p); when(mockedFileSystem.listStatus(new Path(this.testTblDir))) .thenReturn(new FileStatus[]{status}); List<Path> missingRegions = fixer.findMissingRegionsInMETA("test-tbl"); assertEquals("Should had returned 1 missing region", 1, missingRegions.size()); assertEquals(p,missingRegions.get(0)); }
List<Path> findMissingRegionsInMETA(String table) throws IOException { InternalMetaChecker<Path> missingChecker = new InternalMetaChecker<>(); return missingChecker.checkRegionsInMETA(table, (regions, dirs) -> { ListUtils<Path, RegionInfo> utils = new ListUtils<>(); return utils.complement(dirs, regions, d -> d.getName(), r -> r.getEncodedName()); }); }
FsRegionsMetaRecoverer implements Closeable { List<Path> findMissingRegionsInMETA(String table) throws IOException { InternalMetaChecker<Path> missingChecker = new InternalMetaChecker<>(); return missingChecker.checkRegionsInMETA(table, (regions, dirs) -> { ListUtils<Path, RegionInfo> utils = new ListUtils<>(); return utils.complement(dirs, regions, d -> d.getName(), r -> r.getEncodedName()); }); } }
FsRegionsMetaRecoverer implements Closeable { List<Path> findMissingRegionsInMETA(String table) throws IOException { InternalMetaChecker<Path> missingChecker = new InternalMetaChecker<>(); return missingChecker.checkRegionsInMETA(table, (regions, dirs) -> { ListUtils<Path, RegionInfo> utils = new ListUtils<>(); return utils.complement(dirs, regions, d -> d.getName(), r -> r.getEncodedName()); }); } FsRegionsMetaRecoverer(Configuration configuration);   FsRegionsMetaRecoverer(Configuration configuration, Connection connection, FileSystem fileSystem); }
FsRegionsMetaRecoverer implements Closeable { List<Path> findMissingRegionsInMETA(String table) throws IOException { InternalMetaChecker<Path> missingChecker = new InternalMetaChecker<>(); return missingChecker.checkRegionsInMETA(table, (regions, dirs) -> { ListUtils<Path, RegionInfo> utils = new ListUtils<>(); return utils.complement(dirs, regions, d -> d.getName(), r -> r.getEncodedName()); }); } FsRegionsMetaRecoverer(Configuration configuration);   FsRegionsMetaRecoverer(Configuration configuration, Connection connection, FileSystem fileSystem); Map<TableName,List<Path>> reportTablesMissingRegions(final List<String> namespacesOrTables); Map<TableName,List<RegionInfo>> reportTablesExtraRegions(final List<String> namespacesOrTables); List<Future<List<String>>> addMissingRegionsInMetaForTables(
      List<String> nameSpaceOrTable); List<Future<List<String>>> removeExtraRegionsFromMetaForTables(
    List<String> nameSpaceOrTable); @Override void close(); }
FsRegionsMetaRecoverer implements Closeable { List<Path> findMissingRegionsInMETA(String table) throws IOException { InternalMetaChecker<Path> missingChecker = new InternalMetaChecker<>(); return missingChecker.checkRegionsInMETA(table, (regions, dirs) -> { ListUtils<Path, RegionInfo> utils = new ListUtils<>(); return utils.complement(dirs, regions, d -> d.getName(), r -> r.getEncodedName()); }); } FsRegionsMetaRecoverer(Configuration configuration);   FsRegionsMetaRecoverer(Configuration configuration, Connection connection, FileSystem fileSystem); Map<TableName,List<Path>> reportTablesMissingRegions(final List<String> namespacesOrTables); Map<TableName,List<RegionInfo>> reportTablesExtraRegions(final List<String> namespacesOrTables); List<Future<List<String>>> addMissingRegionsInMetaForTables(
      List<String> nameSpaceOrTable); List<Future<List<String>>> removeExtraRegionsFromMetaForTables(
    List<String> nameSpaceOrTable); @Override void close();  }