Search in sources :

Example 76 with NeoStores

use of org.neo4j.kernel.impl.store.NeoStores in project neo4j by neo4j.

the class CountsStoreRecoveryTest method flushNeoStoreOnly.

private void flushNeoStoreOnly() throws Exception {
    NeoStores neoStores = ((GraphDatabaseAPI) db).getDependencyResolver().resolveDependency(RecordStorageEngine.class).testAccessNeoStores();
    MetaDataStore metaDataStore = neoStores.getMetaDataStore();
    metaDataStore.flush();
}
Also used : GraphDatabaseAPI(org.neo4j.kernel.internal.GraphDatabaseAPI) RecordStorageEngine(org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine) MetaDataStore(org.neo4j.kernel.impl.store.MetaDataStore) NeoStores(org.neo4j.kernel.impl.store.NeoStores)

Example 77 with NeoStores

use of org.neo4j.kernel.impl.store.NeoStores in project neo4j by neo4j.

the class StoreUpgraderTest method upgradedNeoStoreShouldHaveNewUpgradeTimeAndUpgradeId.

@Test
public void upgradedNeoStoreShouldHaveNewUpgradeTimeAndUpgradeId() throws Exception {
    // Given
    fileSystem.deleteFile(new File(dbDirectory, StoreLogService.INTERNAL_LOG_NAME));
    PageCache pageCache = pageCacheRule.getPageCache(fileSystem);
    UpgradableDatabase upgradableDatabase = new UpgradableDatabase(fileSystem, new StoreVersionCheck(pageCache), new LegacyStoreVersionCheck(fileSystem), getRecordFormats());
    // When
    newUpgrader(upgradableDatabase, allowMigrateConfig, pageCache).migrateIfNeeded(dbDirectory);
    // Then
    StoreFactory factory = new StoreFactory(dbDirectory, pageCache, fileSystem, NullLogProvider.getInstance());
    try (NeoStores neoStores = factory.openAllNeoStores()) {
        assertThat(neoStores.getMetaDataStore().getUpgradeTransaction(), equalTo(neoStores.getMetaDataStore().getLastCommittedTransaction()));
        assertThat(neoStores.getMetaDataStore().getUpgradeTime(), not(equalTo(MetaDataStore.FIELD_NOT_INITIALIZED)));
        long minuteAgo = System.currentTimeMillis() - MINUTES.toMillis(1);
        assertThat(neoStores.getMetaDataStore().getUpgradeTime(), greaterThan(minuteAgo));
    }
}
Also used : StoreVersionCheck(org.neo4j.kernel.impl.storemigration.StoreVersionCheck) LegacyStoreVersionCheck(org.neo4j.kernel.impl.storemigration.legacystore.LegacyStoreVersionCheck) UpgradableDatabase(org.neo4j.kernel.impl.storemigration.UpgradableDatabase) NeoStores(org.neo4j.kernel.impl.store.NeoStores) LegacyStoreVersionCheck(org.neo4j.kernel.impl.storemigration.legacystore.LegacyStoreVersionCheck) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) MigrationTestUtils.truncateFile(org.neo4j.kernel.impl.storemigration.MigrationTestUtils.truncateFile) File(java.io.File) PageCache(org.neo4j.io.pagecache.PageCache) Test(org.junit.Test)

Aggregations

NeoStores (org.neo4j.kernel.impl.store.NeoStores)77 Test (org.junit.Test)48 StoreFactory (org.neo4j.kernel.impl.store.StoreFactory)17 RecordStorageEngine (org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine)14 NodeStore (org.neo4j.kernel.impl.store.NodeStore)12 File (java.io.File)11 Transaction (org.neo4j.graphdb.Transaction)11 ArrayList (java.util.ArrayList)9 PageCache (org.neo4j.io.pagecache.PageCache)9 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)9 Node (org.neo4j.graphdb.Node)8 NodeUpdates (org.neo4j.kernel.api.index.NodeUpdates)8 RelationshipStore (org.neo4j.kernel.impl.store.RelationshipStore)8 DependencyResolver (org.neo4j.graphdb.DependencyResolver)7 RelationshipGroupCommand (org.neo4j.kernel.impl.transaction.command.Command.RelationshipGroupCommand)7 BatchTransactionApplier (org.neo4j.kernel.impl.api.BatchTransactionApplier)6 PropertyStore (org.neo4j.kernel.impl.store.PropertyStore)6 NeoStoreBatchTransactionApplier (org.neo4j.kernel.impl.transaction.command.NeoStoreBatchTransactionApplier)6 CacheAccessBackDoor (org.neo4j.kernel.impl.core.CacheAccessBackDoor)5 NodeCommand (org.neo4j.kernel.impl.transaction.command.Command.NodeCommand)5