Search in sources :

Example 1 with CountingLogHook

use of org.neo4j.test.LogTestUtils.CountingLogHook in project neo4j by neo4j.

the class ReadTransactionLogWritingTest method countLogEntries.

private long countLogEntries() {
    GraphDatabaseAPI db = dbr.getGraphDatabaseAPI();
    FileSystemAbstraction fs = db.getDependencyResolver().resolveDependency(FileSystemAbstraction.class);
    File storeDir = new File(db.getStoreDir());
    try {
        CountingLogHook<LogEntry> logicalLogCounter = new CountingLogHook<>();
        filterNeostoreLogicalLog(fs, storeDir.getPath(), logicalLogCounter);
        long txLogRecordCount = db.getDependencyResolver().resolveDependency(LogFileInformation.class).getLastEntryId();
        return logicalLogCounter.getCount() + txLogRecordCount;
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : FileSystemAbstraction(org.neo4j.io.fs.FileSystemAbstraction) GraphDatabaseAPI(org.neo4j.kernel.internal.GraphDatabaseAPI) CountingLogHook(org.neo4j.test.LogTestUtils.CountingLogHook) LogFileInformation(org.neo4j.kernel.impl.transaction.log.LogFileInformation) IOException(java.io.IOException) File(java.io.File) LogEntry(org.neo4j.kernel.impl.transaction.log.entry.LogEntry)

Aggregations

File (java.io.File)1 IOException (java.io.IOException)1 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)1 LogFileInformation (org.neo4j.kernel.impl.transaction.log.LogFileInformation)1 LogEntry (org.neo4j.kernel.impl.transaction.log.entry.LogEntry)1 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)1 CountingLogHook (org.neo4j.test.LogTestUtils.CountingLogHook)1