Search in sources :

Example 61 with NodeRecord

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());
}
Also used : BatchInserter(org.neo4j.unsafe.batchinsert.BatchInserter) NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) MyRelTypes(org.neo4j.kernel.impl.MyRelTypes) NeoStores(org.neo4j.kernel.impl.store.NeoStores) Test(org.junit.Test)

Example 62 with NodeRecord

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);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord)

Example 63 with NodeRecord

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);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord)

Example 64 with NodeRecord

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);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) NodeStore(org.neo4j.kernel.impl.store.NodeStore) Test(org.junit.Test)

Example 65 with NodeRecord

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;
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord)

Aggregations

NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)391 Test (org.junit.Test)154 Test (org.junit.jupiter.api.Test)108 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)73 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)63 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)58 NodeLabels (org.neo4j.kernel.impl.store.NodeLabels)46 RelationshipGroupRecord (org.neo4j.kernel.impl.store.record.RelationshipGroupRecord)42 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)40 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)40 DynamicNodeLabels (org.neo4j.kernel.impl.store.DynamicNodeLabels)38 ConsistencySummaryStatistics (org.neo4j.consistency.report.ConsistencySummaryStatistics)32 ArrayList (java.util.ArrayList)30 GraphStoreFixture (org.neo4j.consistency.checking.GraphStoreFixture)30 IdGenerator (org.neo4j.consistency.checking.GraphStoreFixture.IdGenerator)30 TransactionDataBuilder (org.neo4j.consistency.checking.GraphStoreFixture.TransactionDataBuilder)30 RelationshipTypeTokenRecord (org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)30 NodeStore (org.neo4j.kernel.impl.store.NodeStore)28 Command (org.neo4j.kernel.impl.transaction.command.Command)27 PropertyBlock (org.neo4j.kernel.impl.store.record.PropertyBlock)17