Esempio n. 1
0
            public void checkReference(Org.Neo4j.Kernel.impl.store.record.RelationshipRecord record, Org.Neo4j.Kernel.impl.store.record.RelationshipRecord referred, CheckerEngine <Org.Neo4j.Kernel.impl.store.record.RelationshipRecord, Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipConsistencyReport> engine, Org.Neo4j.Consistency.store.RecordAccess records)
            {
                NodeField field = NodeField.select(referred, node(record)); if (field == null)

                {
                    otherNode(engine.report(), referred);
                }
                else
                {
                    Org.Neo4j.Consistency.checking.cache.CacheAccess_Client cacheAccess = records.cacheAccess().client(); if (other(field, referred) != record.getId())
                    {
                        if (referred.isCreated())
                        {
                            Org.Neo4j.Consistency.store.RecordReference <Org.Neo4j.Kernel.impl.store.record.RelationshipRecord> refRel = records.relationship(referred.getId()); referred = (Org.Neo4j.Kernel.impl.store.record.RelationshipRecord)((Org.Neo4j.Consistency.store.DirectRecordReference)refRel).record(); checkReference(record, referred, engine, records); cacheAccess.incAndGetCount(Org.Neo4j.Consistency.statistics.Counts_Type.skipBackup);
                        }
                        else
                        {
                            cacheAccess.incAndGetCount(Org.Neo4j.Consistency.statistics.Counts_Type.checkErrors); noBackReference(engine == null ? null : engine.report(), referred);
                        }
                    }
                    else
                    {
                        if (!referenceShouldBeSkipped(record, referred.getId(), records) && !referred.inUse())
                        {
                            engine.report().notUsedRelationshipReferencedInChain(referred);
                        }
                        if (referred.isCreated())
                        {
                            cacheAccess.clearCache(node(record));
                        }
                    }
                }
            }
Esempio n. 2
0
 public void CheckReference(Org.Neo4j.Kernel.impl.store.record.RelationshipRecord record, Org.Neo4j.Kernel.impl.store.record.RelationshipTypeTokenRecord referred, CheckerEngine <Org.Neo4j.Kernel.impl.store.record.RelationshipRecord, Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipConsistencyReport> engine, Org.Neo4j.Consistency.store.RecordAccess records)
 {
     if (!referred.InUse())
     {
         engine.Report().relationshipTypeNotInUse(referred);
     }
 }
Esempio n. 3
0
        protected internal override void ForkedProcess(int id, int processors, RelationshipRecord[] batch)
        {
            int stride           = _forwards ? 1 : -1;
            int start            = _forwards ? 0 : batch.Length - 1;
            int end              = _forwards ? batch.Length : -1;
            int localChangeCount = 0;

            for (int i = start; i != end; i += stride)
            {
                RelationshipRecord item = batch[i];
                if (item != null && item.InUse())
                {
                    int changeCount = Process(item, id, processors);
                    if (changeCount == -1)
                    {
                        // No change for this record, it's OK, all the processors will reach the same conclusion
                        batch[i].InUse = false;
                    }
                    else
                    {
                        localChangeCount += changeCount;
                    }
                }
            }
            _progress.add(localChangeCount);
        }
Esempio n. 4
0
 public void checkConsistency(Org.Neo4j.Kernel.impl.store.record.RelationshipRecord relationship, CheckerEngine <Org.Neo4j.Kernel.impl.store.record.RelationshipRecord, Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipConsistencyReport> engine, Org.Neo4j.Consistency.store.RecordAccess records)
 {
     Org.Neo4j.Consistency.checking.cache.CacheAccess_Client cacheAccess = records.cacheAccess().client(); if (!endOfChain(relationship))
     {
         Org.Neo4j.Consistency.store.RecordReference <Org.Neo4j.Kernel.impl.store.record.RelationshipRecord> referred = null; long reference = valueFrom(relationship); long nodeId = -1; if (records.shouldCheck(reference, Org.Neo4j.Consistency.checking.full.MultiPassStore.RELATIONSHIPS))
         {
             nodeId = NODE == NodeField.SOURCE ? relationship.getFirstNode() : relationship.getSecondNode(); if (Org.Neo4j.Kernel.impl.store.record.Record.NO_NEXT_RELATIONSHIP.@is(cacheAccess.getFromCache(nodeId, SLOT_RELATIONSHIP_ID)))
             {
                 referred = Org.Neo4j.Consistency.store.RecordReference_SkippingReference.skipReference(); cacheAccess.incAndGetCount(Org.Neo4j.Consistency.statistics.Counts_Type.noCacheSkip);
             }
             else
             {
                 referred = buildFromCache(relationship, reference, nodeId, records); if (referred == Org.Neo4j.Consistency.store.RecordReference_SkippingReference.skipReference <Org.Neo4j.Kernel.impl.store.record.RelationshipRecord>())
                 {
                     cacheAccess.incAndGetCount(Org.Neo4j.Consistency.statistics.Counts_Type.skipCheck);
                 }
             }
         }
         else
         {
             if (referenceShouldBeSkipped(relationship, reference, records))
             {
                 referred = Org.Neo4j.Consistency.store.RecordReference_SkippingReference.skipReference();
             }
         }
         engine.comparativeCheck(referred, this); if (referred != Org.Neo4j.Consistency.store.RecordReference_SkippingReference.skipReference <Org.Neo4j.Kernel.impl.store.record.RelationshipRecord>())
         {
             cacheAccess.incAndGetCount(Org.Neo4j.Consistency.statistics.Counts_Type.@checked); linkChecked(cacheAccess);
         }
     }
     else
     {
         cacheAccess.incAndGetCount(Org.Neo4j.Consistency.statistics.Counts_Type.@checked); linkChecked(cacheAccess);
     }
 }
Esempio n. 5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldTrackSecondaryUnitIdsAsWell() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldTrackSecondaryUnitIdsAsWell()
        {
            // GIVEN
            NeoStores neoStores = NeoStoresRule.builder().build();
            HighIdTransactionApplier tracker = new HighIdTransactionApplier(neoStores);

            NodeRecord node = (new NodeRecord(5)).initialize(true, 123, true, 456, 0);

            node.SecondaryUnitId       = 6;
            node.RequiresSecondaryUnit = true;

            RelationshipRecord relationship = (new RelationshipRecord(10)).initialize(true, 1, 2, 3, 4, 5, 6, 7, 8, true, true);

            relationship.SecondaryUnitId       = 12;
            relationship.RequiresSecondaryUnit = true;

            RelationshipGroupRecord relationshipGroup = (new RelationshipGroupRecord(8)).initialize(true, 0, 1, 2, 3, 4, 5);

            relationshipGroup.SecondaryUnitId       = 20;
            relationshipGroup.RequiresSecondaryUnit = true;

            // WHEN
            tracker.VisitNodeCommand(new NodeCommand(new NodeRecord(node.Id), node));
            tracker.VisitRelationshipCommand(new RelationshipCommand(new RelationshipRecord(relationship.Id), relationship));
            tracker.VisitRelationshipGroupCommand(new RelationshipGroupCommand(new RelationshipGroupRecord(relationshipGroup.Id), relationshipGroup));
            tracker.Close();

            // THEN
            assertEquals(node.SecondaryUnitId + 1, neoStores.NodeStore.HighId);
            assertEquals(relationship.SecondaryUnitId + 1, neoStores.RelationshipStore.HighId);
            assertEquals(relationshipGroup.SecondaryUnitId + 1, neoStores.RelationshipGroupStore.HighId);
        }
        protected internal override void LinkLoop(RelationshipRecord record)
        {
            long firstNextRel = Cache.getAndPutRelationship(record.FirstNode, record.Type, BOTH, record.Id, true);

            record.FirstNextRel  = firstNextRel;
            record.SecondNextRel = firstNextRel;
        }
Esempio n. 7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldDeleteIdGeneratorsWhenOpeningExistingStore() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldDeleteIdGeneratorsWhenOpeningExistingStore()
        {
            // given
            long expectedHighId;

            using (BatchingNeoStores stores = BatchingNeoStores.BatchingNeoStoresWithExternalPageCache(Storage.fileSystem(), Storage.pageCache(), PageCacheTracer.NULL, Storage.directory().absolutePath(), LATEST_RECORD_FORMATS, DEFAULT, NullLogService.Instance, EMPTY, Config.defaults()))
            {
                stores.CreateNew();
                RelationshipStore  relationshipStore = stores.RelationshipStore;
                RelationshipRecord record            = relationshipStore.NewRecord();
                long no = NULL_REFERENCE.longValue();
                record.Initialize(true, no, 1, 2, 0, no, no, no, no, true, true);
                record.Id      = relationshipStore.NextId();
                expectedHighId = relationshipStore.HighId;
                relationshipStore.UpdateRecord(record);
                // fiddle with the highId
                relationshipStore.HighId = record.Id + 999;
            }

            // when
            using (BatchingNeoStores stores = BatchingNeoStores.BatchingNeoStoresWithExternalPageCache(Storage.fileSystem(), Storage.pageCache(), PageCacheTracer.NULL, Storage.directory().absolutePath(), LATEST_RECORD_FORMATS, DEFAULT, NullLogService.Instance, EMPTY, Config.defaults()))
            {
                stores.PruneAndOpenExistingStore(Predicates.alwaysTrue(), Predicates.alwaysTrue());

                // then
                assertEquals(expectedHighId, stores.RelationshipStore.HighId);
            }
        }
Esempio n. 8
0
 private RelationshipRecord With(RelationshipRecord relationship, long startNode, long endNode, int type)
 {
     relationship.FirstNode  = startNode;
     relationship.SecondNode = endNode;
     relationship.Type       = type;
     return(relationship);
 }
Esempio n. 9
0
        private static RelationshipRecord Relationship(long id, long startNodeId, long endNodeId)
        {
            RelationshipRecord record = new RelationshipRecord(id);

            record.InUse      = true;
            record.FirstNode  = startNodeId;
            record.SecondNode = endNodeId;
            return(record);
        }
Esempio n. 10
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldReportDuplicatePropertyIndexesAcrossRecordsInPropertyChainForNode()
        internal virtual void ShouldReportDuplicatePropertyIndexesAcrossRecordsInPropertyChainForNode()
        {
            // given
            ChainCheck check = new ChainCheck();

            RecordAccessStub records = new RecordAccessStub();

            RelationshipRecord master = records.Add(inUse(new RelationshipRecord(1, 2, 3, 4)));

            master.NextProp = 1;

            PropertyRecord firstRecord = inUse(new PropertyRecord(1));

            firstRecord.NextProp = 12;

            PropertyBlock firstBlock = new PropertyBlock();

            firstBlock.SingleBlock = 1;
            firstBlock.KeyIndexId  = 1;

            PropertyBlock secondBlock = new PropertyBlock();

            secondBlock.SingleBlock = 1;
            secondBlock.KeyIndexId  = 2;

            PropertyRecord secondRecord = inUse(new PropertyRecord(12));

            secondRecord.PrevProp = 1;

            PropertyBlock thirdBlock = new PropertyBlock();

            thirdBlock.SingleBlock = 1;
            thirdBlock.KeyIndexId  = 4;

            PropertyBlock fourthBlock = new PropertyBlock();

            fourthBlock.SingleBlock = 1;
            fourthBlock.KeyIndexId  = 1;

            firstRecord.AddPropertyBlock(firstBlock);
            firstRecord.AddPropertyBlock(secondBlock);
            secondRecord.AddPropertyBlock(thirdBlock);
            secondRecord.AddPropertyBlock(fourthBlock);

            records.Add(firstRecord);
            records.Add(secondRecord);

            // when
            Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipConsistencyReport report = mock(typeof(Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipConsistencyReport));
            CheckerEngine <RelationshipRecord, Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipConsistencyReport> checkEngine = records.Engine(master, report);

            check.checkReference(master, firstRecord, checkEngine, records);
            records.CheckDeferred();

            // then
            verify(report).propertyKeyNotUniqueInChain();
        }
Esempio n. 11
0
 private bool ShouldChange(bool isDense, RelationshipRecord record)
 {
     if (!NodeType.matchesDense(_nodeTypes, isDense))
     {
         return(false);
     }
     // Here we have a special case where we want to filter on type, but only for dense nodes
     return(!(isDense && _filter != null && !_filter.test(record)));
 }
Esempio n. 12
0
        private RelationshipRecord Record(long startNode, int type, long endNode)
        {
            RelationshipRecord record = new RelationshipRecord(0);

            record.InUse      = true;
            record.FirstNode  = startNode;
            record.SecondNode = endNode;
            record.Type       = type;
            return(record);
        }
Esempio n. 13
0
 public void CheckConsistency(Org.Neo4j.Kernel.impl.store.record.RelationshipRecord record, CheckerEngine <Org.Neo4j.Kernel.impl.store.record.RelationshipRecord, Org.Neo4j.Consistency.report.ConsistencyReport_RelationshipConsistencyReport> engine, Org.Neo4j.Consistency.store.RecordAccess records)
 {
     if (record.Type < 0)
     {
         engine.Report().illegalRelationshipType();
     }
     else
     {
         engine.ComparativeCheck(records.RelationshipType(record.Type), this);
     }
 }
Esempio n. 14
0
        protected internal override void LinkEnd(RelationshipRecord record)
        {
            int  typeId        = record.Type;
            long secondPrevRel = Cache.getAndPutRelationship(record.SecondNode, typeId, Direction.INCOMING, record.Id, false);

            if (secondPrevRel == ID_NOT_FOUND)
            {               // First one
                record.FirstInSecondChain = true;
                secondPrevRel             = Cache.getCount(record.SecondNode, typeId, Direction.INCOMING);
            }
            record.SecondPrevRel = secondPrevRel;
        }
Esempio n. 15
0
        protected internal override void LinkStart(RelationshipRecord record)
        {
            int  typeId       = record.Type;
            long firstPrevRel = Cache.getAndPutRelationship(record.FirstNode, typeId, Direction.OUTGOING, record.Id, false);

            if (firstPrevRel == ID_NOT_FOUND)
            {               // First one
                record.FirstInFirstChain = true;
                firstPrevRel             = Cache.getCount(record.FirstNode, typeId, Direction.OUTGOING);
            }
            record.FirstPrevRel = firstPrevRel;
        }
        private static void BreakTheChain(RecordStore <RelationshipRecord> relationshipStore)
        {
            RelationshipRecord record          = relationshipStore.GetRecord(10, relationshipStore.NewRecord(), NORMAL);
            long relationshipTowardsEndOfChain = record.FirstNode;

            while (record.InUse() && !record.FirstInFirstChain)
            {
                record = relationshipStore.GetRecord(relationshipTowardsEndOfChain, relationshipStore.NewRecord(), FORCE);
                relationshipTowardsEndOfChain = record.FirstPrevRel;
            }

            relationshipStore.UpdateRecord(new RelationshipRecord(relationshipTowardsEndOfChain, 0, 0, 0));
        }
Esempio n. 17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void inUseRecordEquality()
        public virtual void InUseRecordEquality()
        {
            RelationshipRecord record1 = new RelationshipRecord(1);

            record1.Initialize(true, 1, 2, 3, 4, 5, 6, 7, 8, true, false);
            record1.SecondaryUnitId = 42;

            RelationshipRecord record2 = record1.Clone();

            RelationshipCheckType check = new RelationshipCheckType();

            assertTrue(check.Equal(record1, record2));
        }
Esempio n. 18
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;
 }
Esempio n. 19
0
        protected internal override void LinkLoop(RelationshipRecord record)
        {
            int  typeId  = record.Type;
            long prevRel = Cache.getAndPutRelationship(record.FirstNode, typeId, Direction.BOTH, record.Id, false);

            if (prevRel == ID_NOT_FOUND)
            {               // First one
                record.FirstInFirstChain  = true;
                record.FirstInSecondChain = true;
                prevRel = Cache.getCount(record.FirstNode, typeId, Direction.BOTH);
            }
            record.FirstPrevRel  = prevRel;
            record.SecondPrevRel = prevRel;
        }
Esempio n. 20
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private static void testRecordDistribution(QueueDistribution queueDistribution) throws InterruptedException
        private static void TestRecordDistribution(QueueDistribution queueDistribution)
        {
            ThreadLocalRandom randomGenerator = ThreadLocalRandom.current();
            int numberOfThreads = randomGenerator.Next(MAX_NUMBER_OF_THREADS);
            int recordsPerCpu   = randomGenerator.Next(int.MaxValue);
            QueueDistribution_QueueDistributor <RelationshipRecord> distributor = queueDistribution.Distributor(recordsPerCpu, numberOfThreads);

            for (int iteration = 0; iteration <= NUMBER_OF_DISTRIBUTION_ITERATIONS; iteration++)
            {
                RelationshipRecord relationshipRecord = new RelationshipRecord(1);
                relationshipRecord.FirstNode  = NextLong(randomGenerator);
                relationshipRecord.SecondNode = NextLong(randomGenerator);
                distributor.Distribute(relationshipRecord, (record, qIndex) => assertThat("Distribution index for record " + record + " should be within a range of available " + "executors, while expected records per cpu is: " + recordsPerCpu, qIndex, allOf(greaterThanOrEqualTo(0), lessThan(numberOfThreads))));
            }
        }
Esempio n. 21
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void notInUseRecordEquality()
        public virtual void NotInUseRecordEquality()
        {
            RelationshipRecord record1 = new RelationshipRecord(1);

            record1.Initialize(false, 1, 2, 3, 4, 5, 6, 7, 8, true, false);
            record1.SecondaryUnitId = 42;

            RelationshipRecord record2 = new RelationshipRecord(1);

            record2.Initialize(false, 11, 22, 33, 44, 55, 66, 77, 88, false, true);
            record2.SecondaryUnitId = 24;

            RelationshipCheckType check = new RelationshipCheckType();

            assertTrue(check.Equal(record1, record2));
        }
Esempio n. 22
0
        private RecordSet <RelationshipRecord> ExpandChain(RelationshipRecord record, long nodeId, RelationshipChainDirection direction)
        {
            RecordSet <RelationshipRecord> chain = new RecordSet <RelationshipRecord>();

            chain.Add(record);
            RelationshipRecord currentRecord = record;
            long nextRelId = direction.fieldFor(nodeId, currentRecord).relOf(currentRecord);

            while (currentRecord.InUse() && !direction.fieldFor(nodeId, currentRecord).endOfChain(currentRecord))
            {
                currentRecord = _recordStore.getRecord(nextRelId, _recordStore.newRecord(), FORCE);
                chain.Add(currentRecord);
                nextRelId = direction.fieldFor(nodeId, currentRecord).relOf(currentRecord);
            }
            return(chain);
        }
Esempio n. 23
0
 internal virtual void PrintRelChain(StoreAccess access, PrintStream @out, long firstRelId)
 {
     for (long rel = firstRelId; rel != Record.NO_NEXT_RELATIONSHIP.intValue();)
     {
         RecordStore <RelationshipRecord> relationshipStore = access.RelationshipStore;
         RelationshipRecord record = relationshipStore.GetRecord(rel, relationshipStore.NewRecord(), NORMAL);
         @out.println(rel + "\t" + record);
         if (record.FirstNode == Id)
         {
             rel = record.FirstNextRel;
         }
         else
         {
             rel = record.SecondNextRel;
         }
     }
 }
 public override void CheckReference(RECORD record, RelationshipRecord relationshipRecord, CheckerEngine <RECORD, REPORT> engine, RecordAccess records)
 {
     if (relationshipRecord.InUse())
     {
         // Relationship indexes are always semantically multi-token, which means that the relationship record just need to have one of the possible
         // relationship types mentioned by the index. Relationships can't have more than one type anyway.
         long type = relationshipRecord.Type;
         if (Arrays.binarySearch(_indexRelationshipTypes, type) < 0)
         {
             // The relationship did not have any of the relationship types mentioned by the index.
             foreach (long indexRelationshipType in _indexRelationshipTypes)
             {
                 engine.Report().relationshipDoesNotHaveExpectedRelationshipType(relationshipRecord, indexRelationshipType);
             }
         }
     }
     else
     {
         engine.Report().relationshipNotInUse(relationshipRecord);
     }
 }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldReadRelationshipCommand() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldReadRelationshipCommand()
        {
            // Given
            InMemoryClosableChannel channel = new InMemoryClosableChannel();
            RelationshipRecord      before  = new RelationshipRecord(42, -1, -1, -1);
            RelationshipRecord      after   = new RelationshipRecord(42, true, 1, 2, 3, 4, 5, 6, 7, true, true);

            (new Command.RelationshipCommand(before, after)).Serialize(channel);

            // When
            PhysicalLogCommandReaderV3_0 reader = new PhysicalLogCommandReaderV3_0();
            Command command = reader.Read(channel);

            assertTrue(command is Command.RelationshipCommand);

            Command.RelationshipCommand relationshipCommand = (Command.RelationshipCommand)command;

            // Then
            assertEquals(before, relationshipCommand.Before);
            assertEquals(after, relationshipCommand.After);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void readRelationshipCommandWithNonRequiredSecondaryUnit() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ReadRelationshipCommandWithNonRequiredSecondaryUnit()
        {
            InMemoryClosableChannel channel = new InMemoryClosableChannel();
            RelationshipRecord      before  = new RelationshipRecord(42, true, 1, 2, 3, 4, 5, 6, 7, true, true);

            before.RequiresSecondaryUnit = false;
            before.SecondaryUnitId       = 52;
            RelationshipRecord after = new RelationshipRecord(42, true, 1, 8, 3, 4, 5, 6, 7, true, true);

            (new Command.RelationshipCommand(before, after)).Serialize(channel);

            PhysicalLogCommandReaderV3_0 reader = new PhysicalLogCommandReaderV3_0();
            Command command = reader.Read(channel);

            assertTrue(command is Command.RelationshipCommand);

            Command.RelationshipCommand relationshipCommand = (Command.RelationshipCommand)command;
            assertEquals(before, relationshipCommand.Before);
            VerifySecondaryUnit(before, relationshipCommand.Before);
            assertEquals(after, relationshipCommand.After);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void readRelationshipCommandWithFixedReferenceFormat302() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ReadRelationshipCommandWithFixedReferenceFormat302()
        {
            InMemoryClosableChannel channel = new InMemoryClosableChannel();
            RelationshipRecord      before  = new RelationshipRecord(42, true, 1, 2, 3, 4, 5, 6, 7, true, true);

            before.UseFixedReferences = true;
            RelationshipRecord after = new RelationshipRecord(42, true, 1, 8, 3, 4, 5, 6, 7, true, true);

            after.UseFixedReferences = true;
            (new Command.RelationshipCommand(before, after)).Serialize(channel);

            PhysicalLogCommandReaderV3_0_2 reader = new PhysicalLogCommandReaderV3_0_2();
            Command command = reader.Read(channel);

            assertTrue(command is Command.RelationshipCommand);

            Command.RelationshipCommand relationshipCommand = (Command.RelationshipCommand)command;
            assertEquals(before, relationshipCommand.Before);
            assertTrue(relationshipCommand.Before.UseFixedReferences);
            assertEquals(after, relationshipCommand.After);
            assertTrue(relationshipCommand.After.UseFixedReferences);
        }
Esempio n. 28
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldDistributeRelationshipRecordsByNodeId() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void ShouldDistributeRelationshipRecordsByNodeId()
        {
            // GIVEN
            QueueDistribution_QueueDistributor <RelationshipRecord> distributor = new QueueDistribution_RelationshipNodesQueueDistributor(5, 100);
            RecordConsumer <RelationshipRecord> consumer = mock(typeof(RecordConsumer));

            // WHEN/THEN
            RelationshipRecord relationship = relationship(0, 0, 1);

            distributor.Distribute(relationship, consumer);
            verify(consumer, times(1)).accept(relationship, 0);

            relationship = relationship(1, 0, 7);
            distributor.Distribute(relationship, consumer);
            verify(consumer, times(1)).accept(relationship, 0);
            verify(consumer, times(1)).accept(relationship, 1);

            relationship = relationship(3, 26, 11);
            distributor.Distribute(relationship, consumer);
            verify(consumer, times(1)).accept(relationship, 5);
            verify(consumer, times(1)).accept(relationship, 2);
        }
Esempio n. 29
0
 internal Org.Neo4j.Consistency.store.RecordReference <Org.Neo4j.Kernel.impl.store.record.RelationshipRecord> buildFromCache(Org.Neo4j.Kernel.impl.store.record.RelationshipRecord relationship, long reference, long nodeId, Org.Neo4j.Consistency.store.RecordAccess records)
 {
     Org.Neo4j.Consistency.checking.cache.CacheAccess_Client cacheAccess = records.cacheAccess().client(); if (!cacheAccess.withinBounds(nodeId))
     {
         cacheAccess.incAndGetCount(Org.Neo4j.Consistency.statistics.Counts_Type.correctSkipCheck); return(Org.Neo4j.Consistency.store.RecordReference_SkippingReference.skipReference());
     }
     if (reference != cacheAccess.getFromCache(nodeId, SLOT_RELATIONSHIP_ID))
     {
         if (referenceShouldBeSkipped(relationship, reference, records))
         {
             cacheAccess.incAndGetCount(Org.Neo4j.Consistency.statistics.Counts_Type.correctSkipCheck); return(Org.Neo4j.Consistency.store.RecordReference_SkippingReference.skipReference());
         }
         cacheAccess.incAndGetCount(Org.Neo4j.Consistency.statistics.Counts_Type.missCheck); return(records.relationship(reference));
     }
     Org.Neo4j.Kernel.impl.store.record.RelationshipRecord rel = new Org.Neo4j.Kernel.impl.store.record.RelationshipRecord(reference); rel.setCreated(); if (cacheAccess.getFromCache(nodeId, SLOT_SOURCE_OR_TARGET) == SOURCE)
     {
         rel.setFirstNode(nodeId);
     }
     else
     {
         rel.setSecondNode(nodeId);
     } rel = populateRelationshipFromCache(nodeId, rel, cacheAccess); return(new Org.Neo4j.Consistency.store.DirectRecordReference <>(rel, records));
 }
Esempio n. 30
0
 internal abstract long compareNode(Org.Neo4j.Kernel.impl.store.record.RelationshipRecord rel);