use of com.instaclustr.esop.impl.ManifestEntry in project esop by instaclustr.
the class BackupCommitLogsOperation method run0.
@Override
protected void run0() throws Exception {
updateStorageLocationIfNecessary();
logger.info(request.toString());
// generate manifest (set of object keys and source files defining the upload)
// linked list to maintain order
final Collection<ManifestEntry> manifestEntries = new LinkedList<>();
try (final DirectoryStream<Path> commitLogs = getCommitLogs(request);
final Backuper backuper = backuperFactoryMap.get(request.storageLocation.storageProvider).createCommitLogBackuper(request);
final BucketService bucketService = bucketServiceMap.get(request.storageLocation.storageProvider).createBucketService(request)) {
if (!request.skipBucketVerification) {
bucketService.checkBucket(request.storageLocation.bucket, request.createMissingBucket);
}
for (final Path commitLog : commitLogs) {
// Append file modified date so we have some idea of the time range this commitlog covers
// millisecond precision, on *nix, it trims milliseconds and returns "000" instead
// when using File.lastModified
long commitLogLastModified = Files.getLastModifiedTime(commitLog.toFile().toPath()).toMillis();
final Path bucketKey = CASSANDRA_COMMITLOG.resolve(commitLog.getFileName().toString() + "." + commitLogLastModified);
manifestEntries.add(new ManifestEntry(bucketKey, commitLog, COMMIT_LOG, null));
}
logger.info("{} files in manifest for commitlog backup.", manifestEntries.size());
Session<UploadUnit> uploadSession = null;
try {
uploadSession = uploadTracker.submit(backuper, this, manifestEntries, null, this.request.concurrentConnections);
uploadSession.waitUntilConsideredFinished();
uploadTracker.cancelIfNecessary(uploadSession);
} finally {
uploadTracker.removeSession(uploadSession);
}
}
}
Aggregations