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