Search in sources :

Example 1 with LabelChainWalker

use of org.neo4j.consistency.checking.LabelChainWalker in project neo4j by neo4j.

the class NodeInUseWithCorrectLabelsCheck method checkReference.

@Override
public void checkReference(RECORD record, NodeRecord nodeRecord, CheckerEngine<RECORD, REPORT> engine, RecordAccess records) {
    if (nodeRecord.inUse()) {
        NodeLabels nodeLabels = NodeLabelsField.parseLabelsField(nodeRecord);
        if (nodeLabels instanceof DynamicNodeLabels) {
            DynamicNodeLabels dynamicNodeLabels = (DynamicNodeLabels) nodeLabels;
            long firstRecordId = dynamicNodeLabels.getFirstDynamicRecordId();
            RecordReference<DynamicRecord> firstRecordReference = records.nodeLabels(firstRecordId);
            ExpectedNodeLabelsChecker expectedNodeLabelsChecker = new ExpectedNodeLabelsChecker(nodeRecord);
            LabelChainWalker<RECORD, REPORT> checker = new LabelChainWalker<>(expectedNodeLabelsChecker);
            engine.comparativeCheck(firstRecordReference, checker);
            // I think this is empty in production
            nodeRecord.getDynamicLabelRecords();
        } else {
            long[] storeLabels = nodeLabels.get(null);
            REPORT report = engine.report();
            validateLabelIds(nodeRecord, storeLabels, report);
        }
    } else {
        engine.report().nodeNotInUse(nodeRecord);
    }
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) LabelChainWalker(org.neo4j.consistency.checking.LabelChainWalker) DynamicNodeLabels(org.neo4j.kernel.impl.store.DynamicNodeLabels) DynamicNodeLabels(org.neo4j.kernel.impl.store.DynamicNodeLabels) NodeLabels(org.neo4j.kernel.impl.store.NodeLabels)

Aggregations

LabelChainWalker (org.neo4j.consistency.checking.LabelChainWalker)1 DynamicNodeLabels (org.neo4j.kernel.impl.store.DynamicNodeLabels)1 NodeLabels (org.neo4j.kernel.impl.store.NodeLabels)1 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)1