use of org.neo4j.logging.LogProvider in project neo4j by neo4j.
the class SegmentedRaftLogPartialEntryRecoveryTest method createRaftLog.
private SegmentedRaftLog createRaftLog(long rotateAtSize) {
File directory = new File(RAFT_LOG_DIRECTORY_NAME);
logDirectory = dir.directory(directory.getName());
LogProvider logProvider = getInstance();
CoreLogPruningStrategy pruningStrategy = new CoreLogPruningStrategyFactory("100 entries", logProvider).newInstance();
return new SegmentedRaftLog(fsRule.get(), logDirectory, rotateAtSize, new CoreReplicatedContentMarshal(), logProvider, 8, Clocks.fakeClock(), new OnDemandJobScheduler(), pruningStrategy);
}
use of org.neo4j.logging.LogProvider 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;
});
}
}
}
}
use of org.neo4j.logging.LogProvider in project neo4j by neo4j.
the class SegmentedRaftLogRotationTest method createRaftLog.
private SegmentedRaftLog createRaftLog(long rotateAtSize) throws IOException {
LogProvider logProvider = getInstance();
CoreLogPruningStrategy pruningStrategy = new CoreLogPruningStrategyFactory(raft_log_pruning_strategy.getDefaultValue(), logProvider).newInstance();
return new SegmentedRaftLog(fileSystemRule.get(), testDirectory.directory(), rotateAtSize, new DummyRaftableContentSerializer(), logProvider, 0, Clocks.fakeClock(), new OnDemandJobScheduler(), pruningStrategy);
}
use of org.neo4j.logging.LogProvider in project neo4j by neo4j.
the class SegmentedRaftLogRotationTruncationPruneTest method createRaftLog.
private RaftLog createRaftLog() throws Exception {
File directory = new File(RAFT_LOG_DIRECTORY_NAME);
FileSystemAbstraction fileSystem = new EphemeralFileSystemAbstraction();
fileSystem.mkdir(directory);
LogProvider logProvider = getInstance();
CoreLogPruningStrategy pruningStrategy = new CoreLogPruningStrategyFactory("1 entries", logProvider).newInstance();
SegmentedRaftLog newRaftLog = new SegmentedRaftLog(fileSystem, directory, 1, new DummyRaftableContentSerializer(), logProvider, 8, Clocks.fakeClock(), new OnDemandJobScheduler(), pruningStrategy);
newRaftLog.start();
return newRaftLog;
}
use of org.neo4j.logging.LogProvider in project neo4j by neo4j.
the class DatabaseActions method start.
public void start() throws UnableToStartServerException {
if (isRunning()) {
throw new UnableToStartServerException("Already started");
}
Config config = model.getConfig();
Monitors monitors = new Monitors();
LogProvider userLogProvider = FormattedLogProvider.toOutputStream(System.out);
GraphDatabaseDependencies dependencies = GraphDatabaseDependencies.newDependencies().userLogProvider(userLogProvider).monitors(monitors);
server = new CommunityNeoServer(config, dependencies, userLogProvider);
try {
server.start();
} catch (ServerStartupException e) {
server = null;
Set<Class> causes = extractCauseTypes(e);
if (causes.contains(StoreLockException.class)) {
throw new UnableToStartServerException("Unable to lock store. Are you running another Neo4j process against this database?");
}
if (causes.contains(BindException.class)) {
throw new UnableToStartServerException("Unable to bind to port. Are you running another Neo4j process on this computer?");
}
throw new UnableToStartServerException(e.getMessage());
}
}
Aggregations