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());
}
}
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;
}
};
}
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;
}
}
}
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);
}
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;
}
Aggregations