use of org.neo4j.helpers.progress.ProgressMonitorFactory in project neo4j by neo4j.
the class RebuildFromLogs method rebuild.
public void rebuild(File source, File target, long txId) throws Exception, InconsistentStoreException {
try (PageCache pageCache = StandalonePageCacheFactory.createPageCache(fs)) {
PhysicalLogFiles logFiles = new PhysicalLogFiles(source, fs);
long highestVersion = logFiles.getHighestLogVersion();
if (highestVersion < 0) {
printUsage("Inconsistent number of log files found in " + source);
return;
}
long txCount = findLastTransactionId(logFiles, highestVersion);
ProgressMonitorFactory progress;
if (txCount < 0) {
progress = ProgressMonitorFactory.NONE;
System.err.println("Unable to report progress, cannot find highest txId, attempting rebuild anyhow.");
} else {
progress = ProgressMonitorFactory.textual(System.err);
}
progress.singlePart(format("Rebuilding store from %s transactions ", txCount), txCount);
long lastTxId;
try (TransactionApplier applier = new TransactionApplier(fs, target, pageCache)) {
lastTxId = applier.applyTransactionsFrom(source, txId);
}
// set last tx id in neostore otherwise the db is not usable
MetaDataStore.setRecord(pageCache, new File(target, MetaDataStore.DEFAULT_NAME), MetaDataStore.Position.LAST_TRANSACTION_ID, lastTxId);
checkConsistency(target, pageCache);
}
}
Aggregations