use of org.neo4j.internal.schema.PropertySchemaType in project neo4j by neo4j.
the class SchemaStore method buildSchemaDescriptor.
private static SchemaDescriptor buildSchemaDescriptor(Map<String, Value> props) throws MalformedSchemaRuleException {
EntityType entityType = getEntityType(getString(PROP_SCHEMA_DESCRIPTOR_ENTITY_TYPE, props));
PropertySchemaType propertySchemaType = getPropertySchemaType(getString(PROP_SCHEMA_DESCRIPTOR_PROPERTY_SCHEMA_TYPE, props));
int[] entityIds = getIntArray(PROP_SCHEMA_DESCRIPTOR_ENTITY_IDS, props);
int[] propertyIds = getIntArray(PROP_SCHEMA_DESCRIPTOR_PROPERTY_IDS, props);
return new SchemaDescriptorImplementation(entityType, propertySchemaType, entityIds, propertyIds);
}
use of org.neo4j.internal.schema.PropertySchemaType in project neo4j by neo4j.
the class SchemaStore method schemaDescriptorToMap.
private static void schemaDescriptorToMap(SchemaDescriptor schemaDescriptor, Map<String, Value> map) {
EntityType entityType = schemaDescriptor.entityType();
PropertySchemaType propertySchemaType = schemaDescriptor.propertySchemaType();
int[] entityTokenIds = schemaDescriptor.getEntityTokenIds();
int[] propertyIds = schemaDescriptor.getPropertyIds();
putStringProperty(map, PROP_SCHEMA_DESCRIPTOR_ENTITY_TYPE, entityType.name());
putStringProperty(map, PROP_SCHEMA_DESCRIPTOR_PROPERTY_SCHEMA_TYPE, propertySchemaType.name());
putIntArrayProperty(map, PROP_SCHEMA_DESCRIPTOR_ENTITY_IDS, entityTokenIds);
putIntArrayProperty(map, PROP_SCHEMA_DESCRIPTOR_PROPERTY_IDS, propertyIds);
}
use of org.neo4j.internal.schema.PropertySchemaType in project neo4j by neo4j.
the class NodeChecker method checkIndexVsNodes.
private void checkIndexVsNodes(LongRange range, IndexDescriptor descriptor, boolean lastRange) throws Exception {
CacheAccess.Client client = context.cacheAccess.client();
IndexAccessor accessor = context.indexAccessors.accessorFor(descriptor);
RelationshipCounter.NodeLabelsLookup nodeLabelsLookup = observedCounts.nodeLabelsLookup();
SchemaDescriptor schema = descriptor.schema();
PropertySchemaType propertySchemaType = schema.propertySchemaType();
long[] indexEntityTokenIds = toLongArray(schema.getEntityTokenIds());
indexEntityTokenIds = sortAndDeduplicate(indexEntityTokenIds);
try (var cursorContext = new CursorContext(context.pageCacheTracer.createPageCursorTracer(NODE_INDEXES_CHECKER_TAG));
var allEntriesReader = accessor.newAllEntriesValueReader(range.from(), lastRange ? Long.MAX_VALUE : range.to(), cursorContext)) {
for (long entityId : allEntriesReader) {
try {
boolean entityExists = client.getBooleanFromCache(entityId, CacheSlots.NodeLink.SLOT_IN_USE);
if (!entityExists) {
reporter.forIndexEntry(new IndexEntry(descriptor, context.tokenNameLookup, entityId)).nodeNotInUse(recordLoader.node(entityId, cursorContext));
} else {
long[] entityTokenIds = nodeLabelsLookup.nodeLabels(entityId);
compareTwoSortedLongArrays(propertySchemaType, entityTokenIds, indexEntityTokenIds, indexLabel -> reporter.forIndexEntry(new IndexEntry(descriptor, context.tokenNameLookup, entityId)).nodeDoesNotHaveExpectedLabel(recordLoader.node(entityId, cursorContext), indexLabel), storeLabel -> {
/*here we're only interested in what the the index has that the store doesn't have*/
});
}
} catch (ArrayIndexOutOfBoundsException e) {
// OK so apparently the index has a node way outside node highId
reporter.forIndexEntry(new IndexEntry(descriptor, context.tokenNameLookup, entityId)).nodeNotInUse(recordLoader.node(entityId, cursorContext));
}
}
}
}
Aggregations