Search in sources :

Example 1 with PropertyStore

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

the class StoreIteratorRelationshipCursorTest method newRecordCursorsWithMockedNeoStores.

private static RecordCursors newRecordCursorsWithMockedNeoStores(RelationshipStore relationshipStore) {
    NeoStores neoStores = mock(NeoStores.class);
    NodeStore nodeStore = newStoreMockWithRecordCursor(NodeStore.class);
    RelationshipGroupStore relGroupStore = newStoreMockWithRecordCursor(RelationshipGroupStore.class);
    PropertyStore propertyStore = newStoreMockWithRecordCursor(PropertyStore.class);
    DynamicStringStore dynamicStringStore = newStoreMockWithRecordCursor(DynamicStringStore.class);
    DynamicArrayStore dynamicArrayStore = newStoreMockWithRecordCursor(DynamicArrayStore.class);
    DynamicArrayStore dynamicLabelStore = newStoreMockWithRecordCursor(DynamicArrayStore.class);
    when(neoStores.getNodeStore()).thenReturn(nodeStore);
    when(neoStores.getRelationshipStore()).thenReturn(relationshipStore);
    when(neoStores.getRelationshipGroupStore()).thenReturn(relGroupStore);
    when(neoStores.getPropertyStore()).thenReturn(propertyStore);
    when(propertyStore.getStringStore()).thenReturn(dynamicStringStore);
    when(propertyStore.getArrayStore()).thenReturn(dynamicArrayStore);
    when(nodeStore.getDynamicLabelStore()).thenReturn(dynamicLabelStore);
    return new RecordCursors(neoStores);
}
Also used : NodeStore(org.neo4j.kernel.impl.store.NodeStore) DynamicStringStore(org.neo4j.kernel.impl.store.DynamicStringStore) NeoStores(org.neo4j.kernel.impl.store.NeoStores) RecordCursors(org.neo4j.kernel.impl.store.RecordCursors) RelationshipGroupStore(org.neo4j.kernel.impl.store.RelationshipGroupStore) DynamicArrayStore(org.neo4j.kernel.impl.store.DynamicArrayStore) PropertyStore(org.neo4j.kernel.impl.store.PropertyStore)

Example 2 with PropertyStore

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

the class MockedNeoStores method basicMockedNeoStores.

@SuppressWarnings({ "unchecked", "rawtypes" })
public static NeoStores basicMockedNeoStores() {
    NeoStores neoStores = mock(NeoStores.class);
    // Cursor, absolutely mocked and cannot be used at all as it is
    RecordCursor cursor = mockedRecordCursor();
    // NodeStore - DynamicLabelStore
    NodeStore nodeStore = mock(NodeStore.class);
    when(nodeStore.newRecordCursor(any())).thenReturn(cursor);
    when(neoStores.getNodeStore()).thenReturn(nodeStore);
    // NodeStore - DynamicLabelStore
    DynamicArrayStore dynamicLabelStore = mock(DynamicArrayStore.class);
    when(dynamicLabelStore.newRecordCursor(any())).thenReturn(cursor);
    when(nodeStore.getDynamicLabelStore()).thenReturn(dynamicLabelStore);
    // RelationshipStore
    RelationshipStore relationshipStore = mock(RelationshipStore.class);
    when(relationshipStore.newRecordCursor(any())).thenReturn(cursor);
    when(neoStores.getRelationshipStore()).thenReturn(relationshipStore);
    // RelationshipGroupStore
    RelationshipGroupStore relationshipGroupStore = mock(RelationshipGroupStore.class);
    when(relationshipGroupStore.newRecordCursor(any())).thenReturn(cursor);
    when(neoStores.getRelationshipGroupStore()).thenReturn(relationshipGroupStore);
    // PropertyStore
    PropertyStore propertyStore = mock(PropertyStore.class);
    when(propertyStore.newRecordCursor(any())).thenReturn(cursor);
    when(neoStores.getPropertyStore()).thenReturn(propertyStore);
    // PropertyStore -- DynamicStringStore
    DynamicStringStore propertyStringStore = mock(DynamicStringStore.class);
    when(propertyStringStore.newRecordCursor(any())).thenReturn(cursor);
    when(propertyStore.getStringStore()).thenReturn(propertyStringStore);
    // PropertyStore -- DynamicArrayStore
    DynamicArrayStore propertyArrayStore = mock(DynamicArrayStore.class);
    when(propertyArrayStore.newRecordCursor(any())).thenReturn(cursor);
    when(propertyStore.getArrayStore()).thenReturn(propertyArrayStore);
    return neoStores;
}
Also used : RecordCursor(org.neo4j.kernel.impl.store.RecordCursor) NodeStore(org.neo4j.kernel.impl.store.NodeStore) DynamicStringStore(org.neo4j.kernel.impl.store.DynamicStringStore) NeoStores(org.neo4j.kernel.impl.store.NeoStores) RelationshipGroupStore(org.neo4j.kernel.impl.store.RelationshipGroupStore) RelationshipStore(org.neo4j.kernel.impl.store.RelationshipStore) DynamicArrayStore(org.neo4j.kernel.impl.store.DynamicArrayStore) PropertyStore(org.neo4j.kernel.impl.store.PropertyStore)

Example 3 with PropertyStore

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

the class HighIdTransactionApplier method visitPropertyCommand.

@Override
public boolean visitPropertyCommand(PropertyCommand command) throws IOException {
    PropertyStore propertyStore = neoStores.getPropertyStore();
    track(propertyStore, command);
    for (PropertyBlock block : command.getAfter()) {
        switch(block.getType()) {
            case STRING:
                track(propertyStore.getStringStore(), block.getValueRecords());
                break;
            case ARRAY:
                track(propertyStore.getArrayStore(), block.getValueRecords());
                break;
            default:
                // Not needed, no dynamic records then
                break;
        }
    }
    return false;
}
Also used : PropertyBlock(org.neo4j.kernel.impl.store.record.PropertyBlock) PropertyStore(org.neo4j.kernel.impl.store.PropertyStore)

Example 4 with PropertyStore

use of org.neo4j.kernel.impl.store.PropertyStore 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)

Example 5 with PropertyStore

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

the class PropertyDeduplicator method deduplicateProperties.

public void deduplicateProperties() throws IOException {
    StoreFactory factory = new StoreFactory(workingDir, pageCache, fileSystem, NullLogProvider.getInstance());
    try (NeoStores neoStores = factory.openNeoStores(StoreType.PROPERTY, StoreType.NODE, StoreType.SCHEMA)) {
        PropertyStore propertyStore = neoStores.getPropertyStore();
        NodeStore nodeStore = neoStores.getNodeStore();
        SchemaStore schemaStore = neoStores.getSchemaStore();
        PrimitiveLongObjectMap<List<DuplicateCluster>> duplicateClusters = collectConflictingProperties(propertyStore);
        resolveConflicts(duplicateClusters, propertyStore, nodeStore, schemaStore, neoStores.getStoreDir());
    }
}
Also used : NodeStore(org.neo4j.kernel.impl.store.NodeStore) SchemaStore(org.neo4j.kernel.impl.store.SchemaStore) NeoStores(org.neo4j.kernel.impl.store.NeoStores) ArrayList(java.util.ArrayList) List(java.util.List) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) PropertyStore(org.neo4j.kernel.impl.store.PropertyStore)

Aggregations

PropertyStore (org.neo4j.kernel.impl.store.PropertyStore)7 NeoStores (org.neo4j.kernel.impl.store.NeoStores)5 NodeStore (org.neo4j.kernel.impl.store.NodeStore)5 Test (org.junit.Test)2 DynamicArrayStore (org.neo4j.kernel.impl.store.DynamicArrayStore)2 DynamicStringStore (org.neo4j.kernel.impl.store.DynamicStringStore)2 RelationshipGroupStore (org.neo4j.kernel.impl.store.RelationshipGroupStore)2 NodeRecord (org.neo4j.kernel.impl.store.record.NodeRecord)2 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Supplier (java.util.function.Supplier)1 WorkSync (org.neo4j.concurrent.WorkSync)1 IndexPopulationFailedKernelException (org.neo4j.kernel.api.exceptions.index.IndexPopulationFailedKernelException)1 IndexEntryUpdate (org.neo4j.kernel.api.index.IndexEntryUpdate)1 IndexPopulator (org.neo4j.kernel.api.index.IndexPopulator)1 IndexUpdater (org.neo4j.kernel.api.index.IndexUpdater)1 LabelScanWriter (org.neo4j.kernel.api.labelscan.LabelScanWriter)1 TransactionApplier (org.neo4j.kernel.impl.api.TransactionApplier)1 TransactionToApply (org.neo4j.kernel.impl.api.TransactionToApply)1 IndexingService (org.neo4j.kernel.impl.api.index.IndexingService)1