Search in sources :

Example 16 with SimpleTransactionIdStore

use of org.neo4j.kernel.impl.transaction.SimpleTransactionIdStore in project neo4j by neo4j.

the class LogFilesBuilderTest method buildContextWithCustomAbsoluteLogFilesLocations.

@Test
void buildContextWithCustomAbsoluteLogFilesLocations() throws Throwable {
    Path customLogDirectory = testDirectory.directory("absoluteCustomLogDirectory");
    Config config = Config.newBuilder().set(neo4j_home, testDirectory.homePath()).set(transaction_logs_root_path, customLogDirectory.toAbsolutePath()).build();
    LogFiles logFiles = builder(DatabaseLayout.of(config), fileSystem).withRotationThreshold(ByteUnit.mebiBytes(1)).withLogVersionRepository(new SimpleLogVersionRepository()).withTransactionIdStore(new SimpleTransactionIdStore()).withLogEntryReader(logEntryReader()).withStoreId(StoreId.UNKNOWN).build();
    logFiles.init();
    logFiles.start();
    assertEquals(customLogDirectory.resolve(databaseLayout.getDatabaseName()), logFiles.getLogFile().getHighestLogFile().getParent());
    logFiles.shutdown();
}
Also used : Path(java.nio.file.Path) SimpleTransactionIdStore(org.neo4j.kernel.impl.transaction.SimpleTransactionIdStore) Config(org.neo4j.configuration.Config) SimpleLogVersionRepository(org.neo4j.kernel.impl.transaction.SimpleLogVersionRepository) Test(org.junit.jupiter.api.Test)

Example 17 with SimpleTransactionIdStore

use of org.neo4j.kernel.impl.transaction.SimpleTransactionIdStore in project neo4j by neo4j.

the class LogFilesBuilderTest method buildDefaultContext.

@Test
void buildDefaultContext() throws IOException {
    TransactionLogFilesContext context = builder(databaseLayout, fileSystem).withLogVersionRepository(new SimpleLogVersionRepository(2)).withTransactionIdStore(new SimpleTransactionIdStore()).withLogEntryReader(logEntryReader()).buildContext();
    assertEquals(fileSystem, context.getFileSystem());
    assertNotNull(context.getLogEntryReader());
    assertEquals(ByteUnit.mebiBytes(250), context.getRotationThreshold().get());
    assertEquals(1, context.getLastCommittedTransactionId());
    assertEquals(2, context.getLogVersionRepository().getCurrentLogVersion());
}
Also used : SimpleTransactionIdStore(org.neo4j.kernel.impl.transaction.SimpleTransactionIdStore) SimpleLogVersionRepository(org.neo4j.kernel.impl.transaction.SimpleLogVersionRepository) Test(org.junit.jupiter.api.Test)

Example 18 with SimpleTransactionIdStore

use of org.neo4j.kernel.impl.transaction.SimpleTransactionIdStore in project neo4j by neo4j.

the class LogFilesBuilderTest method buildDefaultContextWithDependencies.

@Test
void buildDefaultContextWithDependencies() throws IOException {
    SimpleLogVersionRepository logVersionRepository = new SimpleLogVersionRepository(2);
    SimpleTransactionIdStore transactionIdStore = new SimpleTransactionIdStore();
    DatabaseHealth databaseHealth = new DatabaseHealth(PanicEventGenerator.NO_OP, NullLog.getInstance());
    Dependencies dependencies = new Dependencies();
    dependencies.satisfyDependency(logVersionRepository);
    dependencies.satisfyDependency(transactionIdStore);
    dependencies.satisfyDependency(databaseHealth);
    TransactionLogFilesContext context = builder(databaseLayout, fileSystem).withDependencies(dependencies).withLogEntryReader(logEntryReader()).buildContext();
    assertEquals(fileSystem, context.getFileSystem());
    assertNotNull(context.getLogEntryReader());
    assertEquals(ByteUnit.mebiBytes(250), context.getRotationThreshold().get());
    assertEquals(databaseHealth, context.getDatabaseHealth());
    assertEquals(1, context.getLastCommittedTransactionId());
    assertEquals(2, context.getLogVersionRepository().getCurrentLogVersion());
}
Also used : DatabaseHealth(org.neo4j.monitoring.DatabaseHealth) SimpleTransactionIdStore(org.neo4j.kernel.impl.transaction.SimpleTransactionIdStore) SimpleLogVersionRepository(org.neo4j.kernel.impl.transaction.SimpleLogVersionRepository) Dependencies(org.neo4j.collection.Dependencies) Test(org.junit.jupiter.api.Test)

Example 19 with SimpleTransactionIdStore

use of org.neo4j.kernel.impl.transaction.SimpleTransactionIdStore in project neo4j by neo4j.

the class TransactionLogFilesTest method createLogFiles.

private LogFiles createLogFiles() throws Exception {
    var files = LogFilesBuilder.builder(databaseLayout, fileSystem).withTransactionIdStore(new SimpleTransactionIdStore()).withLogVersionRepository(new SimpleLogVersionRepository()).withLogEntryReader(new VersionAwareLogEntryReader(new TestCommandReaderFactory())).withStoreId(StoreId.UNKNOWN).build();
    files.init();
    return files;
}
Also used : SimpleTransactionIdStore(org.neo4j.kernel.impl.transaction.SimpleTransactionIdStore) SimpleLogVersionRepository(org.neo4j.kernel.impl.transaction.SimpleLogVersionRepository) VersionAwareLogEntryReader(org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader) TestCommandReaderFactory(org.neo4j.kernel.impl.api.TestCommandReaderFactory)

Example 20 with SimpleTransactionIdStore

use of org.neo4j.kernel.impl.transaction.SimpleTransactionIdStore in project neo4j by neo4j.

the class AbstractLogTailScannerTest method setUp.

@BeforeEach
void setUp() throws IOException {
    logVersionRepository = new SimpleLogVersionRepository();
    transactionIdStore = new SimpleTransactionIdStore();
    logProvider = new AssertableLogProvider();
    logFiles = createLogFiles();
}
Also used : SimpleTransactionIdStore(org.neo4j.kernel.impl.transaction.SimpleTransactionIdStore) SimpleLogVersionRepository(org.neo4j.kernel.impl.transaction.SimpleLogVersionRepository) AssertableLogProvider(org.neo4j.logging.AssertableLogProvider) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

SimpleTransactionIdStore (org.neo4j.kernel.impl.transaction.SimpleTransactionIdStore)23 Test (org.junit.jupiter.api.Test)17 SimpleLogVersionRepository (org.neo4j.kernel.impl.transaction.SimpleLogVersionRepository)17 LogFiles (org.neo4j.kernel.impl.transaction.log.files.LogFiles)14 Lifespan (org.neo4j.kernel.lifecycle.Lifespan)7 TransactionIdStore (org.neo4j.storageengine.api.TransactionIdStore)6 LogFile (org.neo4j.kernel.impl.transaction.log.files.LogFile)5 LogPosition (org.neo4j.kernel.impl.transaction.log.LogPosition)4 LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)3 BeforeEach (org.junit.jupiter.api.BeforeEach)3 LogVersionRepository (org.neo4j.storageengine.api.LogVersionRepository)3 ArrayList (java.util.ArrayList)2 Config (org.neo4j.configuration.Config)2 TestCommandReaderFactory (org.neo4j.kernel.impl.api.TestCommandReaderFactory)2 TransactionLogWriter (org.neo4j.kernel.impl.transaction.log.TransactionLogWriter)2 VersionAwareLogEntryReader (org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader)2 DatabaseHealth (org.neo4j.monitoring.DatabaseHealth)2 IOException (java.io.IOException)1 Path (java.nio.file.Path)1