Search in sources :

Example 1 with EntityTokenUpdate

use of org.neo4j.storageengine.api.EntityTokenUpdate in project neo4j by neo4j.

the class FullCheckIntegrationTest method writeToNodeLabelStructure.

void writeToNodeLabelStructure(GraphStoreFixture fixture, Iterable<EntityTokenUpdate> entityTokenUpdates) throws IOException, IndexEntryConflictException {
    IndexDescriptor tokenIndex = findTokenIndex(fixture, EntityType.NODE);
    IndexAccessor accessor = fixture.indexAccessorLookup().apply(tokenIndex);
    try (IndexUpdater indexUpdater = accessor.newUpdater(IndexUpdateMode.ONLINE, NULL)) {
        for (EntityTokenUpdate entityTokenUpdate : entityTokenUpdates) {
            indexUpdater.process(IndexEntryUpdate.change(entityTokenUpdate.getEntityId(), tokenIndex, entityTokenUpdate.getTokensBefore(), entityTokenUpdate.getTokensAfter()));
        }
    }
}
Also used : IndexAccessor(org.neo4j.kernel.api.index.IndexAccessor) EntityTokenUpdate(org.neo4j.storageengine.api.EntityTokenUpdate) IndexDescriptor(org.neo4j.internal.schema.IndexDescriptor) IndexUpdater(org.neo4j.kernel.api.index.IndexUpdater)

Example 2 with EntityTokenUpdate

use of org.neo4j.storageengine.api.EntityTokenUpdate in project neo4j by neo4j.

the class FullCheckIntegrationTest method shouldReportLabelScanStoreInconsistencies.

@Test
void shouldReportLabelScanStoreInconsistencies() throws Exception {
    // given
    GraphStoreFixture.IdGenerator idGenerator = fixture.idGenerator();
    long nodeId1 = idGenerator.node();
    long labelId = idGenerator.label() - 1;
    Iterable<EntityTokenUpdate> nodeLabelUpdates = asIterable(tokenChanges(nodeId1, new long[] {}, new long[] { labelId }));
    writeToNodeLabelStructure(fixture, nodeLabelUpdates);
    // when
    ConsistencySummaryStatistics stats = check();
    // then
    on(stats).verify(RecordType.LABEL_SCAN_DOCUMENT, 1).andThatsAllFolks();
}
Also used : IdGenerator(org.neo4j.consistency.checking.GraphStoreFixture.IdGenerator) EntityTokenUpdate(org.neo4j.storageengine.api.EntityTokenUpdate) GraphStoreFixture(org.neo4j.consistency.checking.GraphStoreFixture) ConsistencySummaryStatistics(org.neo4j.consistency.report.ConsistencySummaryStatistics) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Test(org.junit.jupiter.api.Test)

Example 3 with EntityTokenUpdate

use of org.neo4j.storageengine.api.EntityTokenUpdate in project neo4j by neo4j.

the class FullCheckIntegrationTest method shouldReportMismatchedInlinedLabels.

@Test
void shouldReportMismatchedInlinedLabels() throws Exception {
    // given
    fixture.apply(new GraphStoreFixture.Transaction() {

        @Override
        protected void transactionData(GraphStoreFixture.TransactionDataBuilder tx, GraphStoreFixture.IdGenerator next) {
            NodeRecord node = new NodeRecord(42).initialize(false, -1, false, -1, 0);
            node.setInUse(true);
            node.setLabelField(inlinedLabelsLongRepresentation(label1, label2), Collections.emptySet());
            tx.create(node);
        }
    });
    EntityTokenUpdate update = tokenChanges(42, new long[] { label1, label2 }, new long[] { label1 });
    writeToNodeLabelStructure(fixture, singletonList(update));
    // when
    ConsistencySummaryStatistics stats = check();
    // then
    on(stats).verify(RecordType.LABEL_SCAN_DOCUMENT, 1).andThatsAllFolks();
}
Also used : NodeRecord(org.neo4j.kernel.impl.store.record.NodeRecord) TransactionDataBuilder(org.neo4j.consistency.checking.GraphStoreFixture.TransactionDataBuilder) IdGenerator(org.neo4j.consistency.checking.GraphStoreFixture.IdGenerator) EntityTokenUpdate(org.neo4j.storageengine.api.EntityTokenUpdate) GraphStoreFixture(org.neo4j.consistency.checking.GraphStoreFixture) ConsistencySummaryStatistics(org.neo4j.consistency.report.ConsistencySummaryStatistics) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) Test(org.junit.jupiter.api.Test)

Aggregations

EntityTokenUpdate (org.neo4j.storageengine.api.EntityTokenUpdate)3 Test (org.junit.jupiter.api.Test)2 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)2 GraphStoreFixture (org.neo4j.consistency.checking.GraphStoreFixture)2 IdGenerator (org.neo4j.consistency.checking.GraphStoreFixture.IdGenerator)2 ConsistencySummaryStatistics (org.neo4j.consistency.report.ConsistencySummaryStatistics)2 TransactionDataBuilder (org.neo4j.consistency.checking.GraphStoreFixture.TransactionDataBuilder)1 IndexDescriptor (org.neo4j.internal.schema.IndexDescriptor)1 IndexAccessor (org.neo4j.kernel.api.index.IndexAccessor)1 IndexUpdater (org.neo4j.kernel.api.index.IndexUpdater)1 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)1