private void convertNodeToDenseIfNecessary( NodeRecord node, RecordAccess<Long, RelationshipRecord, Void> relRecords, RecordAccess<Long, RelationshipGroupRecord, Integer> relGroupRecords) { if (node.isDense()) { return; } long relId = node.getNextRel(); if (relId != Record.NO_NEXT_RELATIONSHIP.intValue()) { RecordProxy<Long, RelationshipRecord, Void> relChange = relRecords.getOrLoad(relId, null); RelationshipRecord rel = relChange.forReadingLinkage(); if (RelationshipCounter.relCount(node.getId(), rel) >= neoStore.getDenseNodeThreshold()) { convertNodeToDenseNode(node, relChange.forChangingLinkage(), relRecords, relGroupRecords); } } }
public RecordProxy<Long, RelationshipGroupRecord, Integer> getRelationshipGroup( NodeRecord node, int type) { long groupId = node.getNextRel(); long previousGroupId = Record.NO_NEXT_RELATIONSHIP.intValue(); Set<Integer> allTypes = new HashSet<>(); while (groupId != Record.NO_NEXT_RELATIONSHIP.intValue()) { RecordProxy<Long, RelationshipGroupRecord, Integer> change = recordChangeSet.getRelGroupRecords().getOrLoad(groupId, type); RelationshipGroupRecord record = change.forReadingData(); record.setPrev(previousGroupId); // not persistent so not a "change" allTypes.add(record.getType()); if (record.getType() == type) { return change; } previousGroupId = groupId; groupId = record.getNext(); } return null; }
public void updateFirstRelationships() { for (RecordProxy<Long, NodeRecord, Void> change : recordChangeSet.getNodeRecords().changes()) { NodeRecord record = change.forReadingLinkage(); txState.setFirstIds(record.getId(), record.getNextRel(), record.getNextProp()); } }