in priam/src/main/java/com/netflix/priam/backup/CommitLogBackup.java [42:79]
public List<AbstractBackupPath> upload(String archivedDir, final String snapshotName)
throws Exception {
logger.info("Inside upload CommitLog files");
if (StringUtils.isBlank(archivedDir)) {
throw new IllegalArgumentException("The archived commitlog director is blank or null");
}
File archivedCommitLogDir = new File(archivedDir);
if (!archivedCommitLogDir.exists()) {
throw new IllegalArgumentException(
"The archived commitlog director does not exist: " + archivedDir);
}
if (logger.isDebugEnabled()) {
logger.debug("Scanning for backup in: {}", archivedCommitLogDir.getAbsolutePath());
}
List<AbstractBackupPath> bps = Lists.newArrayList();
for (final File file : archivedCommitLogDir.listFiles()) {
logger.debug("Uploading commit log {} for backup", file.getCanonicalFile());
try {
AbstractBackupPath bp = pathFactory.get();
bp.parseLocal(file, BackupFileType.CL);
if (snapshotName != null) bp.time = DateUtil.getDate(snapshotName);
fs.uploadAndDelete(bp, false /* async */);
bps.add(bp);
addToRemotePath(bp.getRemotePath());
} catch (Exception e) {
logger.error(
"Failed to upload local file {}. Ignoring to continue with rest of backup.",
file,
e);
}
}
return bps;
}