public PropertyCreator( PropertyStore propertyStore, PropertyTraverser traverser ) { this( propertyStore.getStringStore(), propertyStore.getArrayStore(), propertyStore, traverser, propertyStore.allowStorePointsAndTemporal() ); }
public PropertyValueRecordSizeCalculator( PropertyStore propertyStore ) { this( propertyStore.getRecordSize(), propertyStore.getStringStore().getRecordSize(), propertyStore.getStringStore().getRecordDataSize(), propertyStore.getArrayStore().getRecordSize(), propertyStore.getArrayStore().getRecordDataSize() ); }
protected long dynamicArrayRecordsInUse() { return numberOfRecordsInUse( propertyStore().getArrayStore() ); }
private DynamicArrayStore createDynamicArrayStore() { neoStores = storeFactory.openAllNeoStores( true ); return neoStores.getPropertyStore().getArrayStore(); }
@SuppressWarnings( {"unchecked", "rawtypes"} ) public static NeoStores basicMockedNeoStores() { NeoStores neoStores = mock( NeoStores.class ); // NodeStore - DynamicLabelStore NodeStore nodeStore = mock( NodeStore.class ); when( neoStores.getNodeStore() ).thenReturn( nodeStore ); // NodeStore - DynamicLabelStore DynamicArrayStore dynamicLabelStore = mock( DynamicArrayStore.class ); when( nodeStore.getDynamicLabelStore() ).thenReturn( dynamicLabelStore ); // RelationshipStore RelationshipStore relationshipStore = mock( RelationshipStore.class ); when( neoStores.getRelationshipStore() ).thenReturn( relationshipStore ); // RelationshipGroupStore RelationshipGroupStore relationshipGroupStore = mock( RelationshipGroupStore.class ); when( neoStores.getRelationshipGroupStore() ).thenReturn( relationshipGroupStore ); // PropertyStore PropertyStore propertyStore = mock( PropertyStore.class ); when( neoStores.getPropertyStore() ).thenReturn( propertyStore ); // PropertyStore -- DynamicStringStore DynamicStringStore propertyStringStore = mock( DynamicStringStore.class ); when( propertyStore.getStringStore() ).thenReturn( propertyStringStore ); // PropertyStore -- DynamicArrayStore DynamicArrayStore propertyArrayStore = mock( DynamicArrayStore.class ); when( propertyStore.getArrayStore() ).thenReturn( propertyArrayStore ); return neoStores; }
String.valueOf( legacyStores.getPropertyStore().getArrayStore().getRecordDataSize() ) ); config.put( GraphDatabaseSettings.string_block_size.name(), String.valueOf( legacyStores.getPropertyStore().getStringStore().getRecordDataSize() ) );
protected EntityImporter( BatchingNeoStores stores, Monitor monitor ) { this.propertyStore = stores.getPropertyStore(); this.propertyKeyTokenRepository = stores.getPropertyKeyRepository(); this.monitor = monitor; for ( int i = 0; i < propertyBlocks.length; i++ ) { propertyBlocks[i] = new PropertyBlock(); } this.propertyRecord = propertyStore.newRecord(); this.propertyIds = new BatchingIdGetter( propertyStore ); this.dynamicStringRecordAllocator = new StandardDynamicRecordAllocator( new BatchingIdGetter( propertyStore.getStringStore(), propertyStore.getStringStore().getRecordsPerPage() ), propertyStore.getStringStore().getRecordDataSize() ); this.dynamicArrayRecordAllocator = new StandardDynamicRecordAllocator( new BatchingIdGetter( propertyStore.getArrayStore(), propertyStore.getArrayStore().getRecordsPerPage() ), propertyStore.getStringStore().getRecordDataSize() ); }
@Override public boolean visitPropertyCommand( PropertyCommand command ) { PropertyStore propertyStore = neoStores.getPropertyStore(); track( propertyStore, command ); for ( PropertyBlock block : command.getAfter() ) { switch ( block.getType() ) { case STRING: track( propertyStore.getStringStore(), block.getValueRecords() ); break; case ARRAY: track( propertyStore.getArrayStore(), block.getValueRecords() ); break; default: // Not needed, no dynamic records then break; } } return false; }
long propertyStoreSize = storeSize( legacyStore.getPropertyStore() ) / 2 + storeSize( legacyStore.getPropertyStore().getStringStore() ) / 2 + storeSize( legacyStore.getPropertyStore().getArrayStore() ) / 2; Estimates estimates = knownEstimates( legacyStore.getNodeStore().getNumberOfIdsInUse(),
@Test public void testSetBlockSize() throws Exception { DatabaseLayout databaseLayout = dir.databaseLayout( "small_store" ); initializeStores( databaseLayout, stringMap( "unsupported.dbms.block_size.strings", "62", "unsupported.dbms.block_size.array_properties", "302" ) ); assertEquals( 62 + DynamicRecordFormat.RECORD_HEADER_SIZE, pStore.getStringStore().getRecordSize() ); assertEquals( 302 + DynamicRecordFormat.RECORD_HEADER_SIZE, pStore.getArrayStore().getRecordSize() ); ds.stop(); }
@Before public void before() { FileSystemAbstraction fs = fileSystemRule.get(); DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory( fs ); PageCache pageCache = pageCacheRule.getPageCache( fs ); StoreFactory factory = new StoreFactory( testDirectory.databaseLayout(), Config.defaults(), idGeneratorFactory, pageCache, fs, NullLogProvider.getInstance(), EmptyVersionContextSupplier.EMPTY ); neoStores = factory.openAllNeoStores( true ); arrayStore = neoStores.getPropertyStore().getArrayStore(); }
@Test public void useProvidedAdditionalConfig() throws Exception { // GIVEN int arrayBlockSize = 10; int stringBlockSize = 12; File dbConfig = file( "neo4j.properties" ); store( stringMap( GraphDatabaseSettings.array_block_size.name(), String.valueOf( arrayBlockSize ), GraphDatabaseSettings.string_block_size.name(), String.valueOf( stringBlockSize ) ), dbConfig ); List<String> nodeIds = nodeIds(); // WHEN importTool( "--into", dbRule.getDatabaseDirAbsolutePath(), "--additional-config", dbConfig.getAbsolutePath(), "--nodes", nodeData( true, Configuration.COMMAS, nodeIds, value -> true ).getAbsolutePath() ); // THEN NeoStores stores = dbRule.getGraphDatabaseAPI().getDependencyResolver() .resolveDependency( RecordStorageEngine.class ).testAccessNeoStores(); int headerSize = Standard.LATEST_RECORD_FORMATS.dynamic().getRecordHeaderSize(); assertEquals( arrayBlockSize + headerSize, stores.getPropertyStore().getArrayStore().getRecordSize() ); assertEquals( stringBlockSize + headerSize, stores.getPropertyStore().getStringStore().getRecordSize() ); }
@Test public void shouldRespectDbConfig() throws Exception { // GIVEN int arrayBlockSize = 10; int stringBlockSize = 12; File dbConfig = file( "neo4j.properties" ); store( stringMap( GraphDatabaseSettings.array_block_size.name(), String.valueOf( arrayBlockSize ), GraphDatabaseSettings.string_block_size.name(), String.valueOf( stringBlockSize ) ), dbConfig ); List<String> nodeIds = nodeIds(); // WHEN importTool( "--into", dbRule.getDatabaseDirAbsolutePath(), "--db-config", dbConfig.getAbsolutePath(), "--nodes", nodeData( true, Configuration.COMMAS, nodeIds, value -> true ).getAbsolutePath() ); // THEN NeoStores stores = dbRule.getGraphDatabaseAPI().getDependencyResolver() .resolveDependency( RecordStorageEngine.class ).testAccessNeoStores(); int headerSize = Standard.LATEST_RECORD_FORMATS.dynamic().getRecordHeaderSize(); assertEquals( arrayBlockSize + headerSize, stores.getPropertyStore().getArrayStore().getRecordSize() ); assertEquals( stringBlockSize + headerSize, stores.getPropertyStore().getStringStore().getRecordSize() ); }
@Test public void combineProvidedDbAndAdditionalConfig() throws Exception { // GIVEN int arrayBlockSize = 10; int stringBlockSize = 12; File dbConfig = file( "neo4j.properties" ); File additionalConfig = file( "additional.properties" ); store( stringMap( GraphDatabaseSettings.string_block_size.name(), String.valueOf( stringBlockSize ) ), dbConfig ); store( stringMap( GraphDatabaseSettings.array_block_size.name(), String.valueOf( arrayBlockSize ) ), additionalConfig ); List<String> nodeIds = nodeIds(); // WHEN importTool( "--into", dbRule.getDatabaseDirAbsolutePath(), "--db-config", dbConfig.getAbsolutePath(), "--additional-config", additionalConfig.getAbsolutePath(), "--nodes", nodeData( true, Configuration.COMMAS, nodeIds, value -> true ).getAbsolutePath() ); // THEN NeoStores stores = dbRule.getGraphDatabaseAPI().getDependencyResolver() .resolveDependency( RecordStorageEngine.class ).testAccessNeoStores(); int headerSize = Standard.LATEST_RECORD_FORMATS.dynamic().getRecordHeaderSize(); assertEquals( arrayBlockSize + headerSize, stores.getPropertyStore().getArrayStore().getRecordSize() ); assertEquals( stringBlockSize + headerSize, stores.getPropertyStore().getStringStore().getRecordSize() ); }
RecordStorageCommandCreationContext( NeoStores neoStores, int denseNodeThreshold, int idBatchSize ) { this.neoStores = neoStores; this.idBatches = new RenewableBatchIdSequences( neoStores, idBatchSize ); this.loaders = new Loaders( neoStores ); RelationshipGroupGetter relationshipGroupGetter = new RelationshipGroupGetter( idBatches.idGenerator( StoreType.RELATIONSHIP_GROUP ) ); this.relationshipCreator = new RelationshipCreator( relationshipGroupGetter, denseNodeThreshold ); PropertyTraverser propertyTraverser = new PropertyTraverser(); this.propertyDeleter = new PropertyDeleter( propertyTraverser ); this.relationshipDeleter = new RelationshipDeleter( relationshipGroupGetter, propertyDeleter ); this.propertyCreator = new PropertyCreator( new StandardDynamicRecordAllocator( idBatches.idGenerator( StoreType.PROPERTY_STRING ), neoStores.getPropertyStore().getStringStore().getRecordDataSize() ), new StandardDynamicRecordAllocator( idBatches.idGenerator( StoreType.PROPERTY_ARRAY ), neoStores.getPropertyStore().getArrayStore().getRecordDataSize() ), idBatches.idGenerator( StoreType.PROPERTY ), propertyTraverser, neoStores.getPropertyStore().allowStorePointsAndTemporal() ); }
@Test public void shouldRespectDbConfig() throws Exception { // GIVEN int size = 10; Config config = Config.defaults( stringMap( GraphDatabaseSettings.array_block_size.name(), String.valueOf( size ), GraphDatabaseSettings.string_block_size.name(), String.valueOf( size ) ) ); // WHEN RecordFormats recordFormats = LATEST_RECORD_FORMATS; int headerSize = recordFormats.dynamic().getRecordHeaderSize(); try ( JobScheduler jobScheduler = new ThreadPoolJobScheduler(); BatchingNeoStores store = BatchingNeoStores.batchingNeoStores( storage.fileSystem(), storage.directory().absolutePath(), recordFormats, DEFAULT, NullLogService.getInstance(), EMPTY, config, jobScheduler ) ) { store.createNew(); // THEN assertEquals( size + headerSize, store.getPropertyStore().getArrayStore().getRecordSize() ); assertEquals( size + headerSize, store.getPropertyStore().getStringStore().getRecordSize() ); } }
/** * This method exists since {@link #wrapStore(RecordStore)} might depend on the existence of a variable * that gets set in a subclass' constructor <strong>after</strong> this constructor of {@link StoreAccess} * has been executed. I.e. a correct creation of a {@link StoreAccess} instance must be the creation of the * object plus a call to {@link #initialize()}. * * @return this */ public StoreAccess initialize() { this.schemaStore = wrapStore( neoStores.getSchemaStore() ); this.nodeStore = wrapStore( neoStores.getNodeStore() ); this.relStore = wrapStore( neoStores.getRelationshipStore() ); this.propStore = wrapStore( neoStores.getPropertyStore() ); this.stringStore = wrapStore( neoStores.getPropertyStore().getStringStore() ); this.arrayStore = wrapStore( neoStores.getPropertyStore().getArrayStore() ); this.relationshipTypeTokenStore = wrapStore( neoStores.getRelationshipTypeTokenStore() ); this.labelTokenStore = wrapStore( neoStores.getLabelTokenStore() ); this.nodeDynamicLabelStore = wrapStore( wrapNodeDynamicLabelStore( neoStores.getNodeStore().getDynamicLabelStore() ) ); this.propertyKeyTokenStore = wrapStore( neoStores.getPropertyStore().getPropertyKeyTokenStore() ); this.relationshipTypeNameStore = wrapStore( neoStores.getRelationshipTypeTokenStore().getNameStore() ); this.labelNameStore = wrapStore( neoStores.getLabelTokenStore().getNameStore() ); this.propertyKeyNameStore = wrapStore( neoStores.getPropertyStore().getPropertyKeyTokenStore().getNameStore() ); this.relGroupStore = wrapStore( neoStores.getRelationshipGroupStore() ); return this; }
break; case ARRAY: valueStore = neoStores.getPropertyStore().getArrayStore(); break; default: throw new IllegalArgumentException( propertyRecord + " " + property );
assertEquals( "PropertyStore", 20 + 1, neoStores.getPropertyStore().getHighId() ); assertEquals( "PropertyStore DynamicStringStore", 7 + 1, neoStores.getPropertyStore().getStringStore().getHighId() ); assertEquals( "PropertyStore DynamicArrayStore", 9 + 1, neoStores.getPropertyStore().getArrayStore().getHighId() ); assertEquals( "SchemaStore", 20 + 1, neoStores.getSchemaStore().getHighId() );
public PropertyValueRecordSizeCalculator( PropertyStore propertyStore ) { this( propertyStore.getRecordSize(), propertyStore.getStringStore().getRecordSize(), propertyStore.getStringStore().getRecordDataSize(), propertyStore.getArrayStore().getRecordSize(), propertyStore.getArrayStore().getRecordDataSize() ); }