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 ); }
@Override protected Object nextBatchOrNull( long ticket, int batchSize ) { count += batchSize; return ids.nextBatch(); }
public RelationshipCountsStage( Configuration config, NodeLabelsCache cache, RelationshipStore relationshipStore, int highLabelId, int highRelationshipTypeId, CountsAccessor.Updater countsUpdater, NumberArrayFactory cacheFactory, ProgressReporter progressReporter ) { super( NAME, null, config, RECYCLE_BATCHES ); add( new BatchFeedStep( control(), config, allIn( relationshipStore, config ), relationshipStore.getRecordSize() ) ); add( new ReadRecordsStep<>( control(), config, false, relationshipStore ) ); add( new ProcessRelationshipCountsDataStep( control(), cache, config, highLabelId, highRelationshipTypeId, countsUpdater, cacheFactory, progressReporter ) ); } }
public ScanAndCacheGroupsStage( Configuration config, RecordStore<RelationshipGroupRecord> store, RelationshipGroupCache cache, StatsProvider... additionalStatsProviders ) { super( NAME, null, config, RECYCLE_BATCHES ); add( new BatchFeedStep( control(), config, allInReversed( store, config ), store.getRecordSize() ) ); add( new ReadRecordsStep<>( control(), config, false, store ) ); add( new CacheGroupsStep( control(), config, cache, additionalStatsProviders ) ); } }
public CountGroupsStage( Configuration config, RecordStore<RelationshipGroupRecord> store, RelationshipGroupCache groupCache, StatsProvider... additionalStatsProviders ) { super( NAME, null, config, RECYCLE_BATCHES ); add( new BatchFeedStep( control(), config, allIn( store, config ), store.getRecordSize() ) ); add( new ReadRecordsStep<>( control(), config, false, store ) ); add( new CountGroupsStep( control(), config, groupCache, additionalStatsProviders ) ); } }
public ScanAndCacheGroupsStage( Configuration config, RecordStore<RelationshipGroupRecord> store, RelationshipGroupCache cache, StatsProvider... additionalStatsProviders ) { super( NAME, null, config, RECYCLE_BATCHES ); add( new BatchFeedStep( control(), config, allInReversed( store, config ), store.getRecordSize() ) ); add( new ReadRecordsStep<>( control(), config, false, store ) ); add( new CacheGroupsStep( control(), config, cache, additionalStatsProviders ) ); } }
@Test public void shouldGoPageWiseBackwardsOnSingleBatch() { // GIVEN RecordIdIterator ids = RecordIdIterator.backwards( 0, 8, withBatchSize( DEFAULT, 10 ) ); // THEN assertIds( ids, array( 0, 1, 2, 3, 4, 5, 6, 7 ) ); }
public NodeDegreeCountStage( Configuration config, RelationshipStore store, NodeRelationshipCache cache, StatsProvider memoryUsageStatsProvider ) { super( NAME, null, config, RECYCLE_BATCHES ); add( new BatchFeedStep( control(), config, forwards( 0, store.getHighId(), config ), store.getRecordSize() ) ); add( new ReadRecordsStep<>( control(), config, false, store ) ); add( new CalculateDenseNodesStep( control(), config, cache, memoryUsageStatsProvider ) ); } }
private void assertIds( RecordIdIterator ids, long[]... expectedIds ) { for ( long[] expectedArray : expectedIds ) { LongIterator iterator = ids.nextBatch(); assertNotNull( iterator ); for ( long expectedId : expectedArray ) { assertEquals( expectedId, iterator.next() ); } assertFalse( iterator.hasNext() ); } assertNull( ids.nextBatch() ); }
public NodeCountsStage( Configuration config, NodeLabelsCache cache, NodeStore nodeStore, int highLabelId, CountsAccessor.Updater countsUpdater, ProgressReporter progressReporter, StatsProvider... additionalStatsProviders ) { super( NAME, null, config, RECYCLE_BATCHES ); add( new BatchFeedStep( control(), config, allIn( nodeStore, config ), nodeStore.getRecordSize() ) ); add( new ReadRecordsStep<>( control(), config, false, nodeStore ) ); add( new RecordProcessorStep<>( control(), "COUNT", config, new NodeCountsProcessor( nodeStore, cache, highLabelId, countsUpdater, progressReporter ), true, additionalStatsProviders ) ); } }
@Test public void shouldGoPageWiseBackwardsOnCleanBreak() { // GIVEN RecordIdIterator ids = RecordIdIterator.backwards( 0, 20, withBatchSize( DEFAULT, 10 ) ); // THEN assertIds( ids, array( 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 ), array( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ) ); }
@Test public void shouldGoForwardsWhenStartingFromNonZero() { // GIVEN RecordIdIterator ids = RecordIdIterator.forwards( 1, 12, withBatchSize( DEFAULT, 10 ) ); // THEN assertIds( ids, array( 1, 2, 3, 4, 5, 6, 7, 8, 9 ), array( 10, 11 ) ); }
@Override protected Object nextBatchOrNull( long ticket, int batchSize ) { count += batchSize; return ids.nextBatch(); }
public NodeFirstGroupStage( Configuration config, RecordStore<RelationshipGroupRecord> groupStore, NodeStore nodeStore, ByteArray cache ) { super( NAME, null, config, 0 ); add( new BatchFeedStep( control(), config, allIn( groupStore, config ), groupStore.getRecordSize() ) ); add( new ReadRecordsStep<>( control(), config, true, groupStore ) ); add( new NodeSetFirstGroupStep( control(), config, nodeStore, cache ) ); add( new UpdateRecordsStep<>( control(), config, nodeStore, new StorePrepareIdSequence() ) ); } }
@Test public void shouldGoBackwardsToNonZero() { // GIVEN RecordIdIterator ids = RecordIdIterator.backwards( 12, 34, withBatchSize( DEFAULT, 10 ) ); // THEN assertIds( ids, array( 30, 31, 32, 33 ), array( 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 ), array( 12, 13, 14, 15, 16, 17, 18, 19 ) ); }
@Test public void shouldGoForwardsWhenStartingFromNonZero2() { // GIVEN RecordIdIterator ids = RecordIdIterator.forwards( 34, 66, withBatchSize( DEFAULT, 10 ) ); // THEN assertIds( ids, array( 34, 35, 36, 37, 38, 39 ), array( 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 ), array( 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 ), array( 60, 61, 62, 63, 64, 65 ) ); }
public NodeCountsAndLabelIndexBuildStage( Configuration config, NodeLabelsCache cache, NodeStore nodeStore, int highLabelId, CountsAccessor.Updater countsUpdater, ProgressReporter progressReporter, LabelScanStore labelIndex, StatsProvider... additionalStatsProviders ) { super( NAME, null, config, ORDER_SEND_DOWNSTREAM | RECYCLE_BATCHES ); add( new BatchFeedStep( control(), config, allIn( nodeStore, config ), nodeStore.getRecordSize() ) ); add( new ReadRecordsStep<>( control(), config, false, nodeStore ) ); add( new LabelIndexWriterStep( control(), config, labelIndex, nodeStore ) ); add( new RecordProcessorStep<>( control(), "COUNT", config, new NodeCountsProcessor( nodeStore, cache, highLabelId, countsUpdater, progressReporter ), true, additionalStatsProviders ) ); } }
@Test public void shouldGoPageWiseBackwards() { // GIVEN RecordIdIterator ids = RecordIdIterator.backwards( 0, 33, withBatchSize( DEFAULT, 10 ) ); // THEN assertIds( ids, array( 30, 31, 32 ), array( 20, 21, 22, 23, 24, 25, 26, 27, 28, 29 ), array( 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 ), array( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ) ); }
public RelationshipLinkforwardStage( String topic, Configuration config, BatchingNeoStores stores, NodeRelationshipCache cache, Predicate<RelationshipRecord> readFilter, Predicate<RelationshipRecord> denseChangeFilter, int nodeTypes, StatsProvider... additionalStatsProvider ) { super( NAME, topic, config, ORDER_SEND_DOWNSTREAM | RECYCLE_BATCHES ); RelationshipStore store = stores.getRelationshipStore(); add( new BatchFeedStep( control(), config, forwards( 0, store.getHighId(), config ), store.getRecordSize() ) ); add( new ReadRecordsStep<>( control(), config, true, store, new RecordDataAssembler<>( store::newRecord, readFilter ) ) ); add( new RelationshipLinkforwardStep( control(), config, cache, denseChangeFilter, nodeTypes, additionalStatsProvider ) ); add( new UpdateRecordsStep<>( control(), config, store, PrepareIdSequence.of( stores.usesDoubleRelationshipRecordUnits() ) ) ); } }