Search in sources :

Example 6 with PropertyKeyTokenStore

use of org.neo4j.kernel.impl.store.PropertyKeyTokenStore in project neo4j by neo4j.

the class PropertyDeduplicator method resolveConflicts.

private void resolveConflicts(final PrimitiveLongObjectMap<List<DuplicateCluster>> duplicateClusters, PropertyStore propertyStore, final NodeStore nodeStore, SchemaStore schemaStore, File storeDir) throws IOException {
    if (duplicateClusters.isEmpty()) {
        // Happiest of cases.
        return;
    }
    // whose nextProp() is amongst our duplicateClusters is potentially interesting.
    if (!isIndexStorageEmpty(storeDir)) {
        try (IndexLookup indexLookup = new IndexLookup(schemaStore, schemaIndexProvider);
            IndexedConflictsResolver indexedConflictsResolver = new IndexedConflictsResolver(duplicateClusters, indexLookup, nodeStore, propertyStore)) {
            if (indexLookup.hasAnyIndexes()) {
                nodeStore.scanAllRecords(indexedConflictsResolver);
            }
        }
    }
    // Then resolve all duplicateClusters by changing the propertyKey for the first conflicting property block, to
    // one that is prefixed with "__DUPLICATE_<key>".
    PropertyKeyTokenStore keyTokenStore = propertyStore.getPropertyKeyTokenStore();
    NonIndexedConflictResolver resolver = new NonIndexedConflictResolver(keyTokenStore, propertyStore);
    duplicateClusters.visitEntries(resolver);
}
Also used : PropertyKeyTokenStore(org.neo4j.kernel.impl.store.PropertyKeyTokenStore)

Aggregations

PropertyKeyTokenStore (org.neo4j.kernel.impl.store.PropertyKeyTokenStore)6 NeoStores (org.neo4j.kernel.impl.store.NeoStores)5 DependencyResolver (org.neo4j.graphdb.DependencyResolver)3 Label (org.neo4j.graphdb.Label)3 Transaction (org.neo4j.graphdb.Transaction)3 RecordStorageEngine (org.neo4j.kernel.impl.storageengine.impl.recordstorage.RecordStorageEngine)3 BeforeClass (org.junit.BeforeClass)2 Node (org.neo4j.graphdb.Node)2 LabelTokenStore (org.neo4j.kernel.impl.store.LabelTokenStore)2 Before (org.junit.Before)1 GraphDatabaseService (org.neo4j.graphdb.GraphDatabaseService)1 GraphDatabaseFactory (org.neo4j.graphdb.factory.GraphDatabaseFactory)1 PageCache (org.neo4j.io.pagecache.PageCache)1 SchemaIndexProvider (org.neo4j.kernel.api.index.SchemaIndexProvider)1 RelationshipTypeTokenStore (org.neo4j.kernel.impl.store.RelationshipTypeTokenStore)1 SchemaStore (org.neo4j.kernel.impl.store.SchemaStore)1 StoreFactory (org.neo4j.kernel.impl.store.StoreFactory)1 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)1 PropertyKeyTokenRecord (org.neo4j.kernel.impl.store.record.PropertyKeyTokenRecord)1 TestGraphDatabaseFactory (org.neo4j.test.TestGraphDatabaseFactory)1