public PropertyValueRecordSizeCalculator( PropertyStore propertyStore ) { this( propertyStore.getRecordSize(), propertyStore.getStringStore().getRecordSize(), propertyStore.getStringStore().getRecordDataSize(), propertyStore.getArrayStore().getRecordSize(), propertyStore.getArrayStore().getRecordDataSize() ); }
for ( int i = 1; i <= highestId; i++ ) // id '0' is the dynamic store header assertThat( store.nextId(), is( (long) i ) ); record.setId( i ); StringBuilder sb = new StringBuilder( i ); store.updateRecord( record ); store.setHighestPossibleIdInUse( highestId ); store.updateRecord( record ); store.rebuildIdGenerator(); nextIds.add( store.nextId() ); // 2 nextIds.add( store.nextId() ); // 3 nextIds.add( store.nextId() ); // 5 nextIds.add( store.nextId() ); // 7 nextIds.add( store.nextId() ); // 51 assertThat( nextIds, contains( 2L, 3L, 5L, 7L, 51L ) ); neoStores.close();
private CommonAbstractStore createDynamicStringStore( File storeFile, File idFile, IdType idType, int blockSize ) { return initialize( new DynamicStringStore( storeFile, idFile, config, idType, idGeneratorFactory, pageCache, logProvider, blockSize, recordFormats.dynamic(), recordFormats.storeVersion(), openOptions ) ); }
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() ); }
@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(); }
@Override public void updateRecord( RECORD record ) { super.updateRecord( record ); if ( !record.isLight() ) { for ( DynamicRecord keyRecord : record.getNameRecords() ) { nameStore.updateRecord( keyRecord ); } } }
String.valueOf( legacyStores.getPropertyStore().getArrayStore().getRecordDataSize() ) ); config.put( GraphDatabaseSettings.string_block_size.name(), String.valueOf( legacyStores.getPropertyStore().getStringStore().getRecordDataSize() ) );
public Collection<DynamicRecord> allocateNameRecords( byte[] chars ) { Collection<DynamicRecord> records = new ArrayList<>(); nameStore.allocateRecordsFromBytes( records, chars ); return records; }
private long dynamicStringRecordsInUse() { return propertyStore.getStringStore().getHighId(); } }
@Override public void ensureHeavy( RECORD record ) { if ( !record.isLight() ) { return; } record.addNameRecords( nameStore.getRecords( record.getNameId(), NORMAL ) ); }
@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() ); }
private void updateDynamicRecords( List<DynamicRecord> records ) { for ( DynamicRecord valueRecord : records ) { PropertyType recordType = valueRecord.getType(); if ( recordType == PropertyType.STRING ) { stringStore.updateRecord( valueRecord ); } else if ( recordType == PropertyType.ARRAY ) { arrayStore.updateRecord( valueRecord ); } else { throw new InvalidRecordException( "Unknown dynamic record" + valueRecord ); } } }
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() ); }
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() ); }
public Collection<DynamicRecord> allocateNameRecords( byte[] chars ) { Collection<DynamicRecord> records = new ArrayList<>(); nameStore.allocateRecordsFromBytes( records, chars ); return records; }
assertEquals( "RelationshipTypeStore", 5 + 1, neoStores.getRelationshipTypeTokenStore().getHighId() ); assertEquals( "RelationshipType NameStore", 1 + 1, neoStores.getRelationshipTypeTokenStore().getNameStore().getHighId() ); assertEquals( "PropertyKeyStore", 5 + 1, neoStores.getPropertyKeyTokenStore().getHighId() ); assertEquals( "PropertyKey NameStore", 1 + 1, neoStores.getPropertyKeyTokenStore().getNameStore().getHighId() ); assertEquals( "LabelStore", 5 + 1, neoStores.getLabelTokenStore().getHighId() ); assertEquals( "Label NameStore", 1 + 1, neoStores.getLabelTokenStore().getNameStore().getHighId() ); 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() );
@Override public void ensureHeavy( RECORD record ) { if ( !record.isLight() ) { return; } record.addNameRecords( nameStore.getRecords( record.getNameId(), NORMAL ) ); }
@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() ); }
public PropertyValueRecordSizeCalculator( PropertyStore propertyStore ) { this( propertyStore.getRecordSize(), propertyStore.getStringStore().getRecordSize(), propertyStore.getStringStore().getRecordDataSize(), propertyStore.getArrayStore().getRecordSize(), propertyStore.getArrayStore().getRecordDataSize() ); }
assertFalse( recordBeforeWrite.inUse() ); return null; } ).when( stringPropertyStore ).updateRecord( dynamicRecord ); verify( stringPropertyStore ).updateRecord( dynamicRecord );