use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class BatchInsertTest method mustSplitUpRelationshipChainsWhenCreatingDenseNodes.
@Test
public void mustSplitUpRelationshipChainsWhenCreatingDenseNodes() throws Exception {
BatchInserter inserter = globalInserter;
long node1 = inserter.createNode(null);
long node2 = inserter.createNode(null);
for (int i = 0; i < 1000; i++) {
for (MyRelTypes relType : MyRelTypes.values()) {
inserter.createRelationship(node1, node2, relType, null);
}
}
NeoStores neoStores = getFlushedNeoStores(inserter);
NodeRecord record = getRecord(neoStores.getNodeStore(), node1);
assertTrue("Node " + record + " should have been dense", record.isDense());
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_0 method visitNodeCommand.
private Command visitNodeCommand(ReadableChannel channel) throws IOException {
long id = channel.getLong();
NodeRecord before = readNodeRecord(id, channel);
if (before == null) {
return null;
}
NodeRecord after = readNodeRecord(id, channel);
if (after == null) {
return null;
}
if (!before.inUse() && after.inUse()) {
after.setCreated();
}
return new Command.NodeCommand(before, after);
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class PhysicalLogCommandReaderV2_1 method visitNodeCommand.
private Command visitNodeCommand(ReadableChannel channel) throws IOException {
long id = channel.getLong();
NodeRecord before = readNodeRecord(id, channel);
if (before == null) {
return null;
}
NodeRecord after = readNodeRecord(id, channel);
if (after == null) {
return null;
}
if (!before.inUse() && after.inUse()) {
after.setCreated();
}
return new Command.NodeCommand(before, after);
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class ReadRecordsStepTest method reservedIdIsSkipped.
@Test
public void reservedIdIsSkipped() {
long highId = 5;
int batchSize = (int) highId;
org.neo4j.unsafe.impl.batchimport.Configuration config = withBatchSize(DEFAULT, batchSize);
NodeStore store = StoreWithReservedId.newNodeStoreMock(highId);
when(store.getHighId()).thenReturn(highId);
when(store.getRecordsPerPage()).thenReturn(10);
ReadRecordsStep<NodeRecord> step = new ReadRecordsStep<>(mock(StageControl.class), config, store, allIn(store, config));
step.start(0);
Object batch = step.nextBatchOrNull(0, batchSize);
assertNotNull(batch);
NodeRecord[] records = (NodeRecord[]) batch;
boolean hasRecordWithReservedId = Stream.of(records).anyMatch(recordWithReservedId());
assertFalse("Batch contains record with reserved id " + Arrays.toString(records), hasRecordWithReservedId);
}
use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.
the class MultipleIndexPopulatorUpdatesTest method getNodeRecord.
private NodeRecord getNodeRecord() {
NodeRecord nodeRecord = new NodeRecord(1L);
nodeRecord.initialize(true, 0, false, 1, 0x0000000001L);
InlineNodeLabels.putSorted(nodeRecord, new long[] { 1 }, null, null);
return nodeRecord;
}
Aggregations