Search in sources :

Example 6 with PropertyRecord

use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.

the class PendingReferenceCheckTest method shouldNotAllowCheckReferenceAfterCheckDiffReference.

@Test
public void shouldNotAllowCheckReferenceAfterCheckDiffReference() throws Exception {
    // given
    referenceCheck.checkDiffReference(new PropertyRecord(0), new PropertyRecord(0), null);
    // when
    try {
        referenceCheck.checkReference(new PropertyRecord(0), null);
        fail("expected exception");
    }// then
     catch (IllegalStateException expected) {
        assertEquals("Reference has already been checked.", expected.getMessage());
    }
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) Test(org.junit.Test)

Example 7 with PropertyRecord

use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.

the class RecordAccessStub method rawPropertyChain.

@Override
public Iterator<PropertyRecord> rawPropertyChain(final long firstId) {
    return new PrefetchingIterator<PropertyRecord>() {

        private long next = firstId;

        @Override
        protected PropertyRecord fetchNextOrNull() {
            if (Record.NO_NEXT_PROPERTY.is(next)) {
                return null;
            }
            PropertyRecord record = reference(properties, next, Version.LATEST).record();
            next = record.getNextProp();
            return record;
        }
    };
}
Also used : PrefetchingIterator(org.neo4j.helpers.collection.PrefetchingIterator) PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord)

Example 8 with PropertyRecord

use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.

the class DuplicatePropertyRemoverTest method hasLoop.

private boolean hasLoop(long firstId) {
    PropertyRecord slow = propertyStore.newRecord(), fast = propertyStore.newRecord(), first = propertyStore.newRecord();
    if (firstId == Record.NO_NEXT_PROPERTY.intValue()) {
        return false;
    }
    propertyStore.getRecord(firstId, first, NORMAL);
    slow = fast = first;
    while (true) {
        // if the fast pointer ever catch up with slow, it indicates a loop.
        slow = getNextPropertyRecord(slow);
        PropertyRecord nextFast = getNextPropertyRecord(fast);
        if (nextFast != null) {
            fast = getNextPropertyRecord(nextFast);
        } else {
            return false;
        }
        if (slow == null || fast == null) {
            return false;
        }
        if (slow.getId() == fast.getId()) {
            return true;
        }
    }
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord)

Example 9 with PropertyRecord

use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.

the class IndexConsultedPropertyBlockSweeperTest method shouldFixThePropertyChainAfterAllTheBlocksInRecordAreRemoved.

@Test
public void shouldFixThePropertyChainAfterAllTheBlocksInRecordAreRemoved() throws IOException {
    int propertyKeyId = propertyKeys.get(indexedPropKey);
    PropertyRecord propertyRecord = getRecord(propertyStore, propertyId);
    for (PropertyBlock propertyBlock : propertyRecord) {
        long[] valueBlocks = propertyBlock.getValueBlocks();
        // Change the value to something non-indexed!
        valueBlocks[1] += 2;
        propertyBlock.setKeyIndexId(propertyKeyId);
    }
    propertyStore.updateRecord(propertyRecord);
    sweeper = new IndexConsultedPropertyBlockSweeper(propertyKeyId, indexMock, nodeRecord, propertyStore, propertyRemoverMock);
    assertFalse(sweeper.visited(propertyId));
    // The property record was emptied of property blocks, so the chain must be fixed
    verify(propertyRemoverMock).fixUpPropertyLinksAroundUnusedRecord(nodeRecord, propertyRecord);
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) PropertyBlock(org.neo4j.kernel.impl.store.record.PropertyBlock) Test(org.junit.Test)

Example 10 with PropertyRecord

use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.

the class NonIndexedConflictResolverTest method collectPropertyKeyIds.

private Set<Integer> collectPropertyKeyIds(long propertyId) {
    Set<Integer> result = new HashSet<>();
    PropertyRecord record = propertyStore.newRecord();
    while (propertyId != Record.NO_NEXT_PROPERTY.intValue()) {
        propertyStore.getRecord(propertyId, record, FORCE);
        for (PropertyBlock propertyBlock : record) {
            int propertyKeyId = propertyBlock.getKeyIndexId();
            assertTrue(result.add(propertyKeyId));
        }
        propertyId = record.getNextProp();
    }
    return result;
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) PropertyBlock(org.neo4j.kernel.impl.store.record.PropertyBlock) HashSet(java.util.HashSet)

Aggregations

PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)230 PropertyBlock (org.neo4j.kernel.impl.store.record.PropertyBlock)86 Test (org.junit.Test)75 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)37 Test (org.junit.jupiter.api.Test)36 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)35 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)28 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)19 ArrayList (java.util.ArrayList)17 Value (org.neo4j.values.storable.Value)17 PrimitiveRecord (org.neo4j.kernel.impl.store.record.PrimitiveRecord)14 PropertyKeyTokenRecord (org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord)14 RecordAccessStub (org.neo4j.consistency.store.RecordAccessStub)12 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)10 PropertyStore (org.neo4j.kernel.impl.store.PropertyStore)9 IOException (java.io.IOException)8 InterruptedIOException (java.io.InterruptedIOException)8 Pair (org.neo4j.helpers.collection.Pair)8 DefinedProperty (org.neo4j.kernel.api.properties.DefinedProperty)8 NodeStore (org.neo4j.kernel.impl.store.NodeStore)8