Search in sources :

Example 16 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class LegacyLogsTest method createNode.

private static LogEntry createNode(int id) {
    NodeRecord before = new NodeRecord(id).initialize(false, NO_NEXT_REL, false, NO_NEXT_REL, NO_LABELS);
    NodeRecord after = new NodeRecord(id).initialize(true, NO_NEXT_REL, false, NO_NEXT_REL, NO_LABELS);
    Command.NodeCommand command = new Command.NodeCommand(before, after);
    return new LogEntryCommand(command);
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) LogEntryCommand(org.neo4j.kernel.impl.transaction.log.entry.LogEntryCommand) Command(org.neo4j.kernel.impl.transaction.command.Command) LogEntryCommand(org.neo4j.kernel.impl.transaction.log.entry.LogEntryCommand)

Example 17 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class LogEntrySortingCursorTest method command.

private LogEntry command() {
    NodeRecord before = new NodeRecord(random.nextInt());
    NodeRecord after = new NodeRecord(random.nextInt());
    return new LogEntryCommand(new Command.NodeCommand(before, after));
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) LogEntryCommand(org.neo4j.kernel.impl.transaction.log.entry.LogEntryCommand) Command(org.neo4j.kernel.impl.transaction.command.Command) LogEntryCommand(org.neo4j.kernel.impl.transaction.log.entry.LogEntryCommand)

Example 18 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class NodeDynamicLabelOrphanChainStartCheckTest method shouldReportOwningNodeRecordNotInUse.

@Test
public void shouldReportOwningNodeRecordNotInUse() throws Exception {
    // given
    NodeRecord nodeRecord = notInUse(new NodeRecord(12L, false, -1, -1));
    add(nodeRecord);
    DynamicRecord nodeDynamicLabelRecord = inUse(new DynamicRecord(0));
    allocateFromNumbers(new ArrayList<>(), new long[] { 12L }, new ReusableRecordsAllocator(66, nodeDynamicLabelRecord));
    // when
    DynamicLabelConsistencyReport report = check(nodeDynamicLabelRecord);
    // then
    verify(report).orphanDynamicLabelRecordDueToInvalidOwner(nodeRecord);
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) ReusableRecordsAllocator(org.neo4j.kernel.impl.store.allocator.ReusableRecordsAllocator) DynamicLabelConsistencyReport(org.neo4j.consistency.report.ConsistencyReport.DynamicLabelConsistencyReport) Test(org.junit.Test)

Example 19 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class DuplicatePropertyTest method shouldReportDuplicatePropertyIndexesInPropertyRecordForNode.

@Test
public void shouldReportDuplicatePropertyIndexesInPropertyRecordForNode() throws Exception {
    // given
    ChainCheck check = new ChainCheck();
    RecordAccessStub records = new RecordAccessStub();
    NodeRecord master = records.add(inUse(new NodeRecord(1, false, -1, 1)));
    PropertyRecord propertyRecord = inUse(new PropertyRecord(1));
    PropertyBlock firstBlock = new PropertyBlock();
    firstBlock.setSingleBlock(1);
    firstBlock.setKeyIndexId(1);
    PropertyBlock secondBlock = new PropertyBlock();
    secondBlock.setSingleBlock(1);
    secondBlock.setKeyIndexId(2);
    PropertyBlock thirdBlock = new PropertyBlock();
    thirdBlock.setSingleBlock(1);
    thirdBlock.setKeyIndexId(1);
    propertyRecord.addPropertyBlock(firstBlock);
    propertyRecord.addPropertyBlock(secondBlock);
    propertyRecord.addPropertyBlock(thirdBlock);
    records.add(propertyRecord);
    // when
    ConsistencyReport.NodeConsistencyReport report = mock(ConsistencyReport.NodeConsistencyReport.class);
    CheckerEngine<NodeRecord, ConsistencyReport.NodeConsistencyReport> checkEngine = records.engine(master, report);
    check.checkReference(master, propertyRecord, checkEngine, records);
    // then
    verify(report).propertyKeyNotUniqueInChain();
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) PropertyRecord(org.neo4j.kernel.impl.store.record.PropertyRecord) PropertyBlock(org.neo4j.kernel.impl.store.record.PropertyBlock) ChainCheck(org.neo4j.consistency.checking.ChainCheck) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 20 with NodeRecord

use of org.neo4j.kernel.impl.store.record.NodeRecord in project neo4j by neo4j.

the class DumpStoreChain method chainForNode.

private static DumpStoreChain chainForNode(Args args) {
    Set<String> kwArgs = args.asMap().keySet();
    verifyParameters(kwArgs, kwArgs.contains(RELS) ? RELS : PROPS, NODE);
    final long node = Long.parseLong(args.get(NODE, null));
    if (args.getBoolean(RELS, false, true)) {
        return new DumpRelationshipChain(-1, node, false) {

            @Override
            RelationshipStore store(NeoStores neoStores) {
                NodeRecord nodeRecord = nodeRecord(neoStores, node);
                first = nodeRecord.isDense() ? -1 : nodeRecord.getNextRel();
                return super.store(neoStores);
            }
        };
    } else if (args.getBoolean(PROPS, false, true)) {
        return new DumpPropertyChain(-1, false) {

            @Override
            PropertyStore store(NeoStores neoStores) {
                first = nodeRecord(neoStores, node).getNextProp();
                return super.store(neoStores);
            }
        };
    } else {
        throw invalidUsage(String.format("Must be either -%s or -%s", RELS, PROPS));
    }
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) NeoStores(org.neo4j.kernel.impl.store.NeoStores) PropertyStore(org.neo4j.kernel.impl.store.PropertyStore)

Aggregations

NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)257 Test (org.junit.Test)190 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)62 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)51 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)38 Command (org.neo4j.kernel.impl.transaction.command.Command)29 RelationshipTypeTokenRecord (org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)28 RelationshipGroupRecord (org.neo4j.kernel.impl.store.record.RelationshipGroupRecord)27 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)26 ConsistencySummaryStatistics (org.neo4j.consistency.report.ConsistencySummaryStatistics)23 NodeLabels (org.neo4j.kernel.impl.store.NodeLabels)23 GraphStoreFixture (org.neo4j.consistency.checking.GraphStoreFixture)22 IdGenerator (org.neo4j.consistency.checking.GraphStoreFixture.IdGenerator)22 TransactionDataBuilder (org.neo4j.consistency.checking.GraphStoreFixture.TransactionDataBuilder)22 ArrayList (java.util.ArrayList)19 DynamicNodeLabels (org.neo4j.kernel.impl.store.DynamicNodeLabels)19 File (java.io.File)15 RecordAccessStub (org.neo4j.consistency.store.RecordAccessStub)13 NodeStore (org.neo4j.kernel.impl.store.NodeStore)11 ReusableRecordsAllocator (org.neo4j.kernel.impl.store.allocator.ReusableRecordsAllocator)10