|
59 | 59 | import org.apache.hadoop.hbase.util.Bytes;
|
60 | 60 | import org.apache.hadoop.hbase.util.CommonFSUtils;
|
61 | 61 | import org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
|
62 |
| -import org.apache.hadoop.hbase.util.HFileArchiveUtil; |
63 | 62 | import org.apache.hadoop.hbase.util.HFileTestUtil;
|
64 | 63 | import org.junit.After;
|
65 | 64 | import org.junit.Assert;
|
@@ -433,73 +432,6 @@ public void TestIncBackupRestoreWithOriginalSplitsSeperateFs() throws Exception
|
433 | 432 |
|
434 | 433 | }
|
435 | 434 |
|
436 |
| - @Test |
437 |
| - public void TestIncBackupRestoreHandlesArchivedFiles() throws Exception { |
438 |
| - byte[] fam2 = Bytes.toBytes("f2"); |
439 |
| - TableDescriptor newTable1Desc = TableDescriptorBuilder.newBuilder(table1Desc) |
440 |
| - .setColumnFamily(ColumnFamilyDescriptorBuilder.newBuilder(fam2).build()).build(); |
441 |
| - TEST_UTIL.getAdmin().modifyTable(newTable1Desc); |
442 |
| - try (Connection conn = ConnectionFactory.createConnection(conf1); |
443 |
| - BackupAdminImpl admin = new BackupAdminImpl(conn)) { |
444 |
| - String backupTargetDir = TEST_UTIL.getDataTestDir("backupTarget").toString(); |
445 |
| - BACKUP_ROOT_DIR = new File(backupTargetDir).toURI().toString(); |
446 |
| - |
447 |
| - List<TableName> tables = Lists.newArrayList(table1); |
448 |
| - |
449 |
| - insertIntoTable(conn, table1, famName, 3, 100); |
450 |
| - String fullBackupId = takeFullBackup(tables, admin, true); |
451 |
| - assertTrue(checkSucceeded(fullBackupId)); |
452 |
| - |
453 |
| - insertIntoTable(conn, table1, famName, 4, 100); |
454 |
| - |
455 |
| - HRegion regionToBulkload = TEST_UTIL.getHBaseCluster().getRegions(table1).get(0); |
456 |
| - String regionName = regionToBulkload.getRegionInfo().getEncodedName(); |
457 |
| - // Requires a mult-fam bulkload to ensure we're appropriately handling |
458 |
| - // multi-file bulkloads |
459 |
| - Path regionDir = doBulkload(table1, regionName, famName, fam2); |
460 |
| - |
461 |
| - // archive the files in the region directory |
462 |
| - Path archiveDir = |
463 |
| - HFileArchiveUtil.getStoreArchivePath(conf1, table1, regionName, Bytes.toString(famName)); |
464 |
| - TEST_UTIL.getTestFileSystem().mkdirs(archiveDir); |
465 |
| - RemoteIterator<LocatedFileStatus> iter = |
466 |
| - TEST_UTIL.getTestFileSystem().listFiles(regionDir, true); |
467 |
| - List<Path> paths = new ArrayList<>(); |
468 |
| - while (iter.hasNext()) { |
469 |
| - Path path = iter.next().getPath(); |
470 |
| - if (path.toString().contains("_SeqId_")) { |
471 |
| - paths.add(path); |
472 |
| - } |
473 |
| - } |
474 |
| - assertTrue(paths.size() > 1); |
475 |
| - Path path = paths.get(0); |
476 |
| - String name = path.toString(); |
477 |
| - int startIdx = name.lastIndexOf(Path.SEPARATOR); |
478 |
| - String filename = name.substring(startIdx + 1); |
479 |
| - Path archiveFile = new Path(archiveDir, filename); |
480 |
| - // archive 1 of the files |
481 |
| - boolean success = TEST_UTIL.getTestFileSystem().rename(path, archiveFile); |
482 |
| - assertTrue(success); |
483 |
| - assertTrue(TEST_UTIL.getTestFileSystem().exists(archiveFile)); |
484 |
| - assertFalse(TEST_UTIL.getTestFileSystem().exists(path)); |
485 |
| - |
486 |
| - BackupRequest request = |
487 |
| - createBackupRequest(BackupType.INCREMENTAL, tables, BACKUP_ROOT_DIR, true); |
488 |
| - String incrementalBackupId = admin.backupTables(request); |
489 |
| - assertTrue(checkSucceeded(incrementalBackupId)); |
490 |
| - |
491 |
| - TableName[] fromTable = new TableName[] { table1 }; |
492 |
| - TableName[] toTable = new TableName[] { table1_restore }; |
493 |
| - |
494 |
| - admin.restore(BackupUtils.createRestoreRequest(BACKUP_ROOT_DIR, incrementalBackupId, false, |
495 |
| - fromTable, toTable, true)); |
496 |
| - |
497 |
| - int actualRowCount = TEST_UTIL.countRows(table1_restore); |
498 |
| - int expectedRowCount = TEST_UTIL.countRows(table1); |
499 |
| - assertEquals(expectedRowCount, actualRowCount); |
500 |
| - } |
501 |
| - } |
502 |
| - |
503 | 435 | private void checkThrowsCFMismatch(IOException ex, List<TableName> tables) {
|
504 | 436 | Throwable cause = Throwables.getRootCause(ex);
|
505 | 437 | assertEquals(cause.getClass(), ColumnFamilyMismatchException.class);
|
|
0 commit comments