HBASE-20729: B & R BackupLogCleaner must ignore ProcV2 WAL files
Signed-off-by: tedyu <yuzhihong@gmail.com>
This commit is contained in:
parent
1d0fca370b
commit
d53a976e8d
|
@ -65,6 +65,7 @@ import org.apache.hadoop.hbase.client.SnapshotDescription;
|
|||
import org.apache.hadoop.hbase.client.Table;
|
||||
import org.apache.hadoop.hbase.client.TableDescriptor;
|
||||
import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
|
||||
import org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore;
|
||||
import org.apache.hadoop.hbase.shaded.protobuf.generated.BackupProtos;
|
||||
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos;
|
||||
import org.apache.hadoop.hbase.util.Bytes;
|
||||
|
@ -1116,6 +1117,11 @@ public final class BackupSystemTable implements Closeable {
|
|||
List<FileStatus> fileStatuses = new ArrayList<>();
|
||||
|
||||
for (FileStatus file : files) {
|
||||
String fn = file.getPath().getName();
|
||||
if (fn.startsWith(WALProcedureStore.LOG_PREFIX)) {
|
||||
ret.put(file, true);
|
||||
continue;
|
||||
}
|
||||
String wal = file.getPath().toString();
|
||||
Get get = createGetForCheckWALFile(wal);
|
||||
getBuffer.add(get);
|
||||
|
|
|
@ -38,6 +38,7 @@ import org.apache.hadoop.hbase.backup.master.LogRollMasterProcedureManager;
|
|||
import org.apache.hadoop.hbase.backup.util.BackupUtils;
|
||||
import org.apache.hadoop.hbase.client.Admin;
|
||||
import org.apache.hadoop.hbase.client.Connection;
|
||||
import org.apache.hadoop.hbase.procedure2.store.wal.WALProcedureStore;
|
||||
import org.apache.hadoop.hbase.util.FSUtils;
|
||||
import org.apache.hadoop.hbase.wal.AbstractFSWALProvider;
|
||||
import org.apache.yetus.audience.InterfaceAudience;
|
||||
|
@ -101,7 +102,7 @@ public class IncrementalBackupManager extends BackupManager {
|
|||
List<WALItem> logFromSystemTable =
|
||||
getLogFilesFromBackupSystem(previousTimestampMins, newTimestamps, getBackupInfo()
|
||||
.getBackupRootDir());
|
||||
logList = excludeAlreadyBackedUpWALs(logList, logFromSystemTable);
|
||||
logList = excludeAlreadyBackedUpAndProcV2WALs(logList, logFromSystemTable);
|
||||
backupInfo.setIncrBackupFileList(logList);
|
||||
|
||||
return newTimestamps;
|
||||
|
@ -144,14 +145,13 @@ public class IncrementalBackupManager extends BackupManager {
|
|||
getLogFilesFromBackupSystem(previousTimestampMins, newTimestamps, getBackupInfo()
|
||||
.getBackupRootDir());
|
||||
|
||||
logList = excludeAlreadyBackedUpWALs(logList, logFromSystemTable);
|
||||
logList = excludeAlreadyBackedUpAndProcV2WALs(logList, logFromSystemTable);
|
||||
backupInfo.setIncrBackupFileList(logList);
|
||||
|
||||
return logList;
|
||||
}
|
||||
|
||||
|
||||
private List<String> excludeAlreadyBackedUpWALs(List<String> logList,
|
||||
private List<String> excludeAlreadyBackedUpAndProcV2WALs(List<String> logList,
|
||||
List<WALItem> logFromSystemTable) {
|
||||
Set<String> walFileNameSet = convertToSet(logFromSystemTable);
|
||||
|
||||
|
@ -160,7 +160,7 @@ public class IncrementalBackupManager extends BackupManager {
|
|||
Path p = new Path(logList.get(i));
|
||||
String name = p.getName();
|
||||
|
||||
if (walFileNameSet.contains(name)) {
|
||||
if (walFileNameSet.contains(name) || name.startsWith(WALProcedureStore.LOG_PREFIX)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,6 @@ public class BackupLogCleaner extends BaseLogCleanerDelegate {
|
|||
LOG.warn("Backup system table is not available: {}", tnfe.getMessage());
|
||||
return files;
|
||||
}
|
||||
|
||||
List<FileStatus> list = new ArrayList<>();
|
||||
Map<FileStatus, Boolean> walFilesDeletableMap = table.areWALFilesDeletable(files);
|
||||
for (Map.Entry<FileStatus, Boolean> entry: walFilesDeletableMap.entrySet()) {
|
||||
|
|
Loading…
Reference in New Issue