@Test void scanForHighIdOnlyOnceWhenProcessCache() { NeoStores neoStores = mock( NeoStores.class, Mockito.RETURNS_MOCKS ); NodeStore nodeStore = mock( NodeStore.class ); NodeRecord nodeRecord = mock( NodeRecord.class ); StoreProcessor storeProcessor = mock( StoreProcessor.class ); when( neoStores.getNodeStore() ).thenReturn( nodeStore ); when( nodeStore.getHighId() ).thenReturn( 10L ); when( nodeStore.getRecord( anyLong(), any( NodeRecord.class ), any( RecordLoad.class ) ) ).thenReturn( nodeRecord ); when( nodeStore.newRecord() ).thenReturn( nodeRecord ); StoreAccess storeAccess = new StoreAccess( neoStores ); storeAccess.initialize(); CacheTask.CheckNextRel cacheTask = new CacheTask.CheckNextRel( Stage.SEQUENTIAL_FORWARD, new DefaultCacheAccess( Counts.NONE, 1 ), storeAccess, storeProcessor ); cacheTask.processCache(); verify( nodeStore, times( 1 ) ).getHighId(); } }
@Test public void openingThroughStoreAccessShouldNotTriggerRecovery() throws Throwable { try ( EphemeralFileSystemAbstraction snapshot = produceUncleanStore() ) { assertTrue( "Store should be unclean", isUnclean( snapshot ) ); PageCache pageCache = pageCacheRule.getPageCache( snapshot ); new StoreAccess( snapshot, pageCache, testDirectory.databaseLayout(), Config.defaults() ).initialize().close(); assertTrue( "Store should be unclean", isUnclean( snapshot ) ); } }
storeAccess = new StoreAccess( neoStores ); storeAccess.initialize(); DirectStoreAccess stores = new DirectStoreAccess( storeAccess, labelScanStore, indexes ); FullCheck check = new FullCheck(
StoreAccess storeAccess = new StoreAccess( fileSystemRule.get(), pageCache, testDirectory.databaseLayout(), Config.defaults() ); return storeAccess.initialize();
nativeStores = new StoreAccess( neoStore ); nativeStores.initialize();
.resolveDependency( RecordStorageEngine.class ).testAccessNeoStores() ).initialize(); schemaId = stores.getSchemaStore().getHighId(); nodeId = stores.getNodeStore().getHighId();
public DirectStoreAccess directStoreAccess() { if ( directStoreAccess == null ) { DefaultFileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction(); PageCache pageCache = getPageCache( fileSystem ); StoreAccess nativeStores = new StoreAccess( fileSystem, pageCache, directory ).initialize(); Config config = new Config(); OperationalMode operationalMode = OperationalMode.single; directStoreAccess = new DirectStoreAccess( nativeStores, new LuceneLabelScanStoreBuilder( directory, nativeStores.getRawNeoStores(), fileSystem, config, operationalMode, FormattedLogProvider.toOutputStream( System.out ) ).build(), createIndexes( fileSystem, config, operationalMode ) ); } return directStoreAccess; }
private StoreAccess createStoreWithOneHighDegreeNodeAndSeveralDegreeTwoNodes( int nDegreeTwoNodes ) { File storeDirectory = storeLocation.graphDbDir(); GraphDatabaseService database = new TestGraphDatabaseFactory().newEmbeddedDatabase( storeDirectory ); try ( Transaction transaction = database.beginTx() ) { Node denseNode = database.createNode(); for ( int i = 0; i < nDegreeTwoNodes; i++ ) { Node degreeTwoNode = database.createNode(); Node leafNode = database.createNode(); if ( i % 2 == 0 ) { denseNode.createRelationshipTo( degreeTwoNode, TestRelationshipType.CONNECTED ); } else { degreeTwoNode.createRelationshipTo( denseNode, TestRelationshipType.CONNECTED ); } degreeTwoNode.createRelationshipTo( leafNode, TestRelationshipType.CONNECTED ); } transaction.success(); } database.shutdown(); PageCache pageCache = pageCacheRule.getPageCache( new DefaultFileSystemAbstraction() ); return new StoreAccess( pageCache, storeDirectory ).initialize(); } }
private void generateInitialData() { GraphDatabaseBuilder builder = new TestGraphDatabaseFactory().newEmbeddedDatabaseBuilder( directory ); GraphDatabaseAPI graphDb = (GraphDatabaseAPI) builder.newGraphDatabase(); try { generateInitialData( graphDb ); StoreAccess stores = new StoreAccess( graphDb ).initialize(); schemaId = stores.getSchemaStore().getHighId(); nodeId = stores.getNodeStore().getHighId(); labelId = (int) stores.getLabelTokenStore().getHighId(); nodeLabelsId = stores.getNodeDynamicLabelStore().getHighId(); relId = stores.getRelationshipStore().getHighId(); relGroupId = stores.getRelationshipGroupStore().getHighId(); propId = (int) stores.getPropertyStore().getHighId(); stringPropId = stores.getStringStore().getHighId(); arrayPropId = stores.getArrayStore().getHighId(); relTypeId = (int) stores.getRelationshipTypeTokenStore().getHighId(); propKeyId = (int) stores.getPropertyKeyNameStore().getHighId(); } finally { graphDb.shutdown(); } }