use of org.apache.hadoop.hbase.TableName in project hbase by apache.
the class TestRemoteRestore method testFullRestoreRemote.
/**
* Verify that a remote restore on a single table is successful.
* @throws Exception
*/
@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);
LOG.info("backup complete");
TableName[] tableset = new TableName[] { table1 };
TableName[] tablemap = new TableName[] { table1_restore };
getBackupAdmin().restore(BackupUtils.createRestoreRequest(BACKUP_REMOTE_ROOT_DIR, backupId, false, tableset, tablemap, false));
HBaseAdmin hba = TEST_UTIL.getHBaseAdmin();
assertTrue(hba.tableExists(table1_restore));
TEST_UTIL.deleteTable(table1_restore);
hba.close();
}
use of org.apache.hadoop.hbase.TableName in project hbase by apache.
the class TestRestoreBoundaryTests method testFullRestoreMultipleEmpty.
/**
* Verify that multiple tables are restored to new tables.
* @throws Exception
*/
@Test
public void testFullRestoreMultipleEmpty() throws Exception {
LOG.info("create full backup image on multiple tables");
List<TableName> tables = toList(table2.getNameAsString(), table3.getNameAsString());
String backupId = fullTableBackup(tables);
TableName[] restore_tableset = new TableName[] { table2, table3 };
TableName[] tablemap = new TableName[] { table2_restore, table3_restore };
getBackupAdmin().restore(BackupUtils.createRestoreRequest(BACKUP_ROOT_DIR, backupId, false, restore_tableset, tablemap, false));
HBaseAdmin hba = TEST_UTIL.getHBaseAdmin();
assertTrue(hba.tableExists(table2_restore));
assertTrue(hba.tableExists(table3_restore));
TEST_UTIL.deleteTable(table2_restore);
TEST_UTIL.deleteTable(table3_restore);
hba.close();
}
use of org.apache.hadoop.hbase.TableName in project hbase by apache.
the class TestBackupSystemTable method testBackupSetRemove.
@Test
public void testBackupSetRemove() throws IOException {
try (BackupSystemTable table = new BackupSystemTable(conn)) {
String[] tables = new String[] { "table1", "table2", "table3", "table4" };
String setName = "name";
table.addToBackupSet(setName, tables);
String[] removeTables = new String[] { "table4", "table3" };
table.removeFromBackupSet(setName, removeTables);
List<TableName> tnames = table.describeBackupSet(setName);
assertTrue(tnames != null);
assertTrue(tnames.size() == tables.length - 2);
for (int i = 0; i < tnames.size(); i++) {
assertTrue(tnames.get(i).getNameAsString().equals("table" + (i + 1)));
}
cleanBackupTable();
}
}
use of org.apache.hadoop.hbase.TableName in project hbase by apache.
the class TestFullRestore method testFullRestoreMultiple.
/**
* Verify that multiple tables are restored to new tables.
* @throws Exception
*/
@Test
public void testFullRestoreMultiple() throws Exception {
LOG.info("create full backup image on multiple tables");
List<TableName> tables = Lists.newArrayList(table2, table3);
String backupId = fullTableBackup(tables);
assertTrue(checkSucceeded(backupId));
TableName[] restore_tableset = new TableName[] { table2, table3 };
TableName[] tablemap = new TableName[] { table2_restore, table3_restore };
BackupAdmin client = getBackupAdmin();
client.restore(BackupUtils.createRestoreRequest(BACKUP_ROOT_DIR, backupId, false, restore_tableset, tablemap, false));
HBaseAdmin hba = TEST_UTIL.getHBaseAdmin();
assertTrue(hba.tableExists(table2_restore));
assertTrue(hba.tableExists(table3_restore));
TEST_UTIL.deleteTable(table2_restore);
TEST_UTIL.deleteTable(table3_restore);
hba.close();
}
use of org.apache.hadoop.hbase.TableName in project hbase by apache.
the class TestFullRestore method testFullRestoreSingle.
/**
* Verify that a single table is restored to a new table
* @throws Exception
*/
@Test
public void testFullRestoreSingle() throws Exception {
LOG.info("test full restore on a single table empty table");
List<TableName> tables = Lists.newArrayList(table1);
String backupId = fullTableBackup(tables);
assertTrue(checkSucceeded(backupId));
LOG.info("backup complete");
TableName[] tableset = new TableName[] { table1 };
TableName[] tablemap = new TableName[] { table1_restore };
BackupAdmin client = getBackupAdmin();
client.restore(BackupUtils.createRestoreRequest(BACKUP_ROOT_DIR, backupId, false, tableset, tablemap, false));
HBaseAdmin hba = TEST_UTIL.getHBaseAdmin();
assertTrue(hba.tableExists(table1_restore));
TEST_UTIL.deleteTable(table1_restore);
hba.close();
}
Aggregations