use of org.neo4j.kernel.impl.store.record.PropertyBlock 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.PropertyBlock 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;
}
use of org.neo4j.kernel.impl.store.record.PropertyBlock in project neo4j by neo4j.
the class DuplicatePropertyTest method shouldReportDuplicatePropertyIndexesInPropertyRecordForNode.
@Test
public void shouldReportDuplicatePropertyIndexesInPropertyRecordForNode() throws Exception {
// given
ChainCheck check = new ChainCheck();
RecordAccessStub records = new RecordAccessStub();
NodeRecord master = records.add(inUse(new NodeRecord(1, false, -1, 1)));
PropertyRecord propertyRecord = inUse(new PropertyRecord(1));
PropertyBlock firstBlock = new PropertyBlock();
firstBlock.setSingleBlock(1);
firstBlock.setKeyIndexId(1);
PropertyBlock secondBlock = new PropertyBlock();
secondBlock.setSingleBlock(1);
secondBlock.setKeyIndexId(2);
PropertyBlock thirdBlock = new PropertyBlock();
thirdBlock.setSingleBlock(1);
thirdBlock.setKeyIndexId(1);
propertyRecord.addPropertyBlock(firstBlock);
propertyRecord.addPropertyBlock(secondBlock);
propertyRecord.addPropertyBlock(thirdBlock);
records.add(propertyRecord);
// when
ConsistencyReport.NodeConsistencyReport report = mock(ConsistencyReport.NodeConsistencyReport.class);
CheckerEngine<NodeRecord, ConsistencyReport.NodeConsistencyReport> checkEngine = records.engine(master, report);
check.checkReference(master, propertyRecord, checkEngine, records);
// then
verify(report).propertyKeyNotUniqueInChain();
}
use of org.neo4j.kernel.impl.store.record.PropertyBlock in project neo4j by neo4j.
the class CheckTxLogsTest method propertyRecord.
private static PropertyRecord propertyRecord(long id, boolean inUse, long prevProp, long nextProp, long... blocks) {
PropertyRecord record = new PropertyRecord(id);
record.setInUse(inUse);
record.setPrevProp(prevProp);
record.setNextProp(nextProp);
for (int i = 0; i < blocks.length; i++) {
long blockValue = blocks[i];
PropertyBlock block = new PropertyBlock();
long value = PropertyStore.singleBlockLongValue(i, PropertyType.INT, blockValue);
block.setSingleBlock(value);
record.addPropertyBlock(block);
}
return record;
}
use of org.neo4j.kernel.impl.store.record.PropertyBlock in project neo4j by neo4j.
the class PropertyRecordCheckTest method shouldReportPropertyKeyNotInUse.
@Test
public void shouldReportPropertyKeyNotInUse() throws Exception {
// given
PropertyRecord property = inUse(new PropertyRecord(42));
PropertyKeyTokenRecord key = add(notInUse(new PropertyKeyTokenRecord(0)));
PropertyBlock block = propertyBlock(key, PropertyType.INT, 0);
property.addPropertyBlock(block);
// when
ConsistencyReport.PropertyConsistencyReport report = check(property);
// then
verify(report).keyNotInUse(block, key);
verifyNoMoreInteractions(report);
}
Aggregations