Search in sources :

Example 56 with RelationshipTypeTokenRecord

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

the class OwnerCheckTest method shouldReportDynamicRecordOwnedByRelationshipLabelAndOtherDynamicRecord.

@Test
public void shouldReportDynamicRecordOwnedByRelationshipLabelAndOtherDynamicRecord() throws Exception {
    // given
    RecordAccessStub records = new RecordAccessStub();
    OwnerCheck decorator = new OwnerCheck(true, DynamicStore.RELATIONSHIP_TYPE);
    RecordCheck<DynamicRecord, ConsistencyReport.DynamicConsistencyReport> dynChecker = decorator.decorateDynamicChecker(RecordType.RELATIONSHIP_TYPE_NAME, dummyDynamicCheck(configureDynamicStore(50), DynamicStore.RELATIONSHIP_TYPE));
    RecordCheck<RelationshipTypeTokenRecord, ConsistencyReport.RelationshipTypeConsistencyReport> labelCheck = decorator.decorateRelationshipTypeTokenChecker(dummyRelationshipLabelCheck());
    DynamicRecord owned = records.addRelationshipTypeName(inUse(string(new DynamicRecord(42))));
    DynamicRecord dynamic = records.addRelationshipTypeName(inUse(string(new DynamicRecord(1))));
    RelationshipTypeTokenRecord label = records.add(inUse(new RelationshipTypeTokenRecord(1)));
    dynamic.setNextBlock(owned.getId());
    label.setNameId((int) owned.getId());
    // when
    ConsistencyReport.RelationshipTypeConsistencyReport labelReport = check(ConsistencyReport.RelationshipTypeConsistencyReport.class, labelCheck, label, records);
    ConsistencyReport.DynamicConsistencyReport dynReport = check(ConsistencyReport.DynamicConsistencyReport.class, dynChecker, dynamic, records);
    // then
    verifyNoMoreInteractions(labelReport);
    verify(dynReport).nextMultipleOwners(label);
    verifyNoMoreInteractions(dynReport);
}
Also used : DynamicRecord(org.neo4j.kernel.impl.store.record.DynamicRecord) RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord) RecordAccessStub(org.neo4j.consistency.store.RecordAccessStub) ConsistencyReport(org.neo4j.consistency.report.ConsistencyReport) Test(org.junit.Test)

Example 57 with RelationshipTypeTokenRecord

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

the class Commands method createRelationshipTypeToken.

public static RelationshipTypeTokenCommand createRelationshipTypeToken(int id, int nameId) {
    RelationshipTypeTokenRecord before = new RelationshipTypeTokenRecord(id);
    RelationshipTypeTokenRecord after = new RelationshipTypeTokenRecord(id);
    populateTokenRecord(after, nameId);
    return new RelationshipTypeTokenCommand(before, after);
}
Also used : RelationshipTypeTokenCommand(org.neo4j.kernel.impl.transaction.command.Command.RelationshipTypeTokenCommand) RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)

Example 58 with RelationshipTypeTokenRecord

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

the class LogCommandSerializationV3_0_10 method readRelationshipTypeTokenCommand.

@Override
protected Command readRelationshipTypeTokenCommand(ReadableChannel channel) throws IOException {
    int id = channel.getInt();
    RelationshipTypeTokenRecord before = readRelationshipTypeTokenRecord(id, channel);
    if (before == null) {
        return null;
    }
    RelationshipTypeTokenRecord after = readRelationshipTypeTokenRecord(id, channel);
    if (after == null) {
        return null;
    }
    return new Command.RelationshipTypeTokenCommand(this, before, after);
}
Also used : RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)

Example 59 with RelationshipTypeTokenRecord

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

the class LogCommandSerializationV4_0 method readRelationshipTypeTokenCommand.

@Override
protected Command readRelationshipTypeTokenCommand(ReadableChannel channel) throws IOException {
    int id = channel.getInt();
    RelationshipTypeTokenRecord before = readRelationshipTypeTokenRecord(id, channel);
    RelationshipTypeTokenRecord after = readRelationshipTypeTokenRecord(id, channel);
    markAfterRecordAsCreatedIfCommandLooksCreated(before, after);
    // DynamicRecord has the created flag stored inside them because it's much harder to tell by looking at the command whether or not they are created
    return new Command.RelationshipTypeTokenCommand(this, before, after);
}
Also used : RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)

Example 60 with RelationshipTypeTokenRecord

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

the class Commands method createRelationshipTypeToken.

public static RelationshipTypeTokenCommand createRelationshipTypeToken(int id, int nameId) {
    RelationshipTypeTokenRecord before = new RelationshipTypeTokenRecord(id);
    RelationshipTypeTokenRecord after = new RelationshipTypeTokenRecord(id);
    populateTokenRecord(after, nameId);
    return new RelationshipTypeTokenCommand(before, after);
}
Also used : RelationshipTypeTokenCommand(org.neo4j.internal.recordstorage.Command.RelationshipTypeTokenCommand) RelationshipTypeTokenRecord(org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)

Aggregations

RelationshipTypeTokenRecord (org.neo4j.kernel.impl.store.record.RelationshipTypeTokenRecord)66 Test (org.junit.Test)36 ConsistencyReport (org.neo4j.consistency.report.ConsistencyReport)33 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)30 RelationshipRecord (org.neo4j.kernel.impl.store.record.RelationshipRecord)30 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)17 IOException (java.io.IOException)9 PropertyRecord (org.neo4j.kernel.impl.store.record.PropertyRecord)7 StorageCommand (org.neo4j.storageengine.api.StorageCommand)6 LabelTokenRecord (org.neo4j.kernel.impl.store.record.LabelTokenRecord)5 PropertyKeyTokenRecord (org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord)5 RepeatedTest (org.junit.jupiter.api.RepeatedTest)4 Test (org.junit.jupiter.api.Test)4 PrimitiveRecord (org.neo4j.kernel.impl.store.record.PrimitiveRecord)4 RelationshipGroupRecord (org.neo4j.kernel.impl.store.record.RelationshipGroupRecord)4 SchemaRecord (org.neo4j.kernel.impl.store.record.SchemaRecord)4 RecordAccessStub (org.neo4j.consistency.store.RecordAccessStub)3 NeoStores (org.neo4j.kernel.impl.store.NeoStores)3 RelationshipTypeTokenCommand (org.neo4j.kernel.impl.transaction.command.Command.RelationshipTypeTokenCommand)3 LinkedList (java.util.LinkedList)2