Search in sources :

Example 1 with RecordStorageEngine

use of org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine in project neo4j by neo4j.

the class CountsRotationTest method rotationShouldNotCauseUnmappedFileProblem.

@Test
public void rotationShouldNotCauseUnmappedFileProblem() throws IOException {
    // GIVEN
    GraphDatabaseAPI db = (GraphDatabaseAPI) dbBuilder.newGraphDatabase();
    DependencyResolver resolver = db.getDependencyResolver();
    RecordStorageEngine storageEngine = resolver.resolveDependency(RecordStorageEngine.class);
    CountsTracker countStore = storageEngine.testAccessNeoStores().getCounts();
    AtomicBoolean workerContinueFlag = new AtomicBoolean(true);
    AtomicLong lookupsCounter = new AtomicLong();
    int rotations = 100;
    for (int i = 0; i < 5; i++) {
        threadingRule.execute(countStoreLookup(workerContinueFlag, lookupsCounter), countStore);
    }
    long startTxId = countStore.txId();
    for (int i = 1; (i < rotations) || (lookupsCounter.get() == 0); i++) {
        try (Transaction tx = db.beginTx()) {
            db.createNode(B);
            tx.success();
        }
        checkPoint(db);
    }
    workerContinueFlag.set(false);
    assertEquals("Should perform at least 100 rotations.", rotations, Math.min(rotations, countStore.txId() - startTxId));
    assertTrue("Should perform more then 0 lookups without exceptions.", lookupsCounter.get() > 0);
    db.shutdown();
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) AtomicLong(java.util.concurrent.atomic.AtomicLong) GraphDatabaseAPI(org.neo4j.kernel.internal.GraphDatabaseAPI) Transaction(org.neo4j.graphdb.Transaction) RecordStorageEngine(org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine) DependencyResolver(org.neo4j.graphdb.DependencyResolver) Test(org.junit.Test)

Example 2 with RecordStorageEngine

use of org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine in project neo4j by neo4j.

the class RelationshipGroupStoreIT method shiftHighId.

private void shiftHighId(GraphDatabaseAPI db) {
    RecordStorageEngine storageEngine = db.getDependencyResolver().resolveDependency(RecordStorageEngine.class);
    NeoStores neoStores = storageEngine.testAccessNeoStores();
    neoStores.getRelationshipTypeTokenStore().setHighId(Short.MAX_VALUE - RELATIONSHIP_COUNT / 2);
}
Also used : RecordStorageEngine(org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine)

Example 3 with RecordStorageEngine

use of org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine in project neo4j by neo4j.

the class StorageLayerRelTypesAndDegreeTest method resolveNeoStores.

private NeoStores resolveNeoStores() {
    DependencyResolver resolver = db.getDependencyResolver();
    RecordStorageEngine storageEngine = resolver.resolveDependency(RecordStorageEngine.class);
    return storageEngine.testAccessNeoStores();
}
Also used : RecordStorageEngine(org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine) DependencyResolver(org.neo4j.graphdb.DependencyResolver)

Example 4 with RecordStorageEngine

use of org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine in project neo4j-apoc-procedures by neo4j-contrib.

the class PageRankArrayStorageParallelSPI method getNeoStores.

private NeoStores getNeoStores(GraphDatabaseAPI db) {
    RecordStorageEngine recordStorageEngine = db.getDependencyResolver().resolveDependency(RecordStorageEngine.class);
    StoreAccess storeAccess = new StoreAccess(recordStorageEngine.testAccessNeoStores());
    return storeAccess.getRawNeoStores();
}
Also used : StoreAccess(org.neo4j.kernel.impl.store.StoreAccess) RecordStorageEngine(org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine)

Example 5 with RecordStorageEngine

use of org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine in project neo4j by neo4j.

the class NeoStoreDataSource method buildStorageEngine.

private StorageEngine buildStorageEngine(PropertyKeyTokenHolder propertyKeyTokenHolder, LabelTokenHolder labelTokens, RelationshipTypeTokenHolder relationshipTypeTokens, LegacyIndexProviderLookup legacyIndexProviderLookup, IndexConfigStore indexConfigStore, Runnable schemaStateChangeCallback, SynchronizedArrayIdOrderingQueue legacyIndexTransactionOrdering) {
    // TODO we should break this dependency on the kernelModule (which has not yet been created at this point in
    // TODO the code) and instead let information about generations of transactions flow through the StorageEngine
    // TODO API
    Supplier<KernelTransactionsSnapshot> transactionSnapshotSupplier = () -> kernelModule.kernelTransactions().get();
    RecordStorageEngine storageEngine = new RecordStorageEngine(storeDir, config, idGeneratorFactory, eligibleForReuse, idTypeConfigurationProvider, pageCache, fs, logProvider, propertyKeyTokenHolder, labelTokens, relationshipTypeTokens, schemaStateChangeCallback, constraintSemantics, scheduler, tokenNameLookup, lockService, schemaIndexProvider, indexingServiceMonitor, databaseHealth, labelScanStoreProvider, legacyIndexProviderLookup, indexConfigStore, legacyIndexTransactionOrdering, transactionSnapshotSupplier);
    // We pretend that the storage engine abstract hides all details within it. Whereas that's mostly
    // true it's not entirely true for the time being. As long as we need this call below, which
    // makes available one or more internal things to the outside world, there are leaks to plug.
    storageEngine.satisfyDependencies(dependencies);
    return life.add(storageEngine);
}
Also used : RecordStorageEngine(org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine) KernelTransactionsSnapshot(org.neo4j.kernel.impl.api.KernelTransactionsSnapshot)

Aggregations

RecordStorageEngine (org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine)5 DependencyResolver (org.neo4j.graphdb.DependencyResolver)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Test (org.junit.Test)1 Transaction (org.neo4j.graphdb.Transaction)1 KernelTransactionsSnapshot (org.neo4j.kernel.impl.api.KernelTransactionsSnapshot)1 StoreAccess (org.neo4j.kernel.impl.store.StoreAccess)1 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)1