示例#1
0
        public RelationshipLinkforwardStage(string topic, Configuration config, BatchingNeoStores stores, NodeRelationshipCache cache, System.Predicate <RelationshipRecord> readFilter, System.Predicate <RelationshipRecord> denseChangeFilter, int nodeTypes, params StatsProvider[] additionalStatsProvider) : base(NAME, topic, config, ORDER_SEND_DOWNSTREAM | RECYCLE_BATCHES)
        {
            RelationshipStore store = stores.RelationshipStore;

            Add(new BatchFeedStep(Control(), config, forwards(0, store.HighId, config), store.RecordSize));
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: add(new org.neo4j.unsafe.impl.batchimport.staging.ReadRecordsStep<>(control(), config, true, store, new org.neo4j.unsafe.impl.batchimport.staging.RecordDataAssembler<>(store::newRecord, readFilter)));
            Add(new ReadRecordsStep <object>(Control(), config, true, store, new RecordDataAssembler <object>(store.newRecord, readFilter)));
            Add(new RelationshipLinkforwardStep(Control(), config, cache, denseChangeFilter, nodeTypes, additionalStatsProvider));
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: add(new UpdateRecordsStep<>(control(), config, store, org.neo4j.unsafe.impl.batchimport.store.PrepareIdSequence.of(stores.usesDoubleRelationshipRecordUnits())));
            Add(new UpdateRecordsStep <object>(Control(), config, store, PrepareIdSequence.of(stores.UsesDoubleRelationshipRecordUnits())));
        }
示例#2
0
 protected internal RelationshipImporter(BatchingNeoStores stores, IdMapper idMapper, DataStatistics typeDistribution, Monitor monitor, Collector badCollector, bool validateRelationshipData, bool doubleRecordUnits) : base(stores, monitor)
 {
     this._doubleRecordUnits = doubleRecordUnits;
     this._relationshipTypeTokenRepository = stores.RelationshipTypeRepository;
     this._idMapper                 = idMapper;
     this._badCollector             = badCollector;
     this._validateRelationshipData = validateRelationshipData;
     this._relationshipStore        = stores.RelationshipStore;
     this._relationshipRecord       = _relationshipStore.newRecord();
     this._relationshipIds          = new BatchingIdGetter(_relationshipStore);
     this._typeCounts               = typeDistribution.NewClient();
     this._prepareIdSequence        = PrepareIdSequence.of(doubleRecordUnits).apply(stores.RelationshipStore);
     _relationshipRecord.InUse      = true;
 }
示例#3
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void doImport(org.neo4j.unsafe.impl.batchimport.input.Input input) throws java.io.IOException
        public override void DoImport(Input input)
        {
            using (BatchingNeoStores store = instantiateNeoStores(_fileSystem, _directoryStructure.databaseDirectory(), _externalPageCache, _recordFormats, _config, _logService, _additionalInitialIds, _dbConfig, _jobScheduler), ImportLogic logic = new ImportLogic(_directoryStructure.databaseDirectory(), _fileSystem, store, _config, _logService, _executionMonitor, _recordFormats, _monitor))
            {
                store.CreateNew();
                logic.Initialize(input);

                logic.ImportNodes();
                logic.PrepareIdMapper();
                logic.ImportRelationships();
                logic.CalculateNodeDegrees();
                logic.LinkRelationshipsOfAllTypes();
                logic.DefragmentRelationshipGroups();
                logic.BuildCountsStore();

                logic.Success();
            }
        }
        public virtual void Run(long memoryWeCanHoldForCertain, BatchingNeoStores neoStore, long highNodeId)
        {
            using (RelationshipGroupCache groupCache = new RelationshipGroupCache(_numberArrayFactory, memoryWeCanHoldForCertain, highNodeId))
            {
                // Read from the temporary relationship group store...
                RecordStore <RelationshipGroupRecord> fromStore = neoStore.TemporaryRelationshipGroupStore;
                // and write into the main relationship group store
                RecordStore <RelationshipGroupRecord> toStore = neoStore.RelationshipGroupStore;

                // Count all nodes, how many groups each node has each
                Configuration groupConfig = withBatchSize(_config, neoStore.RelationshipGroupStore.RecordsPerPage);
                StatsProvider memoryUsage = new MemoryUsageStatsProvider(neoStore, groupCache);
                ExecuteStage(new CountGroupsStage(groupConfig, fromStore, groupCache, memoryUsage));
                long fromNodeId = 0;
                long toNodeId   = 0;
                while (fromNodeId < highNodeId)
                {
                    // See how many nodes' groups we can fit into the cache this iteration of the loop.
                    // Groups that doesn't fit in this round will be included in consecutive rounds.
                    toNodeId = groupCache.Prepare(fromNodeId);
                    _monitor.defragmentingNodeRange(fromNodeId, toNodeId);
                    // Cache those groups
                    ExecuteStage(new ScanAndCacheGroupsStage(groupConfig, fromStore, groupCache, memoryUsage));
                    // And write them in sequential order in the store
                    ExecuteStage(new WriteGroupsStage(groupConfig, groupCache, toStore));

                    // Make adjustments for the next iteration
                    fromNodeId = toNodeId;
                }

                // Now update nodes to point to the new groups
                ByteArray groupCountCache = groupCache.GroupCountCache;
                groupCountCache.clear();
                Configuration nodeConfig = withBatchSize(_config, neoStore.NodeStore.RecordsPerPage);
                ExecuteStage(new NodeFirstGroupStage(nodeConfig, toStore, neoStore.NodeStore, groupCountCache));
            }
        }
示例#5
0
 public DeleteDuplicateNodesStage(Configuration config, LongIterator duplicateNodeIds, BatchingNeoStores neoStore, DataImporter.Monitor storeMonitor) : base("DEDUP", null, config, 0)
 {
     Add(new DeleteDuplicateNodesStep(Control(), config, duplicateNodeIds, neoStore.NodeStore, neoStore.PropertyStore, storeMonitor));
 }