Search in sources :

Example 76 with PropertyRecord

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;
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord)

Example 77 with PropertyRecord

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());
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) RepeatedTest(org.junit.jupiter.api.RepeatedTest)

Example 78 with PropertyRecord

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));
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) Test(org.junit.jupiter.api.Test)

Example 79 with PropertyRecord

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());
}
Also used : StandardDynamicRecordAllocator(org.neo4j.kernel.impl.store.StandardDynamicRecordAllocator) DynamicRecordAllocator(org.neo4j.kernel.impl.store.DynamicRecordAllocator) PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) Value(org.neo4j.values.storable.Value) PropertyBlock(org.neo4j.kernel.impl.store.record.PropertyBlock) ArrayList(java.util.ArrayList)

Example 80 with PropertyRecord

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);
}
Also used : PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) SchemaStore(org.neo4j.kernel.impl.store.SchemaStore) SchemaRecord(org.neo4j.kernel.impl.store.record.SchemaRecord) IndexingService(org.neo4j.kernel.impl.api.index.IndexingService) PropertyBlock(org.neo4j.kernel.impl.store.record.PropertyBlock) ConsistencyCheckService(org.neo4j.consistency.ConsistencyCheckService) PropertyStore(org.neo4j.kernel.impl.store.PropertyStore) Test(org.junit.jupiter.api.Test)

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