@Override public long getHighId() { return actual.getHighId(); }
@Override public long maxCount() { return store.getHighId(); }
@Override public boolean hasNext() { if ( forward ) { if ( id < targetId ) { return true; } targetId = store.getHighId(); return id < targetId; } return id > 0; }
@Override protected long position() { return store.getHighId() * store.getRecordSize(); } }
StoreScanAsInputIterator( RecordStore<RECORD> store ) { this.batchSize = store.getRecordsPerPage() * 10; this.highId = store.getHighId(); }
@Override public String toString() { return getClass().getSimpleName() + "[" + name + " @ " + processor.getStage() + ", " + store + ":" + store.getHighId() + "]"; } }
private static <T extends AbstractBaseRecord> T[] readAllRecords( Class<T> type, RecordStore<T> store ) { @SuppressWarnings( "unchecked" ) T[] records = (T[]) Array.newInstance( type, (int) store.getHighId() ); for ( int i = 0; i < records.length; i++ ) { records[i] = store.getRecord( i, store.newRecord(), FORCE ); } return records; } }
static RecordIdIterator allInReversed( RecordStore<? extends AbstractBaseRecord> store, Configuration config ) { return backwards( store.getNumberOfReservedLowIds(), store.getHighId(), config ); }
static RecordIdIterator allIn( RecordStore<? extends AbstractBaseRecord> store, Configuration config ) { return forwards( store.getNumberOfReservedLowIds(), store.getHighId(), config ); }
StoreProcessorTask( String name, Statistics statistics, int threads, RecordStore<R> store, StoreAccess storeAccess, String builderPrefix, ProgressMonitorFactory.MultiPartBuilder builder, CacheAccess cacheAccess, StoreProcessor processor, QueueDistribution distribution ) { super( name, statistics, threads ); this.store = store; this.storeAccess = storeAccess; this.cacheAccess = cacheAccess; this.processor = processor; this.distribution = distribution; this.progressListener = builder.progressForPart( name + indexedPartName( store.getStorageFile().getName(), builderPrefix ), store.getHighId() ); }
public void warmUpCache() { int recordsPerPage = store.getRecordsPerPage(); long id = 0; long half = store.getHighId() / 2; RECORD record = store.newRecord(); while ( id < half ) { store.getRecord( id, record, FORCE ); id += recordsPerPage - 1; } } }
private void flushIdFiles( NeoStores neoStores, StoreType[] storeTypes ) { for ( StoreType type : storeTypes ) { if ( type.isRecordStore() ) { RecordStore<AbstractBaseRecord> recordStore = neoStores.getRecordStore( type ); Optional<File> idFile = databaseLayout.idFile( type.getDatabaseFile() ); idFile.ifPresent( f -> idGeneratorFactory.create( f, recordStore.getHighId(), false ) ); } } } }
private static <RECORD extends AbstractBaseRecord> void assertSameStoreContents( RecordStore<RECORD> store1, RecordStore<RECORD> store2 ) { long highId1 = store1.getHighId(); long highId2 = store2.getHighId(); long maxHighId = max( highId1, highId2 ); RECORD record1 = store1.newRecord(); RECORD record2 = store2.newRecord(); for ( long id = store1.getNumberOfReservedLowIds(); id < maxHighId; id++ ) { store1.getRecord( id, record1, RecordLoad.CHECK ); store2.getRecord( id, record2, RecordLoad.CHECK ); assertEquals( record1, record2 ); } }
StoreAccess stores = new StoreAccess( graphDb.getDependencyResolver() .resolveDependency( RecordStorageEngine.class ).testAccessNeoStores() ).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();
public static <RECORD extends AbstractBaseRecord> int numberOfRecordsInUse( RecordStore<RECORD> store ) { int inUse = 0; for ( long id = store.getNumberOfReservedLowIds(); id < store.getHighId(); id++ ) { RECORD record = store.getRecord( id, store.newRecord(), RecordLoad.FORCE ); if ( record.inUse() ) { inUse++; } } return inUse; }
private void initializeMisc( BatchingNeoStores neoStores, DataStatistics distribution ) { printStageHeader( "(4/4) Post processing", ESTIMATED_REQUIRED_MEMORY_USAGE, bytes( baselineMemoryRequirement( neoStores ) ) ); long actualNodeCount = distribution.getNodeCount(); // The reason the highId of the relationship store is used, as opposed to actual number of imported relationships // is that the stages underneath operate on id ranges, not knowing which records are actually in use. long relationshipRecordIdCount = neoStores.getRelationshipStore().getHighId(); long groupCount = neoStores.getTemporaryRelationshipGroupStore().getHighId(); initializeProgress( groupCount + // Count groups groupCount + // Write groups groupCount + // Node --> Group actualNodeCount + // Node counts relationshipRecordIdCount, // Relationship counts ImportStage.postProcessing ); }
@Override protected void processCache() { RecordStore<NodeRecord> nodeStore = storeAccess.getNodeStore(); CacheAccess.Client client = cacheAccess.client(); long highId = nodeStore.getHighId(); for ( long nodeId = 0; nodeId < highId; nodeId++ ) { if ( client.getFromCache( nodeId, CacheSlots.NextRelationship.SLOT_FIRST_IN_TARGET ) == 0 ) { NodeRecord node = nodeStore.getRecord( nodeId, nodeStore.newRecord(), FORCE ); if ( node.inUse() && !node.isDense() ) { storeProcessor.processNode( nodeStore, node ); } } } } }
private void defrag( int nodeCount, RecordStore<RelationshipGroupRecord> groupStore ) { Monitor monitor = mock( Monitor.class ); RelationshipGroupDefragmenter defragmenter = new RelationshipGroupDefragmenter( CONFIG, ExecutionMonitors.invisible(), monitor, AUTO_WITHOUT_PAGECACHE ); // Calculation below correlates somewhat to calculation in RelationshipGroupDefragmenter. // Anyway we verify below that we exercise the multi-pass bit, which is what we want long memory = groupStore.getHighId() * 15 + 200; defragmenter.run( memory, stores, nodeCount ); // Verify that we exercise the multi-pass functionality verify( monitor, atLeast( 2 ) ).defragmentingNodeRange( anyLong(), anyLong() ); verify( monitor, atMost( 10 ) ).defragmentingNodeRange( anyLong(), anyLong() ); }