use of org.neo4j.causalclustering.core.consensus.log.segmented.CoreLogPruningStrategy in project neo4j by neo4j.
the class ReplayRaftLog method main.
public static void main(String[] args) throws IOException {
Args arg = Args.parse(args);
String from = arg.get("from");
System.out.println("From is " + from);
String to = arg.get("to");
System.out.println("to is " + to);
File logDirectory = new File(from);
System.out.println("logDirectory = " + logDirectory);
Config config = Config.embeddedDefaults(stringMap());
try (DefaultFileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction()) {
LogProvider logProvider = getInstance();
CoreLogPruningStrategy pruningStrategy = new CoreLogPruningStrategyFactory(config.get(raft_log_pruning_strategy), logProvider).newInstance();
SegmentedRaftLog log = new SegmentedRaftLog(fileSystem, logDirectory, config.get(raft_log_rotation_size), new CoreReplicatedContentMarshal(), logProvider, config.get(raft_log_reader_pool_size), Clocks.systemClock(), new OnDemandJobScheduler(), pruningStrategy);
// Not really, but we need to have a way to pass in the commit index
long totalCommittedEntries = log.appendIndex();
for (int i = 0; i <= totalCommittedEntries; i++) {
ReplicatedContent content = readLogEntry(log, i).content();
if (content instanceof ReplicatedTransaction) {
ReplicatedTransaction tx = (ReplicatedTransaction) content;
ReplicatedTransactionFactory.extractTransactionRepresentation(tx, new byte[0]).accept(element -> {
System.out.println(element);
return false;
});
}
}
}
}
Aggregations