Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@ private void removeTableFromBackupImage(BackupInfo info, TableName tn, BackupSys
private List<BackupInfo> getAffectedBackupSessions(BackupInfo backupInfo, TableName tn,
BackupSystemTable table) throws IOException {
LOG.debug("GetAffectedBackupInfos for: " + backupInfo.getBackupId() + " table=" + tn);
if (backupInfo.getState() != BackupState.COMPLETE) {
return Collections.emptyList();
}
long ts = backupInfo.getStartTs();
List<BackupInfo> list = new ArrayList<>();
List<BackupInfo> history = table.getBackupHistory(withRoot(backupInfo.getBackupRootDir()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.List;
import java.util.Set;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.backup.BackupInfo.BackupState;
import org.apache.hadoop.hbase.backup.impl.BackupAdminImpl;
Expand Down Expand Up @@ -104,6 +106,25 @@ public void testIncBackupRestore() throws Exception {
// #3 - incremental backup for multiple tables
incrementalBackupWithFailures();

String failedBackupId;
try (BackupSystemTable table = new BackupSystemTable(conn)) {
failedBackupId =
table.getBackupHistory(BackupInfo.withState(BackupState.FAILED)).get(0).getBackupId();
}

conf1.unset(TableBackupClient.BACKUP_CLIENT_IMPL_CLASS);
String backupIdIncremental = client.backupTables(createBackupRequest(BackupType.INCREMENTAL,
Lists.newArrayList(table1, table2), BACKUP_ROOT_DIR));
assertTrue(checkSucceeded(backupIdIncremental));

assertEquals(1, client.deleteBackups(new String[] { failedBackupId }));
assertTrue(checkSucceeded(backupIdIncremental));
try (BackupSystemTable table = new BackupSystemTable(conn)) {
assertNull(table.readBackupInfo(failedBackupId));
assertEquals(Set.of(table1, table2),
Set.copyOf(table.readBackupInfo(backupIdIncremental).getTableNames()));
}

admin.close();
conn.close();

Expand Down