Skip to content

Commit 29886f7

Browse files
rmdmattinglyRay Mattingly
authored andcommitted
HBASE-28697 Don't clean bulk load system entries until backup is complete (#6089)
Co-authored-by: Ray Mattingly <[email protected]>
1 parent 9292059 commit 29886f7

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/IncrementalTableBackupClient.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,13 +104,14 @@ protected static int getIndex(TableName tbl, List<TableName> sTableList) {
104104

105105
/*
106106
* Reads bulk load records from backup table, iterates through the records and forms the paths for
107-
* bulk loaded hfiles. Copies the bulk loaded hfiles to backup destination
107+
* bulk loaded hfiles. Copies the bulk loaded hfiles to backup destination. This method does NOT
108+
* clean up the entries in the bulk load system table. Those entries should not be cleaned until
109+
* the backup is marked as complete.
108110
* @param sTableList list of tables to be backed up
109-
* @return map of table to List of files
111+
* @return the rowkeys of bulk loaded files
110112
*/
111113
@SuppressWarnings("unchecked")
112-
protected Map<byte[], List<Path>>[] handleBulkLoad(List<TableName> sTableList)
113-
throws IOException {
114+
protected List<byte[]> handleBulkLoad(List<TableName> sTableList) throws IOException {
114115
Map<byte[], List<Path>>[] mapForSrc = new Map[sTableList.size()];
115116
List<String> activeFiles = new ArrayList<>();
116117
List<String> archiveFiles = new ArrayList<>();
@@ -192,8 +193,8 @@ protected Map<byte[], List<Path>>[] handleBulkLoad(List<TableName> sTableList)
192193
}
193194

194195
copyBulkLoadedFiles(activeFiles, archiveFiles);
195-
backupManager.deleteBulkLoadedRows(pair.getSecond());
196-
return mapForSrc;
196+
197+
return pair.getSecond();
197198
}
198199

199200
private void copyBulkLoadedFiles(List<String> activeFiles, List<String> archiveFiles)
@@ -309,10 +310,12 @@ public void execute() throws IOException {
309310
BackupUtils.getMinValue(BackupUtils.getRSLogTimestampMins(newTableSetTimestampMap));
310311
backupManager.writeBackupStartCode(newStartCode);
311312

312-
handleBulkLoad(backupInfo.getTableNames());
313+
List<byte[]> bulkLoadedRows = handleBulkLoad(backupInfo.getTableNames());
314+
313315
// backup complete
314316
completeBackup(conn, backupInfo, BackupType.INCREMENTAL, conf);
315317

318+
backupManager.deleteBulkLoadedRows(bulkLoadedRows);
316319
} catch (IOException e) {
317320
failBackup(conn, backupInfo, backupManager, e, "Unexpected Exception : ",
318321
BackupType.INCREMENTAL, conf);

0 commit comments

Comments
 (0)