use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.
the class PropertyStoreConsistentReadTest method getHeavy.
@Override
protected PropertyRecord getHeavy(PropertyStore store, long id) {
PropertyRecord record = super.getHeavy(store, id);
ensureHeavy(store, record);
return record;
}
use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.
the class AbstractRecordCloningTest method plainPropertyClone.
@RepeatedTest(1000)
void plainPropertyClone() {
PropertyRecord propertyRecord = getPropertyRecord();
keys.property().assertRecordsEquals(propertyRecord, propertyRecord.copy());
}
use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.
the class PropertyRecordTest method addLoadedBlockFailsWhenTooManyBlocksAdded.
@Test
void addLoadedBlockFailsWhenTooManyBlocksAdded() {
PropertyRecord record = new PropertyRecord(42);
addBlock(record, 1, 2);
addBlock(record, 3, 4);
addBlock(record, 5, 6);
addBlock(record, 7, 8);
assertThrows(AssertionError.class, () -> addBlock(record, 9, 10));
}
use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.
the class FullCheckIntegrationTest method serializeRule.
private void serializeRule(SchemaRule rule, SchemaRecord schemaRecord, TransactionDataBuilder tx, IdGenerator next) throws KernelException {
IntObjectMap<Value> protoProperties = SchemaStore.convertSchemaRuleToMap(rule, tx.tokenHolders());
Collection<PropertyBlock> blocks = new ArrayList<>();
DynamicRecordAllocator stringAllocator = null;
DynamicRecordAllocator arrayAllocator = null;
protoProperties.forEachKeyValue((keyId, value) -> {
PropertyBlock block = new PropertyBlock();
PropertyStore.encodeValue(block, keyId, value, stringAllocator, arrayAllocator, true, NULL, INSTANCE);
blocks.add(block);
});
long nextPropId = Record.NO_NEXT_PROPERTY.longValue();
PropertyRecord currRecord = newInitialisedPropertyRecord(next, rule);
for (PropertyBlock block : blocks) {
if (!currRecord.hasSpaceFor(block)) {
PropertyRecord nextRecord = newInitialisedPropertyRecord(next, rule);
linkAndWritePropertyRecord(currRecord, nextRecord.getId(), nextPropId, tx);
nextPropId = currRecord.getId();
currRecord = nextRecord;
}
currRecord.addPropertyBlock(block);
}
linkAndWritePropertyRecord(currRecord, Record.NO_PREVIOUS_PROPERTY.longValue(), nextPropId, tx);
nextPropId = currRecord.getId();
schemaRecord.initialize(true, nextPropId);
schemaRecord.setId(rule.getId());
}
use of org.neo4j.kernel.impl.store.record.PropertyRecord in project neo4j by neo4j.
the class DetectRandomSabotageIT method shouldDetectIndexConfigCorruption.
/* Failures/bugs found by the random sabotage are fixed and tested below, if they don't fit into any other FullCheck IT*/
// From Seed 1608234007554L
@Test
void shouldDetectIndexConfigCorruption() throws Exception {
// Given
SchemaStore schemaStore = neoStores.getSchemaStore();
long indexId = resolver.resolveDependency(IndexingService.class).getIndexIds().longIterator().next();
SchemaRecord schemaRecord = schemaStore.getRecord(indexId, schemaStore.newRecord(), RecordLoad.FORCE, NULL);
PropertyStore propertyStore = schemaStore.propertyStore();
PropertyRecord indexConfigPropertyRecord = propertyStore.getRecord(schemaRecord.getNextProp(), propertyStore.newRecord(), RecordLoad.FORCE, NULL);
propertyStore.ensureHeavy(indexConfigPropertyRecord, NULL);
// When
int[] tokenId = new int[1];
resolver.resolveDependency(TokenHolders.class).propertyKeyTokens().getOrCreateInternalIds(new String[] { "foo" }, tokenId);
PropertyBlock block = indexConfigPropertyRecord.iterator().next();
indexConfigPropertyRecord.removePropertyBlock(block.getKeyIndexId());
PropertyBlock newBlock = new PropertyBlock();
propertyStore.encodeValue(newBlock, tokenId[0], intValue(11), NULL, INSTANCE);
indexConfigPropertyRecord.addPropertyBlock(newBlock);
propertyStore.updateRecord(indexConfigPropertyRecord, NULL);
// then
ConsistencyCheckService.Result result = shutDownAndRunConsistencyChecker();
boolean hasSomeErrorOrWarning = result.summary().getTotalInconsistencyCount() > 0 || result.summary().getTotalWarningCount() > 0;
assertTrue(hasSomeErrorOrWarning);
}
Aggregations