Repository: hbase Updated Branches: refs/heads/master f1502a3ac -> c2236b77c
http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/util/BackupUtils.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/util/BackupUtils.java b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/util/BackupUtils.java index 9a2825e..18548f5 100644 --- a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/util/BackupUtils.java +++ b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/util/BackupUtils.java @@ -84,14 +84,12 @@ public final class BackupUtils { */ public static HashMap<String, Long> getRSLogTimestampMins( HashMap<TableName, HashMap<String, Long>> rsLogTimestampMap) { - if (rsLogTimestampMap == null || rsLogTimestampMap.isEmpty()) { return null; } - HashMap<String, Long> rsLogTimestampMins = new HashMap<String, Long>(); - HashMap<String, HashMap<TableName, Long>> rsLogTimestampMapByRS = - new HashMap<String, HashMap<TableName, Long>>(); + HashMap<String, Long> rsLogTimestampMins = new HashMap<>(); + HashMap<String, HashMap<TableName, Long>> rsLogTimestampMapByRS = new HashMap<>(); for (Entry<TableName, HashMap<String, Long>> tableEntry : rsLogTimestampMap.entrySet()) { TableName table = tableEntry.getKey(); @@ -100,7 +98,7 @@ public final class BackupUtils { String rs = rsEntry.getKey(); Long ts = rsEntry.getValue(); if (!rsLogTimestampMapByRS.containsKey(rs)) { - rsLogTimestampMapByRS.put(rs, new HashMap<TableName, Long>()); + rsLogTimestampMapByRS.put(rs, new HashMap<>()); rsLogTimestampMapByRS.get(rs).put(table, ts); } else { rsLogTimestampMapByRS.get(rs).put(table, ts); @@ -123,18 +121,15 @@ public final class BackupUtils { * @param backupInfo backup info * @param conf configuration * @throws IOException exception - * @throws InterruptedException exception */ - public static void - copyTableRegionInfo(Connection conn, BackupInfo backupInfo, Configuration conf) - throws IOException, InterruptedException { + public static void copyTableRegionInfo(Connection conn, BackupInfo backupInfo, Configuration conf) + throws IOException { Path rootDir = FSUtils.getRootDir(conf); FileSystem fs = rootDir.getFileSystem(conf); // for each table in the table set, copy out the table info and region // info files in the correct directory structure for (TableName table : backupInfo.getTables()) { - if (!MetaTableAccessor.tableExists(conn, table)) { LOG.warn("Table " + table + " does not exists, skipping it."); continue; @@ -150,8 +145,7 @@ public final class BackupUtils { LOG.debug("Attempting to copy table info for:" + table + " target: " + target + " descriptor: " + orig); LOG.debug("Finished copying tableinfo."); - List<RegionInfo> regions = null; - regions = MetaTableAccessor.getTableRegions(conn, table); + List<RegionInfo> regions = MetaTableAccessor.getTableRegions(conn, table); // For each region, write the region info to disk LOG.debug("Starting to write region info for table " + table); for (RegionInfo regionInfo : regions) { @@ -210,10 +204,8 @@ public final class BackupUtils { * Returns WAL file name * @param walFileName WAL file name * @return WAL file name - * @throws IOException exception - * @throws IllegalArgumentException exception */ - public static String getUniqueWALFileNamePart(String walFileName) throws IOException { + public static String getUniqueWALFileNamePart(String walFileName) { return getUniqueWALFileNamePart(new Path(walFileName)); } @@ -221,9 +213,8 @@ public final class BackupUtils { * Returns WAL file name * @param p WAL file path * @return WAL file name - * @throws IOException exception */ - public static String getUniqueWALFileNamePart(Path p) throws IOException { + public static String getUniqueWALFileNamePart(Path p) { return p.getName(); } @@ -261,27 +252,23 @@ public final class BackupUtils { Path rootDir = FSUtils.getRootDir(c); Path logDir = new Path(rootDir, HConstants.HREGION_LOGDIR_NAME); Path oldLogDir = new Path(rootDir, HConstants.HREGION_OLDLOGDIR_NAME); - List<String> logFiles = new ArrayList<String>(); - - PathFilter filter = new PathFilter() { + List<String> logFiles = new ArrayList<>(); - @Override - public boolean accept(Path p) { - try { - if (AbstractFSWALProvider.isMetaFile(p)) { - return false; - } - String host = parseHostNameFromLogFile(p); - if (host == null) { - return false; - } - Long oldTimestamp = hostTimestampMap.get(host); - Long currentLogTS = BackupUtils.getCreationTime(p); - return currentLogTS <= oldTimestamp; - } catch (Exception e) { - LOG.warn("Can not parse" + p, e); + PathFilter filter = p -> { + try { + if (AbstractFSWALProvider.isMetaFile(p)) { + return false; + } + String host = parseHostNameFromLogFile(p); + if (host == null) { return false; } + Long oldTimestamp = hostTimestampMap.get(host); + Long currentLogTS = BackupUtils.getCreationTime(p); + return currentLogTS <= oldTimestamp; + } catch (Exception e) { + LOG.warn("Can not parse" + p, e); + return false; } }; FileSystem fs = FileSystem.get(c); @@ -331,7 +318,7 @@ public final class BackupUtils { * @throws IOException exception */ public static void checkTargetDir(String backupRootPath, Configuration conf) throws IOException { - boolean targetExists = false; + boolean targetExists; try { targetExists = checkPathExist(backupRootPath, conf); } catch (IOException e) { @@ -363,7 +350,7 @@ public final class BackupUtils { public static <T> Long getMinValue(HashMap<T, Long> map) { Long minTimestamp = null; if (map != null) { - ArrayList<Long> timestampList = new ArrayList<Long>(map.values()); + ArrayList<Long> timestampList = new ArrayList<>(map.values()); Collections.sort(timestampList); // The min among all the RS log timestamps will be kept in backup system table table. minTimestamp = timestampList.get(0); @@ -375,7 +362,6 @@ public final class BackupUtils { * Parses host name:port from archived WAL path * @param p path * @return host name - * @throws IOException exception */ public static String parseHostFromOldLog(Path p) { try { @@ -405,7 +391,7 @@ public final class BackupUtils { } public static List<String> getFiles(FileSystem fs, Path rootDir, List<String> files, - PathFilter filter) throws FileNotFoundException, IOException { + PathFilter filter) throws IOException { RemoteIterator<LocatedFileStatus> it = fs.listFiles(rootDir, true); while (it.hasNext()) { @@ -433,7 +419,6 @@ public final class BackupUtils { * @throws IOException exception */ private static void cleanupHLogDir(BackupInfo backupInfo, Configuration conf) throws IOException { - String logDir = backupInfo.getHLogTargetDir(); if (logDir == null) { LOG.warn("No log directory specified for " + backupInfo.getBackupId()); @@ -497,8 +482,8 @@ public final class BackupUtils { * @param tableName table name * @return backupPath String for the particular table */ - public static String - getTableBackupDir(String backupRootDir, String backupId, TableName tableName) { + public static String getTableBackupDir(String backupRootDir, String backupId, + TableName tableName) { return backupRootDir + Path.SEPARATOR + backupId + Path.SEPARATOR + tableName.getNamespaceAsString() + Path.SEPARATOR + tableName.getQualifierAsString() + Path.SEPARATOR; @@ -510,8 +495,8 @@ public final class BackupUtils { * @return sorted list of BackupCompleteData */ public static ArrayList<BackupInfo> sortHistoryListDesc(ArrayList<BackupInfo> historyList) { - ArrayList<BackupInfo> list = new ArrayList<BackupInfo>(); - TreeMap<String, BackupInfo> map = new TreeMap<String, BackupInfo>(); + ArrayList<BackupInfo> list = new ArrayList<>(); + TreeMap<String, BackupInfo> map = new TreeMap<>(); for (BackupInfo h : historyList) { map.put(Long.toString(h.getStartTs()), h); } @@ -531,8 +516,8 @@ public final class BackupUtils { * @param filter path filter * @return null if dir is empty or doesn't exist, otherwise FileStatus array */ - public static FileStatus[] - listStatus(final FileSystem fs, final Path dir, final PathFilter filter) throws IOException { + public static FileStatus[] listStatus(final FileSystem fs, final Path dir, + final PathFilter filter) throws IOException { FileStatus[] status = null; try { status = filter == null ? fs.listStatus(dir) : fs.listStatus(dir, filter); @@ -542,7 +527,11 @@ public final class BackupUtils { LOG.trace(dir + " doesn't exist"); } } - if (status == null || status.length < 1) return null; + + if (status == null || status.length < 1) { + return null; + } + return status; } @@ -577,10 +566,14 @@ public final class BackupUtils { FileSystem fs = FileSystem.get(conf); RemoteIterator<LocatedFileStatus> it = fs.listLocatedStatus(backupRootPath); - List<BackupInfo> infos = new ArrayList<BackupInfo>(); + List<BackupInfo> infos = new ArrayList<>(); while (it.hasNext()) { LocatedFileStatus lfs = it.next(); - if (!lfs.isDirectory()) continue; + + if (!lfs.isDirectory()) { + continue; + } + String backupId = lfs.getPath().getName(); try { BackupInfo info = loadBackupInfo(backupRootPath, backupId, fs); @@ -591,12 +584,15 @@ public final class BackupUtils { } // Sort Collections.sort(infos, new Comparator<BackupInfo>() { - @Override public int compare(BackupInfo o1, BackupInfo o2) { long ts1 = getTimestamp(o1.getBackupId()); long ts2 = getTimestamp(o2.getBackupId()); - if (ts1 == ts2) return 0; + + if (ts1 == ts2) { + return 0; + } + return ts1 < ts2 ? 1 : -1; } @@ -611,7 +607,7 @@ public final class BackupUtils { public static List<BackupInfo> getHistory(Configuration conf, int n, Path backupRootPath, BackupInfo.Filter... filters) throws IOException { List<BackupInfo> infos = getHistory(conf, backupRootPath); - List<BackupInfo> ret = new ArrayList<BackupInfo>(); + List<BackupInfo> ret = new ArrayList<>(); for (BackupInfo info : infos) { if (ret.size() == n) { break; @@ -672,7 +668,7 @@ public final class BackupUtils { for (Entry<TableName, BackupManifest> manifestEntry : backupManifestMap.entrySet()) { TableName table = manifestEntry.getKey(); - TreeSet<BackupImage> imageSet = new TreeSet<BackupImage>(); + TreeSet<BackupImage> imageSet = new TreeSet<>(); ArrayList<BackupImage> depList = manifestEntry.getValue().getDependentListByTable(table); if (depList != null && !depList.isEmpty()) { @@ -697,8 +693,8 @@ public final class BackupUtils { public static Path getBulkOutputDir(String tableName, Configuration conf, boolean deleteOnExit) throws IOException { FileSystem fs = FileSystem.get(conf); - String tmp = - conf.get(HConstants.TEMPORARY_FS_DIRECTORY_KEY, HConstants.DEFAULT_TEMPORARY_HDFS_DIRECTORY); + String tmp = conf.get(HConstants.TEMPORARY_FS_DIRECTORY_KEY, + HConstants.DEFAULT_TEMPORARY_HDFS_DIRECTORY); Path path = new Path(tmp + Path.SEPARATOR + "bulk_output-" + tableName + "-" + EnvironmentEdgeManager.currentTime()); @@ -736,7 +732,7 @@ public final class BackupUtils { // limit. Bad for snapshot restore. conf.setInt(LoadIncrementalHFiles.MAX_FILES_PER_REGION_PER_FAMILY, Integer.MAX_VALUE); conf.set(LoadIncrementalHFiles.IGNORE_UNMATCHED_CF_CONF_KEY, "yes"); - LoadIncrementalHFiles loader = null; + LoadIncrementalHFiles loader; try { loader = new LoadIncrementalHFiles(conf); } catch (Exception e) { http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/util/RestoreTool.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/util/RestoreTool.java b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/util/RestoreTool.java index 7f274db..1015665 100644 --- a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/util/RestoreTool.java +++ b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/util/RestoreTool.java @@ -36,9 +36,6 @@ import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.backup.BackupRestoreFactory; import org.apache.hadoop.hbase.backup.HBackupFileSystem; import org.apache.hadoop.hbase.backup.RestoreJob; -import org.apache.yetus.audience.InterfaceAudience; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor; import org.apache.hadoop.hbase.client.Connection; @@ -46,26 +43,29 @@ import org.apache.hadoop.hbase.client.TableDescriptor; import org.apache.hadoop.hbase.client.TableDescriptorBuilder; import org.apache.hadoop.hbase.io.HFileLink; import org.apache.hadoop.hbase.io.hfile.HFile; -import org.apache.hadoop.hbase.tool.LoadIncrementalHFiles; import org.apache.hadoop.hbase.regionserver.StoreFileInfo; -import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription; import org.apache.hadoop.hbase.snapshot.SnapshotDescriptionUtils; import org.apache.hadoop.hbase.snapshot.SnapshotManifest; +import org.apache.hadoop.hbase.tool.LoadIncrementalHFiles; import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.EnvironmentEdgeManager; import org.apache.hadoop.hbase.util.FSTableDescriptors; +import org.apache.yetus.audience.InterfaceAudience; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import org.apache.hadoop.hbase.shaded.protobuf.generated.SnapshotProtos.SnapshotDescription; /** * A collection for methods used by multiple classes to restore HBase tables. */ @InterfaceAudience.Private public class RestoreTool { - public static final Logger LOG = LoggerFactory.getLogger(BackupUtils.class); private final static long TABLE_AVAILABILITY_WAIT_TIME = 180000; private final String[] ignoreDirs = { HConstants.RECOVERED_EDITS_DIR }; - protected Configuration conf = null; + protected Configuration conf; protected Path backupRootPath; protected String backupId; protected FileSystem fs; @@ -89,7 +89,6 @@ public class RestoreTool { * @throws IOException exception */ Path getTableArchivePath(TableName tableName) throws IOException { - Path baseDir = new Path(HBackupFileSystem.getTableBackupPath(tableName, backupRootPath, backupId), HConstants.HFILE_ARCHIVE_DIRECTORY); @@ -107,12 +106,11 @@ public class RestoreTool { * Gets region list * @param tableName table name * @return RegionList region list - * @throws FileNotFoundException exception * @throws IOException exception */ - ArrayList<Path> getRegionList(TableName tableName) throws FileNotFoundException, IOException { + ArrayList<Path> getRegionList(TableName tableName) throws IOException { Path tableArchivePath = getTableArchivePath(tableName); - ArrayList<Path> regionDirList = new ArrayList<Path>(); + ArrayList<Path> regionDirList = new ArrayList<>(); FileStatus[] children = fs.listStatus(tableArchivePath); for (FileStatus childStatus : children) { // here child refer to each region(Name) @@ -122,9 +120,7 @@ public class RestoreTool { return regionDirList; } - void modifyTableSync(Connection conn, TableDescriptor desc) throws IOException { - try (Admin admin = conn.getAdmin()) { admin.modifyTable(desc); int attempt = 0; @@ -155,7 +151,6 @@ public class RestoreTool { */ public void incrementalRestoreTable(Connection conn, Path tableBackupPath, Path[] logDirs, TableName[] tableNames, TableName[] newTableNames, String incrBackupId) throws IOException { - try (Admin admin = conn.getAdmin()) { if (tableNames.length != newTableNames.length) { throw new IOException("Number of source tables and target tables does not match!"); @@ -228,15 +223,15 @@ public class RestoreTool { /** * Returns value represent path for: - * ""/$USER/SBACKUP_ROOT/backup_id/namespace/table/.hbase-snapshot/snapshot_1396650097621_namespace_table" + * ""/$USER/SBACKUP_ROOT/backup_id/namespace/table/.hbase-snapshot/ + * snapshot_1396650097621_namespace_table" * this path contains .snapshotinfo, .tabledesc (0.96 and 0.98) this path contains .snapshotinfo, * .data.manifest (trunk) * @param tableName table name * @return path to table info - * @throws FileNotFoundException exception * @throws IOException exception */ - Path getTableInfoPath(TableName tableName) throws FileNotFoundException, IOException { + Path getTableInfoPath(TableName tableName) throws IOException { Path tableSnapShotPath = getTableSnapshotPath(backupRootPath, tableName, backupId); Path tableInfoPath = null; @@ -257,15 +252,16 @@ public class RestoreTool { * @param tableName is the table backed up * @return {@link TableDescriptor} saved in backup image of the table */ - TableDescriptor getTableDesc(TableName tableName) throws FileNotFoundException, IOException { + TableDescriptor getTableDesc(TableName tableName) throws IOException { Path tableInfoPath = this.getTableInfoPath(tableName); SnapshotDescription desc = SnapshotDescriptionUtils.readSnapshotInfo(fs, tableInfoPath); SnapshotManifest manifest = SnapshotManifest.open(conf, fs, tableInfoPath, desc); TableDescriptor tableDescriptor = manifest.getTableDescriptor(); if (!tableDescriptor.getTableName().equals(tableName)) { LOG.error("couldn't find Table Desc for table: " + tableName + " under tableInfoPath: " - + tableInfoPath.toString()); - LOG.error("tableDescriptor.getNameAsString() = " + tableDescriptor.getTableName().getNameAsString()); + + tableInfoPath.toString()); + LOG.error("tableDescriptor.getNameAsString() = " + + tableDescriptor.getTableName().getNameAsString()); throw new FileNotFoundException("couldn't find Table Desc for table: " + tableName + " under tableInfoPath: " + tableInfoPath.toString()); } @@ -367,11 +363,10 @@ public class RestoreTool { * Gets region list * @param tableArchivePath table archive path * @return RegionList region list - * @throws FileNotFoundException exception * @throws IOException exception */ - ArrayList<Path> getRegionList(Path tableArchivePath) throws FileNotFoundException, IOException { - ArrayList<Path> regionDirList = new ArrayList<Path>(); + ArrayList<Path> getRegionList(Path tableArchivePath) throws IOException { + ArrayList<Path> regionDirList = new ArrayList<>(); FileStatus[] children = fs.listStatus(tableArchivePath); for (FileStatus childStatus : children) { // here child refer to each region(Name) @@ -386,9 +381,8 @@ public class RestoreTool { * @param regionDirList region dir list * @return a set of keys to store the boundaries */ - byte[][] generateBoundaryKeys(ArrayList<Path> regionDirList) throws FileNotFoundException, - IOException { - TreeMap<byte[], Integer> map = new TreeMap<byte[], Integer>(Bytes.BYTES_COMPARATOR); + byte[][] generateBoundaryKeys(ArrayList<Path> regionDirList) throws IOException { + TreeMap<byte[], Integer> map = new TreeMap<>(Bytes.BYTES_COMPARATOR); // Build a set of keys to store the boundaries // calculate region boundaries and add all the column families to the table descriptor for (Path regionDir : regionDirList) { @@ -490,7 +484,7 @@ public class RestoreTool { } if (createNew) { LOG.info("Creating target table '" + targetTableName + "'"); - byte[][] keys = null; + byte[][] keys; if (regionDirList == null || regionDirList.size() == 0) { admin.createTable(htd, null); } else { @@ -514,5 +508,4 @@ public class RestoreTool { } } } - } http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupBase.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupBase.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupBase.java index 2be7784..4243f5b 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupBase.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupBase.java @@ -75,7 +75,6 @@ import org.slf4j.LoggerFactory; * tests should have their own classes and extend this one */ public class TestBackupBase { - private static final Logger LOG = LoggerFactory.getLogger(TestBackupBase.class); protected static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); @@ -107,10 +106,7 @@ public class TestBackupBase { protected static boolean setupIsDone = false; protected static boolean useSecondCluster = false; - - static class IncrementalTableBackupClientForTest extends IncrementalTableBackupClient - { - + static class IncrementalTableBackupClientForTest extends IncrementalTableBackupClient { public IncrementalTableBackupClientForTest() { } @@ -120,8 +116,7 @@ public class TestBackupBase { } @Override - public void execute() throws IOException - { + public void execute() throws IOException { // case INCREMENTAL_COPY: try { // case PREPARE_INCREMENTAL: @@ -174,14 +169,10 @@ public class TestBackupBase { BackupType.INCREMENTAL, conf); throw new IOException(e); } - } } - static class FullTableBackupClientForTest extends FullTableBackupClient - { - - + static class FullTableBackupClientForTest extends FullTableBackupClient { public FullTableBackupClientForTest() { } @@ -191,21 +182,20 @@ public class TestBackupBase { } @Override - public void execute() throws IOException - { + public void execute() throws IOException { // Get the stage ID to fail on try (Admin admin = conn.getAdmin()) { // Begin BACKUP beginBackup(backupManager, backupInfo); failStageIf(Stage.stage_0); - String savedStartCode = null; - boolean firstBackup = false; + String savedStartCode; + boolean firstBackup; // do snapshot for full table backup savedStartCode = backupManager.readBackupStartCode(); firstBackup = savedStartCode == null || Long.parseLong(savedStartCode) == 0L; if (firstBackup) { - // This is our first backup. Let's put some marker to system table so that we can hold the logs - // while we do the backup. + // This is our first backup. Let's put some marker to system table so that we can hold the + // logs while we do the backup. backupManager.writeBackupStartCode(0L); } failStageIf(Stage.stage_1); @@ -216,7 +206,7 @@ public class TestBackupBase { // the snapshot. LOG.info("Execute roll log procedure for full backup ..."); - Map<String, String> props = new HashMap<String, String>(); + Map<String, String> props = new HashMap<>(); props.put("backupRoot", backupInfo.getBackupRootDir()); admin.execProcedure(LogRollMasterProcedureManager.ROLLLOG_PROCEDURE_SIGNATURE, LogRollMasterProcedureManager.ROLLLOG_PROCEDURE_NAME, props); @@ -277,12 +267,10 @@ public class TestBackupBase { throw new IOException(e); } } - } - /** - * @throws java.lang.Exception + * @throws Exception if starting the mini cluster or setting up the tables fails */ @Before public void setUp() throws Exception { @@ -315,12 +303,12 @@ public class TestBackupBase { TEST_UTIL.startMiniMapReduceCluster(); BACKUP_ROOT_DIR = - new Path ( new Path(TEST_UTIL.getConfiguration().get("fs.defaultFS")), + new Path(new Path(TEST_UTIL.getConfiguration().get("fs.defaultFS")), BACKUP_ROOT_DIR).toString(); LOG.info("ROOTDIR " + BACKUP_ROOT_DIR); if (useSecondCluster) { BACKUP_REMOTE_ROOT_DIR = - new Path ( new Path(TEST_UTIL2.getConfiguration().get("fs.defaultFS")) + new Path(new Path(TEST_UTIL2.getConfiguration().get("fs.defaultFS")) + BACKUP_REMOTE_ROOT_DIR).toString(); LOG.info("REMOTE ROOTDIR " + BACKUP_REMOTE_ROOT_DIR); } @@ -338,7 +326,7 @@ public class TestBackupBase { } /** - * @throws java.lang.Exception + * @throws Exception if deleting the archive directory or shutting down the mini cluster fails */ @AfterClass public static void tearDown() throws Exception { @@ -366,7 +354,6 @@ public class TestBackupBase { return t; } - protected BackupRequest createBackupRequest(BackupType type, List<TableName> tables, String path) { BackupRequest.Builder builder = new BackupRequest.Builder(); @@ -406,7 +393,6 @@ public class TestBackupBase { } protected static void loadTable(Table table) throws Exception { - Put p; // 100 + 1 row to t1_syncup for (int i = 0; i < NB_ROWS_IN_BATCH; i++) { p = new Put(Bytes.toBytes("row" + i)); @@ -417,7 +403,6 @@ public class TestBackupBase { } protected static void createTables() throws Exception { - long tid = System.currentTimeMillis(); table1 = TableName.valueOf("ns1:test-" + tid); HBaseAdmin ha = TEST_UTIL.getHBaseAdmin(); @@ -461,13 +446,21 @@ public class TestBackupBase { protected boolean checkSucceeded(String backupId) throws IOException { BackupInfo status = getBackupInfo(backupId); - if (status == null) return false; + + if (status == null) { + return false; + } + return status.getState() == BackupState.COMPLETE; } protected boolean checkFailed(String backupId) throws IOException { BackupInfo status = getBackupInfo(backupId); - if (status == null) return false; + + if (status == null) { + return false; + } + return status.getState() == BackupState.FAILED; } @@ -500,6 +493,5 @@ public class TestBackupBase { while (it.hasNext()) { LOG.debug(Objects.toString(it.next().getPath())); } - } } http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupBoundaryTests.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupBoundaryTests.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupBoundaryTests.java index 6d4fc47..a240bd8 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupBoundaryTests.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupBoundaryTests.java @@ -31,16 +31,15 @@ import org.apache.hbase.thirdparty.com.google.common.collect.Lists; @Category(LargeTests.class) public class TestBackupBoundaryTests extends TestBackupBase { - private static final Logger LOG = LoggerFactory.getLogger(TestBackupBoundaryTests.class); /** * Verify that full backup is created on a single empty table correctly. - * @throws Exception + * + * @throws Exception if doing the full backup fails */ @Test public void testFullBackupSingleEmpty() throws Exception { - LOG.info("create full backup image on single table"); List<TableName> tables = Lists.newArrayList(table3); LOG.info("Finished Backup " + fullTableBackup(tables)); @@ -48,7 +47,8 @@ public class TestBackupBoundaryTests extends TestBackupBase { /** * Verify that full backup is created on multiple empty tables correctly. - * @throws Exception + * + * @throws Exception if doing the full backup fails */ @Test public void testFullBackupMultipleEmpty() throws Exception { @@ -60,11 +60,11 @@ public class TestBackupBoundaryTests extends TestBackupBase { /** * Verify that full backup fails on a single table that does not exist. - * @throws Exception + * + * @throws Exception if doing the full backup fails */ @Test(expected = IOException.class) public void testFullBackupSingleDNE() throws Exception { - LOG.info("test full backup fails on a single table that does not exist"); List<TableName> tables = toList("tabledne"); fullTableBackup(tables); @@ -72,11 +72,11 @@ public class TestBackupBoundaryTests extends TestBackupBase { /** * Verify that full backup fails on multiple tables that do not exist. - * @throws Exception + * + * @throws Exception if doing the full backup fails */ @Test(expected = IOException.class) public void testFullBackupMultipleDNE() throws Exception { - LOG.info("test full backup fails on multiple tables that do not exist"); List<TableName> tables = toList("table1dne", "table2dne"); fullTableBackup(tables); @@ -84,7 +84,8 @@ public class TestBackupBoundaryTests extends TestBackupBase { /** * Verify that full backup fails on tableset containing real and fake tables. - * @throws Exception + * + * @throws Exception if doing the full backup fails */ @Test(expected = IOException.class) public void testFullBackupMixExistAndDNE() throws Exception { http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDelete.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDelete.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDelete.java index 0dd3de9..517d516 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDelete.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDelete.java @@ -38,13 +38,13 @@ import org.apache.hbase.thirdparty.com.google.common.collect.Lists; @Category(LargeTests.class) public class TestBackupDelete extends TestBackupBase { - private static final Logger LOG = LoggerFactory.getLogger(TestBackupDelete.class); /** * Verify that full backup is created on a single table with data correctly. Verify that history - * works as expected - * @throws Exception + * works as expected. + * + * @throws Exception if doing the backup or an operation on the tables fails */ @Test public void testBackupDelete() throws Exception { @@ -70,8 +70,9 @@ public class TestBackupDelete extends TestBackupBase { /** * Verify that full backup is created on a single table with data correctly. Verify that history - * works as expected - * @throws Exception + * works as expected. + * + * @throws Exception if doing the backup or an operation on the tables fails */ @Test public void testBackupDeleteCommand() throws Exception { @@ -97,5 +98,4 @@ public class TestBackupDelete extends TestBackupBase { LOG.info(baos.toString()); assertTrue(output.indexOf("Deleted 1 backups") >= 0); } - } http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteRestore.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteRestore.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteRestore.java index 114480e..86cd276 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteRestore.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteRestore.java @@ -30,17 +30,16 @@ import org.apache.hbase.thirdparty.com.google.common.collect.Lists; @Category(MediumTests.class) public class TestBackupDeleteRestore extends TestBackupBase { - private static final Logger LOG = LoggerFactory.getLogger(TestBackupDeleteRestore.class); /** * Verify that load data- backup - delete some data - restore works as expected - deleted data get * restored. - * @throws Exception + * + * @throws Exception if doing the backup or an operation on the tables fails */ @Test public void testBackupDeleteRestore() throws Exception { - LOG.info("test full restore on a single table empty table"); List<TableName> tables = Lists.newArrayList(table1); http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteWithFailures.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteWithFailures.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteWithFailures.java index 9447f28..66cb762 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteWithFailures.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDeleteWithFailures.java @@ -56,12 +56,9 @@ import org.apache.hbase.thirdparty.com.google.common.collect.Lists; */ @Category(LargeTests.class) public class TestBackupDeleteWithFailures extends TestBackupBase{ - private static final Logger LOG = LoggerFactory.getLogger(TestBackupDeleteWithFailures.class); - - - public static enum Failure { + public enum Failure { NO_FAILURES, PRE_SNAPSHOT_FAILURE, PRE_DELETE_SNAPSHOT_FAILURE, @@ -69,7 +66,7 @@ public class TestBackupDeleteWithFailures extends TestBackupBase{ } public static class MasterSnapshotObserver implements MasterCoprocessor, MasterObserver { - List<Failure> failures = new ArrayList<Failure>(); + List<Failure> failures = new ArrayList<>(); public void setFailures(Failure ... f) { failures.clear(); @@ -86,18 +83,17 @@ public class TestBackupDeleteWithFailures extends TestBackupBase{ @Override public void preSnapshot(final ObserverContext<MasterCoprocessorEnvironment> ctx, final SnapshotDescription snapshot, final TableDescriptor hTableDescriptor) - throws IOException - { - if (failures.contains(Failure.PRE_SNAPSHOT_FAILURE)) { - throw new IOException ("preSnapshot"); - } + throws IOException { + if (failures.contains(Failure.PRE_SNAPSHOT_FAILURE)) { + throw new IOException("preSnapshot"); + } } @Override public void preDeleteSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, SnapshotDescription snapshot) throws IOException { if (failures.contains(Failure.PRE_DELETE_SNAPSHOT_FAILURE)) { - throw new IOException ("preDeleteSnapshot"); + throw new IOException("preDeleteSnapshot"); } } @@ -105,14 +101,13 @@ public class TestBackupDeleteWithFailures extends TestBackupBase{ public void postDeleteSnapshot(ObserverContext<MasterCoprocessorEnvironment> ctx, SnapshotDescription snapshot) throws IOException { if (failures.contains(Failure.POST_DELETE_SNAPSHOT_FAILURE)) { - throw new IOException ("postDeleteSnapshot"); + throw new IOException("postDeleteSnapshot"); } } - } /** - * @throws java.lang.Exception + * @throws Exception if starting the mini cluster or setting up the tables fails */ @Override @Before @@ -123,21 +118,20 @@ public class TestBackupDeleteWithFailures extends TestBackupBase{ super.setUp(); } - private MasterSnapshotObserver getMasterSnapshotObserver() { return TEST_UTIL.getHBaseCluster().getMaster().getMasterCoprocessorHost() .findCoprocessor(MasterSnapshotObserver.class); } @Test - public void testBackupDeleteWithFailures() throws Exception - { - testBackupDeleteWithFailuresAfter(1, Failure.PRE_DELETE_SNAPSHOT_FAILURE); - testBackupDeleteWithFailuresAfter(0, Failure.POST_DELETE_SNAPSHOT_FAILURE); - testBackupDeleteWithFailuresAfter(1, Failure.PRE_SNAPSHOT_FAILURE); + public void testBackupDeleteWithFailures() throws Exception { + testBackupDeleteWithFailuresAfter(1, Failure.PRE_DELETE_SNAPSHOT_FAILURE); + testBackupDeleteWithFailuresAfter(0, Failure.POST_DELETE_SNAPSHOT_FAILURE); + testBackupDeleteWithFailuresAfter(1, Failure.PRE_SNAPSHOT_FAILURE); } - private void testBackupDeleteWithFailuresAfter(int expected, Failure ...failures) throws Exception { + private void testBackupDeleteWithFailuresAfter(int expected, Failure ...failures) + throws Exception { LOG.info("test repair backup delete on a single table with data and failures "+ failures[0]); List<TableName> tableList = Lists.newArrayList(table1); String backupId = fullTableBackup(tableList); @@ -158,11 +152,13 @@ public class TestBackupDeleteWithFailures extends TestBackupBase{ try { getBackupAdmin().deleteBackups(backupIds); } catch(IOException e) { - if(expected != 1) assertTrue(false); + if(expected != 1) { + assertTrue(false); + } } // Verify that history length == expected after delete failure - assertTrue (table.getBackupHistory().size() == expected); + assertTrue(table.getBackupHistory().size() == expected); String[] ids = table.getListOfBackupIdsFromDeleteOperation(); @@ -183,7 +179,7 @@ public class TestBackupDeleteWithFailures extends TestBackupBase{ int ret = ToolRunner.run(conf1, new BackupDriver(), args); assertTrue(ret == 0); // Verify that history length == 0 - assertTrue (table.getBackupHistory().size() == 0); + assertTrue(table.getBackupHistory().size() == 0); ids = table.getListOfBackupIdsFromDeleteOperation(); // Verify that we do not have delete record in backup system table @@ -192,7 +188,4 @@ public class TestBackupDeleteWithFailures extends TestBackupBase{ table.close(); admin.close(); } - - - } http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDescribe.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDescribe.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDescribe.java index 2f111e2..8e19076 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDescribe.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupDescribe.java @@ -39,16 +39,15 @@ import org.apache.hbase.thirdparty.com.google.common.collect.Lists; @Category(LargeTests.class) public class TestBackupDescribe extends TestBackupBase { - private static final Logger LOG = LoggerFactory.getLogger(TestBackupDescribe.class); /** - * Verify that describe works as expected if incorrect backup Id is supplied - * @throws Exception + * Verify that describe works as expected if incorrect backup Id is supplied. + * + * @throws Exception if creating the {@link BackupDriver} fails */ @Test public void testBackupDescribe() throws Exception { - LOG.info("test backup describe on a single table with data"); String[] args = new String[] { "describe", "backup_2" }; @@ -75,7 +74,6 @@ public class TestBackupDescribe extends TestBackupBase { @Test public void testBackupDescribeCommand() throws Exception { - LOG.info("test backup describe on a single table with data: command-line"); List<TableName> tableList = Lists.newArrayList(table1); @@ -103,7 +101,5 @@ public class TestBackupDescribe extends TestBackupBase { String desc = status.getShortDescription(); table.close(); assertTrue(response.indexOf(desc) >= 0); - } - } http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupHFileCleaner.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupHFileCleaner.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupHFileCleaner.java index c2c3e59..0a54a2d 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupHFileCleaner.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupHFileCleaner.java @@ -57,7 +57,7 @@ public class TestBackupHFileCleaner { Path root; /** - * @throws java.lang.Exception + * @throws Exception if starting the mini cluster or getting the filesystem fails */ @BeforeClass public static void setUpBeforeClass() throws Exception { @@ -68,7 +68,7 @@ public class TestBackupHFileCleaner { } /** - * @throws java.lang.Exception + * @throws Exception if closing the filesystem or shutting down the mini cluster fails */ @AfterClass public static void tearDownAfterClass() throws Exception { @@ -110,7 +110,9 @@ public class TestBackupHFileCleaner { deletable = cleaner.getDeletableFiles(stats); boolean found = false; for (FileStatus stat1 : deletable) { - if (stat.equals(stat1)) found = true; + if (stat.equals(stat1)) { + found = true; + } } assertTrue("Cleaner should allow to delete this file as there is no hfile reference " + "for it.", found); @@ -133,7 +135,9 @@ public class TestBackupHFileCleaner { deletable = cleaner.getDeletableFiles(stats); found = false; for (FileStatus stat1 : deletable) { - if (stat.equals(stat1)) found = true; + if (stat.equals(stat1)) { + found = true; + } } assertFalse("Cleaner should not allow to delete this file as there is a hfile reference " + "for it.", found); http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupShowHistory.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupShowHistory.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupShowHistory.java index 76838f9..16c79fd 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupShowHistory.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupShowHistory.java @@ -37,7 +37,6 @@ import org.apache.hbase.thirdparty.com.google.common.collect.Lists; @Category(LargeTests.class) public class TestBackupShowHistory extends TestBackupBase { - private static final Logger LOG = LoggerFactory.getLogger(TestBackupShowHistory.class); private boolean findBackup(List<BackupInfo> history, String backupId) { @@ -54,8 +53,9 @@ public class TestBackupShowHistory extends TestBackupBase { /** * Verify that full backup is created on a single table with data correctly. Verify that history - * works as expected - * @throws Exception + * works as expected. + * + * @throws Exception if doing the backup or an operation on the tables fails */ @Test public void testBackupHistory() throws Exception { @@ -69,12 +69,7 @@ public class TestBackupShowHistory extends TestBackupBase { List<BackupInfo> history = getBackupAdmin().getHistory(10); assertTrue(findBackup(history, backupId)); - BackupInfo.Filter nullFilter = new BackupInfo.Filter() { - @Override - public boolean apply(BackupInfo info) { - return true; - } - }; + BackupInfo.Filter nullFilter = info -> true; history = BackupUtils.getHistory(conf1, 10, new Path(BACKUP_ROOT_DIR), nullFilter); assertTrue(findBackup(history, backupId)); @@ -95,20 +90,17 @@ public class TestBackupShowHistory extends TestBackupBase { String backupId2 = fullTableBackup(tableList); assertTrue(checkSucceeded(backupId2)); LOG.info("backup complete: " + table2); - BackupInfo.Filter tableNameFilter = new BackupInfo.Filter() { - @Override - public boolean apply(BackupInfo image) { - if (table1 == null) return true; - List<TableName> names = image.getTableNames(); - return names.contains(table1); + BackupInfo.Filter tableNameFilter = image -> { + if (table1 == null) { + return true; } + + List<TableName> names = image.getTableNames(); + return names.contains(table1); }; - BackupInfo.Filter tableSetFilter = new BackupInfo.Filter() { - @Override - public boolean apply(BackupInfo info) { - String backupId = info.getBackupId(); - return backupId.startsWith("backup"); - } + BackupInfo.Filter tableSetFilter = info -> { + String backupId1 = info.getBackupId(); + return backupId1.startsWith("backup"); }; history = getBackupAdmin().getHistory(10, tableNameFilter, tableSetFilter); @@ -143,5 +135,4 @@ public class TestBackupShowHistory extends TestBackupBase { assertTrue(ret == 0); LOG.info("show_history"); } - } http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupStatusProgress.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupStatusProgress.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupStatusProgress.java index ac0dc61..f9793c9 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupStatusProgress.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupStatusProgress.java @@ -36,16 +36,15 @@ import org.apache.hbase.thirdparty.com.google.common.collect.Lists; @Category(LargeTests.class) public class TestBackupStatusProgress extends TestBackupBase { - private static final Logger LOG = LoggerFactory.getLogger(TestBackupStatusProgress.class); /** * Verify that full backup is created on a single table with data correctly. - * @throws Exception + * + * @throws Exception if doing the backup or an operation on the tables fails */ @Test public void testBackupStatusProgress() throws Exception { - LOG.info("test backup status/progress on a single table with data"); List<TableName> tableList = Lists.newArrayList(table1); @@ -63,7 +62,6 @@ public class TestBackupStatusProgress extends TestBackupBase { @Test public void testBackupStatusProgressCommand() throws Exception { - LOG.info("test backup status/progress on a single table with data: command-line"); List<TableName> tableList = Lists.newArrayList(table1); @@ -90,6 +88,5 @@ public class TestBackupStatusProgress extends TestBackupBase { assertTrue(responce.indexOf(backupId) >= 0); assertTrue(responce.indexOf("progress") > 0); assertTrue(responce.indexOf("100") > 0); - } } http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupSystemTable.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupSystemTable.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupSystemTable.java index f5ee268..5b84c90 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupSystemTable.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestBackupSystemTable.java @@ -60,7 +60,6 @@ import org.junit.experimental.categories.Category; */ @Category(MediumTests.class) public class TestBackupSystemTable { - private static final HBaseTestingUtility UTIL = new HBaseTestingUtility(); protected static Configuration conf = UTIL.getConfiguration(); protected static MiniHBaseCluster cluster; @@ -152,9 +151,7 @@ public class TestBackupSystemTable { @Test public void testBackupDelete() throws IOException { - try (BackupSystemTable table = new BackupSystemTable(conn)) { - int n = 10; List<BackupInfo> list = createBackupInfoList(n); @@ -259,7 +256,7 @@ public class TestBackupSystemTable { tables.add(TableName.valueOf("t2")); tables.add(TableName.valueOf("t3")); - HashMap<String, Long> rsTimestampMap = new HashMap<String, Long>(); + HashMap<String, Long> rsTimestampMap = new HashMap<>(); rsTimestampMap.put("rs1:100", 100L); rsTimestampMap.put("rs2:100", 101L); @@ -285,7 +282,7 @@ public class TestBackupSystemTable { tables1.add(TableName.valueOf("t4")); tables1.add(TableName.valueOf("t5")); - HashMap<String, Long> rsTimestampMap1 = new HashMap<String, Long>(); + HashMap<String, Long> rsTimestampMap1 = new HashMap<>(); rsTimestampMap1.put("rs1:100", 200L); rsTimestampMap1.put("rs2:100", 201L); @@ -460,7 +457,7 @@ public class TestBackupSystemTable { String[] removeTables = new String[] { "table4", "table3" }; table.removeFromBackupSet(setName, removeTables); - Set<String> expectedTables = new HashSet<>(Arrays.asList("table1", "table2")); + Set<String> expectedTables = new HashSet<>(Arrays.asList("table1", "table2")); List<TableName> tnames = table.describeBackupSet(setName); assertTrue(tnames != null); @@ -514,7 +511,6 @@ public class TestBackupSystemTable { } private BackupInfo createBackupInfo() { - BackupInfo ctxt = new BackupInfo("backup_" + System.nanoTime(), BackupType.FULL, new TableName[] { TableName.valueOf("t1"), TableName.valueOf("t2"), TableName.valueOf("t3") }, @@ -525,7 +521,7 @@ public class TestBackupSystemTable { } private List<BackupInfo> createBackupInfoList(int size) { - List<BackupInfo> list = new ArrayList<BackupInfo>(); + List<BackupInfo> list = new ArrayList<>(); for (int i = 0; i < size; i++) { list.add(createBackupInfo()); try { @@ -539,6 +535,8 @@ public class TestBackupSystemTable { @AfterClass public static void tearDown() throws IOException { - if (cluster != null) cluster.shutdown(); + if (cluster != null) { + cluster.shutdown(); + } } } http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullBackupSet.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullBackupSet.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullBackupSet.java index 7705b1d..41d0c98 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullBackupSet.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullBackupSet.java @@ -36,16 +36,15 @@ import org.slf4j.LoggerFactory; @Category(LargeTests.class) public class TestFullBackupSet extends TestBackupBase { - private static final Logger LOG = LoggerFactory.getLogger(TestFullBackupSet.class); /** * Verify that full backup is created on a single table with data correctly. - * @throws Exception + * + * @throws Exception if doing the backup or an operation on the tables fails */ @Test public void testFullBackupSetExist() throws Exception { - LOG.info("Test full backup, backup set exists"); // Create set @@ -83,21 +82,16 @@ public class TestFullBackupSet extends TestBackupBase { TEST_UTIL.deleteTable(table1_restore); LOG.info("restore into other table is complete"); hba.close(); - } - } @Test public void testFullBackupSetDoesNotExist() throws Exception { - LOG.info("test full backup, backup set does not exist"); String name = "name1"; String[] args = new String[] { "create", "full", BACKUP_ROOT_DIR, "-s", name }; // Run backup int ret = ToolRunner.run(conf1, new BackupDriver(), args); assertTrue(ret != 0); - } - } http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullRestore.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullRestore.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullRestore.java index 0e5ab33..1821a3e 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullRestore.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestFullRestore.java @@ -31,16 +31,15 @@ import org.apache.hbase.thirdparty.com.google.common.collect.Lists; @Category(LargeTests.class) public class TestFullRestore extends TestBackupBase { - private static final Logger LOG = LoggerFactory.getLogger(TestFullRestore.class); /** - * Verify that a single table is restored to a new table - * @throws Exception + * Verify that a single table is restored to a new table. + * + * @throws Exception if doing the backup, restoring it or an operation on the tables fails */ @Test public void testFullRestoreSingle() throws Exception { - LOG.info("test full restore on a single table empty table"); List<TableName> tables = Lists.newArrayList(table1); @@ -60,11 +59,8 @@ public class TestFullRestore extends TestBackupBase { hba.close(); } - - @Test public void testFullRestoreSingleCommand() throws Exception { - LOG.info("test full restore on a single table empty table: command-line"); List<TableName> tables = Lists.newArrayList(table1); @@ -87,7 +83,6 @@ public class TestFullRestore extends TestBackupBase { @Test public void testFullRestoreCheckCommand() throws Exception { - LOG.info("test full restore on a single table: command-line, check only"); List<TableName> tables = Lists.newArrayList(table1); @@ -108,7 +103,8 @@ public class TestFullRestore extends TestBackupBase { /** * Verify that multiple tables are restored to new tables. - * @throws Exception + * + * @throws Exception if doing the backup, restoring it or an operation on the tables fails */ @Test public void testFullRestoreMultiple() throws Exception { @@ -132,7 +128,8 @@ public class TestFullRestore extends TestBackupBase { /** * Verify that multiple tables are restored to new tables. - * @throws Exception + * + * @throws Exception if doing the backup, restoring it or an operation on the tables fails */ @Test public void testFullRestoreMultipleCommand() throws Exception { @@ -161,12 +158,12 @@ public class TestFullRestore extends TestBackupBase { } /** - * Verify that a single table is restored using overwrite - * @throws Exception + * Verify that a single table is restored using overwrite. + * + * @throws Exception if doing the backup or restoring it fails */ @Test public void testFullRestoreSingleOverwrite() throws Exception { - LOG.info("test full restore on a single table empty table"); List<TableName> tables = Lists.newArrayList(table1); String backupId = fullTableBackup(tables); @@ -181,12 +178,12 @@ public class TestFullRestore extends TestBackupBase { } /** - * Verify that a single table is restored using overwrite - * @throws Exception + * Verify that a single table is restored using overwrite. + * + * @throws Exception if doing the backup or an operation on the tables fails */ @Test public void testFullRestoreSingleOverwriteCommand() throws Exception { - LOG.info("test full restore on a single table empty table: command-line"); List<TableName> tables = Lists.newArrayList(table1); String backupId = fullTableBackup(tables); @@ -203,12 +200,12 @@ public class TestFullRestore extends TestBackupBase { HBaseAdmin hba = TEST_UTIL.getHBaseAdmin(); assertTrue(hba.tableExists(table1)); hba.close(); - } /** * Verify that multiple tables are restored to new tables using overwrite. - * @throws Exception + * + * @throws Exception if doing the backup or restoring it fails */ @Test public void testFullRestoreMultipleOverwrite() throws Exception { @@ -226,7 +223,8 @@ public class TestFullRestore extends TestBackupBase { /** * Verify that multiple tables are restored to new tables using overwrite. - * @throws Exception + * + * @throws Exception if doing the backup or an operation on the tables fails */ @Test public void testFullRestoreMultipleOverwriteCommand() throws Exception { @@ -253,11 +251,11 @@ public class TestFullRestore extends TestBackupBase { /** * Verify that restore fails on a single table that does not exist. - * @throws Exception + * + * @throws Exception if doing the backup or restoring it fails */ @Test(expected = IOException.class) public void testFullRestoreSingleDNE() throws Exception { - LOG.info("test restore fails on a single table that does not exist"); List<TableName> tables = Lists.newArrayList(table1); String backupId = fullTableBackup(tables); @@ -274,11 +272,11 @@ public class TestFullRestore extends TestBackupBase { /** * Verify that restore fails on a single table that does not exist. - * @throws Exception + * + * @throws Exception if doing the backup or restoring it fails */ @Test public void testFullRestoreSingleDNECommand() throws Exception { - LOG.info("test restore fails on a single table that does not exist: command-line"); List<TableName> tables = Lists.newArrayList(table1); String backupId = fullTableBackup(tables); @@ -294,16 +292,15 @@ public class TestFullRestore extends TestBackupBase { // Run restore int ret = ToolRunner.run(conf1, new RestoreDriver(), args); assertTrue(ret != 0); - } /** * Verify that restore fails on multiple tables that do not exist. - * @throws Exception + * + * @throws Exception if doing the backup or restoring it fails */ @Test(expected = IOException.class) public void testFullRestoreMultipleDNE() throws Exception { - LOG.info("test restore fails on multiple tables that do not exist"); List<TableName> tables = Lists.newArrayList(table2, table3); @@ -320,11 +317,11 @@ public class TestFullRestore extends TestBackupBase { /** * Verify that restore fails on multiple tables that do not exist. - * @throws Exception + * + * @throws Exception if doing the backup or restoring it fails */ @Test public void testFullRestoreMultipleDNECommand() throws Exception { - LOG.info("test restore fails on multiple tables that do not exist: command-line"); List<TableName> tables = Lists.newArrayList(table2, table3); http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestIncrementalBackupMergeWithFailures.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestIncrementalBackupMergeWithFailures.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestIncrementalBackupMergeWithFailures.java index 0ec78be..55c14ac 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestIncrementalBackupMergeWithFailures.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestIncrementalBackupMergeWithFailures.java @@ -55,13 +55,13 @@ public class TestIncrementalBackupMergeWithFailures extends TestBackupBase { private static final Logger LOG = LoggerFactory.getLogger(TestIncrementalBackupMergeWithFailures.class); - static enum FailurePhase { + enum FailurePhase { PHASE1, PHASE2, PHASE3, PHASE4 } + public final static String FAILURE_PHASE_KEY = "failurePhase"; static class BackupMergeJobWithFailures extends MapReduceBackupMergeJob { - FailurePhase failurePhase; @Override @@ -75,7 +75,6 @@ public class TestIncrementalBackupMergeWithFailures extends TestBackupBase { } } - /** * This is the exact copy of parent's run() with injections * of different types of failures @@ -95,14 +94,13 @@ public class TestIncrementalBackupMergeWithFailures extends TestBackupBase { LOG.debug("Merge backup images " + bids); } - List<Pair<TableName, Path>> processedTableList = new ArrayList<Pair<TableName, Path>>(); + List<Pair<TableName, Path>> processedTableList = new ArrayList<>(); boolean finishedTables = false; Connection conn = ConnectionFactory.createConnection(getConf()); BackupSystemTable table = new BackupSystemTable(conn); FileSystem fs = FileSystem.get(getConf()); try { - // Start backup exclusive operation table.startBackupExclusiveOperation(); // Start merge operation @@ -112,19 +110,16 @@ public class TestIncrementalBackupMergeWithFailures extends TestBackupBase { String mergedBackupId = findMostRecentBackupId(backupIds); TableName[] tableNames = getTableNamesInBackupImages(backupIds); - String backupRoot = null; BackupInfo bInfo = table.readBackupInfo(backupIds[0]); - backupRoot = bInfo.getBackupRootDir(); + String backupRoot = bInfo.getBackupRootDir(); // PHASE 1 checkFailure(FailurePhase.PHASE1); for (int i = 0; i < tableNames.length; i++) { - LOG.info("Merge backup images for " + tableNames[i]); // Find input directories for table - Path[] dirPaths = findInputDirectories(fs, backupRoot, tableNames[i], backupIds); String dirs = StringUtils.join(dirPaths, ","); Path bulkOutputPath = @@ -140,14 +135,13 @@ public class TestIncrementalBackupMergeWithFailures extends TestBackupBase { conf.set(bulkOutputConfKey, bulkOutputPath.toString()); String[] playerArgs = { dirs, tableNames[i].getNameAsString() }; - int result = 0; // PHASE 2 checkFailure(FailurePhase.PHASE2); player.setConf(getConf()); - result = player.run(playerArgs); + int result = player.run(playerArgs); if (succeeded(result)) { // Add to processed table list - processedTableList.add(new Pair<TableName, Path>(tableNames[i], bulkOutputPath)); + processedTableList.add(new Pair<>(tableNames[i], bulkOutputPath)); } else { throw new IOException("Can not merge backup images for " + dirs + " (check Hadoop/MR and HBase logs). Player return code =" + result); @@ -193,21 +187,17 @@ public class TestIncrementalBackupMergeWithFailures extends TestBackupBase { table.close(); conn.close(); } - } private void checkFailure(FailurePhase phase) throws IOException { - if ( failurePhase != null && failurePhase == phase) { - throw new IOException (phase.toString()); + if (failurePhase != null && failurePhase == phase) { + throw new IOException(phase.toString()); } } - } - @Test public void TestIncBackupMergeRestore() throws Exception { - int ADD_ROWS = 99; // #1 - create full backup for all tables LOG.info("create full backup image for all tables"); @@ -219,8 +209,7 @@ public class TestIncrementalBackupMergeWithFailures extends TestBackupBase { Connection conn = ConnectionFactory.createConnection(conf1); - HBaseAdmin admin = null; - admin = (HBaseAdmin) conn.getAdmin(); + HBaseAdmin admin = (HBaseAdmin) conn.getAdmin(); BackupAdminImpl client = new BackupAdminImpl(conn); BackupRequest request = createBackupRequest(BackupType.FULL, tables, BACKUP_ROOT_DIR); @@ -262,7 +251,7 @@ public class TestIncrementalBackupMergeWithFailures extends TestBackupBase { // #4 Merge backup images with failures - for ( FailurePhase phase : FailurePhase.values()) { + for (FailurePhase phase : FailurePhase.values()) { Configuration conf = conn.getConfiguration(); conf.set(FAILURE_PHASE_KEY, phase.toString()); @@ -329,7 +318,5 @@ public class TestIncrementalBackupMergeWithFailures extends TestBackupBase { admin.close(); conn.close(); - } - } http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestIncrementalBackupWithBulkLoad.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestIncrementalBackupWithBulkLoad.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestIncrementalBackupWithBulkLoad.java index ed1d010..5c29b3d 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestIncrementalBackupWithBulkLoad.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestIncrementalBackupWithBulkLoad.java @@ -34,7 +34,6 @@ import org.apache.hadoop.hbase.client.ConnectionFactory; import org.apache.hadoop.hbase.client.HBaseAdmin; import org.apache.hadoop.hbase.client.HTable; import org.apache.hadoop.hbase.client.Put; -import org.apache.hbase.thirdparty.com.google.common.collect.Lists; import org.apache.hadoop.hbase.testclassification.LargeTests; import org.apache.hadoop.hbase.tool.TestLoadIncrementalHFiles; import org.apache.hadoop.hbase.util.Bytes; @@ -47,6 +46,8 @@ import org.junit.runners.Parameterized; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.apache.hbase.thirdparty.com.google.common.collect.Lists; + /** * 1. Create table t1 * 2. Load data to t1 @@ -63,13 +64,14 @@ public class TestIncrementalBackupWithBulkLoad extends TestBackupBase { @Parameterized.Parameters public static Collection<Object[]> data() { secure = true; - List<Object[]> params = new ArrayList<Object[]>(); + List<Object[]> params = new ArrayList<>(); params.add(new Object[] {Boolean.TRUE}); return params; } public TestIncrementalBackupWithBulkLoad(Boolean b) { } + // implement all test cases in 1 test since incremental backup/restore has dependencies @Test public void TestIncBackupDeleteTable() throws Exception { @@ -78,9 +80,8 @@ public class TestIncrementalBackupWithBulkLoad extends TestBackupBase { LOG.info("create full backup image for all tables"); List<TableName> tables = Lists.newArrayList(table1); - HBaseAdmin admin = null; Connection conn = ConnectionFactory.createConnection(conf1); - admin = (HBaseAdmin) conn.getAdmin(); + HBaseAdmin admin = (HBaseAdmin) conn.getAdmin(); BackupAdminImpl client = new BackupAdminImpl(conn); BackupRequest request = createBackupRequest(BackupType.FULL, tables, BACKUP_ROOT_DIR); @@ -104,9 +105,9 @@ public class TestIncrementalBackupWithBulkLoad extends TestBackupBase { LOG.debug("bulk loading into " + testName); int actual = TestLoadIncrementalHFiles.loadHFiles(testName, table1Desc, TEST_UTIL, famName, qualName, false, null, new byte[][][] { - new byte[][]{ Bytes.toBytes("aaaa"), Bytes.toBytes("cccc") }, - new byte[][]{ Bytes.toBytes("ddd"), Bytes.toBytes("ooo") }, - }, true, false, true, NB_ROWS_IN_BATCH*2, NB_ROWS2); + new byte[][]{ Bytes.toBytes("aaaa"), Bytes.toBytes("cccc") }, + new byte[][]{ Bytes.toBytes("ddd"), Bytes.toBytes("ooo") }, + }, true, false, true, NB_ROWS_IN_BATCH*2, NB_ROWS2); // #3 - incremental backup for table1 tables = Lists.newArrayList(table1); @@ -118,7 +119,7 @@ public class TestIncrementalBackupWithBulkLoad extends TestBackupBase { int actual1 = TestLoadIncrementalHFiles.loadHFiles(testName, table1Desc, TEST_UTIL, famName, qualName, false, null, new byte[][][] { new byte[][] { Bytes.toBytes("ppp"), Bytes.toBytes("qqq") }, - new byte[][] { Bytes.toBytes("rrr"), Bytes.toBytes("sss") }, }, + new byte[][] { Bytes.toBytes("rrr"), Bytes.toBytes("sss") }, }, true, false, true, NB_ROWS_IN_BATCH * 2 + actual, NB_ROWS2); // #5 - incremental backup for table1 @@ -144,7 +145,7 @@ public class TestIncrementalBackupWithBulkLoad extends TestBackupBase { backupIdFull = client.backupTables(request); try (final BackupSystemTable table = new BackupSystemTable(conn)) { Pair<Map<TableName, Map<String, Map<String, List<Pair<String, Boolean>>>>>, List<byte[]>> pair - = table.readBulkloadRows(tables); + = table.readBulkloadRows(tables); assertTrue("map still has " + pair.getSecond().size() + " entries", pair.getSecond().isEmpty()); } @@ -154,5 +155,4 @@ public class TestIncrementalBackupWithBulkLoad extends TestBackupBase { admin.close(); conn.close(); } - } http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRemoteBackup.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRemoteBackup.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRemoteBackup.java index bb4c52b..5aa5305 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRemoteBackup.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRemoteBackup.java @@ -38,18 +38,18 @@ import org.apache.hbase.thirdparty.com.google.common.collect.Lists; @Category(LargeTests.class) public class TestRemoteBackup extends TestBackupBase { - private static final Logger LOG = LoggerFactory.getLogger(TestRemoteBackup.class); @Override - public void setUp () throws Exception { + public void setUp() throws Exception { useSecondCluster = true; super.setUp(); } /** * Verify that a remote full backup is created on a single table with data correctly. - * @throws Exception + * + * @throws Exception if an operation on the table fails */ @Test public void testFullBackupRemote() throws Exception { @@ -59,28 +59,25 @@ public class TestRemoteBackup extends TestBackupBase { final byte[] fam3Name = Bytes.toBytes("f3"); final byte[] fam2Name = Bytes.toBytes("f2"); final Connection conn = ConnectionFactory.createConnection(conf1); - Thread t = new Thread() { - @Override - public void run() { - try { - latch.await(); - } catch (InterruptedException ie) { - } - try { - HTable t1 = (HTable) conn.getTable(table1); - Put p1; - for (int i = 0; i < NB_ROWS_IN_FAM3; i++) { - p1 = new Put(Bytes.toBytes("row-t1" + i)); - p1.addColumn(fam3Name, qualName, Bytes.toBytes("val" + i)); - t1.put(p1); - } - LOG.debug("Wrote " + NB_ROWS_IN_FAM3 + " rows into family3"); - t1.close(); - } catch (IOException ioe) { - throw new RuntimeException(ioe); + Thread t = new Thread(() -> { + try { + latch.await(); + } catch (InterruptedException ie) { + } + try { + HTable t1 = (HTable) conn.getTable(table1); + Put p1; + for (int i = 0; i < NB_ROWS_IN_FAM3; i++) { + p1 = new Put(Bytes.toBytes("row-t1" + i)); + p1.addColumn(fam3Name, qualName, Bytes.toBytes("val" + i)); + t1.put(p1); } + LOG.debug("Wrote " + NB_ROWS_IN_FAM3 + " rows into family3"); + t1.close(); + } catch (IOException ioe) { + throw new RuntimeException(ioe); } - }; + }); t.start(); table1Desc.addFamily(new HColumnDescriptor(fam3Name)); http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRemoteRestore.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRemoteRestore.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRemoteRestore.java index 20bd88a..c7b6192 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRemoteRestore.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRemoteRestore.java @@ -24,23 +24,21 @@ import org.slf4j.LoggerFactory; @Category(LargeTests.class) public class TestRemoteRestore extends TestBackupBase { - private static final Logger LOG = LoggerFactory.getLogger(TestRemoteRestore.class); @Override - public void setUp () throws Exception { + public void setUp() throws Exception { useSecondCluster = true; super.setUp(); } - /** * Verify that a remote restore on a single table is successful. - * @throws Exception + * + * @throws Exception if doing the backup or an operation on the tables fails */ @Test public void testFullRestoreRemote() throws Exception { - LOG.info("test remote full backup on a single table"); String backupId = backupTables(BackupType.FULL, toList(table1.getNameAsString()), BACKUP_REMOTE_ROOT_DIR); @@ -55,5 +53,4 @@ public class TestRemoteRestore extends TestBackupBase { TEST_UTIL.deleteTable(table1_restore); hba.close(); } - } http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRepairAfterFailedDelete.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRepairAfterFailedDelete.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRepairAfterFailedDelete.java index bb0052d..5ae51fe 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRepairAfterFailedDelete.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRepairAfterFailedDelete.java @@ -38,7 +38,6 @@ import org.apache.hbase.thirdparty.com.google.common.collect.Lists; @Category(LargeTests.class) public class TestRepairAfterFailedDelete extends TestBackupBase { - private static final Logger LOG = LoggerFactory.getLogger(TestRepairAfterFailedDelete.class); @Test @@ -83,10 +82,8 @@ public class TestRepairAfterFailedDelete extends TestBackupBase { int ret = ToolRunner.run(conf1, new BackupDriver(), args); assertTrue(ret == 0); // Verify that history length == 0 - assertTrue (table.getBackupHistory().size() == 0); + assertTrue(table.getBackupHistory().size() == 0); table.close(); admin.close(); } - - } http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRestoreBoundaryTests.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRestoreBoundaryTests.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRestoreBoundaryTests.java index eba3b37..6eccb3c 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRestoreBoundaryTests.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestRestoreBoundaryTests.java @@ -33,12 +33,12 @@ import org.slf4j.LoggerFactory; @Category(LargeTests.class) public class TestRestoreBoundaryTests extends TestBackupBase { - private static final Logger LOG = LoggerFactory.getLogger(TestRestoreBoundaryTests.class); /** - * Verify that a single empty table is restored to a new table - * @throws Exception + * Verify that a single empty table is restored to a new table. + * + * @throws Exception if doing the backup or an operation on the tables fails */ @Test public void testFullRestoreSingleEmpty() throws Exception { @@ -57,7 +57,8 @@ public class TestRestoreBoundaryTests extends TestBackupBase { /** * Verify that multiple tables are restored to new tables. - * @throws Exception + * + * @throws Exception if doing the backup or an operation on the tables fails */ @Test public void testFullRestoreMultipleEmpty() throws Exception { http://git-wip-us.apache.org/repos/asf/hbase/blob/c2236b77/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestSystemTableSnapshot.java ---------------------------------------------------------------------- diff --git a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestSystemTableSnapshot.java b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestSystemTableSnapshot.java index 31d11e2..6703b3d 100644 --- a/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestSystemTableSnapshot.java +++ b/hbase-backup/src/test/java/org/apache/hadoop/hbase/backup/TestSystemTableSnapshot.java @@ -28,16 +28,15 @@ import org.slf4j.LoggerFactory; @Category(LargeTests.class) public class TestSystemTableSnapshot extends TestBackupBase { - private static final Logger LOG = LoggerFactory.getLogger(TestSystemTableSnapshot.class); /** - * Verify backup system table snapshot - * @throws Exception + * Verify backup system table snapshot. + * + * @throws Exception if an operation on the table fails */ // @Test public void _testBackupRestoreSystemTable() throws Exception { - LOG.info("test snapshot system table"); TableName backupSystem = BackupSystemTable.getTableName(conf1); @@ -51,5 +50,4 @@ public class TestSystemTableSnapshot extends TestBackupBase { hba.enableTable(backupSystem); hba.close(); } - }