Search in sources :

Example 6 with IndexImplementation

use of org.neo4j.kernel.spi.legacyindex.IndexImplementation in project neo4j by neo4j.

the class LegacyIndexTransactionStateImpl method relationshipChanges.

@Override
public LegacyIndex relationshipChanges(String indexName) throws LegacyIndexNotFoundKernelException {
    Map<String, String> configuration = indexConfigStore.get(Relationship.class, indexName);
    if (configuration == null) {
        throw new LegacyIndexNotFoundKernelException("Relationship index '" + indexName + " not found");
    }
    String providerName = configuration.get(IndexManager.PROVIDER);
    IndexImplementation provider = providerLookup.apply(providerName);
    LegacyIndexProviderTransaction transaction = transactions.get(providerName);
    if (transaction == null) {
        transactions.put(providerName, transaction = provider.newTransaction(this));
    }
    return transaction.relationshipIndex(indexName, configuration);
}
Also used : LegacyIndexNotFoundKernelException(org.neo4j.kernel.api.exceptions.legacyindex.LegacyIndexNotFoundKernelException) IndexImplementation(org.neo4j.kernel.spi.legacyindex.IndexImplementation) LegacyIndexProviderTransaction(org.neo4j.kernel.spi.legacyindex.LegacyIndexProviderTransaction)

Example 7 with IndexImplementation

use of org.neo4j.kernel.spi.legacyindex.IndexImplementation in project neo4j by neo4j.

the class RecordStorageEngine method flushAndForce.

@Override
public void flushAndForce(IOLimiter limiter) {
    indexingService.forceAll();
    labelScanStore.force(limiter);
    for (IndexImplementation index : legacyIndexProviderLookup.all()) {
        index.force();
    }
    neoStores.flush(limiter);
}
Also used : IndexImplementation(org.neo4j.kernel.spi.legacyindex.IndexImplementation)

Example 8 with IndexImplementation

use of org.neo4j.kernel.spi.legacyindex.IndexImplementation in project neo4j by neo4j.

the class NeoStoreFileListing method gatherLegacyIndexFiles.

private Resource gatherLegacyIndexFiles(Collection<StoreFileMetadata> files) throws IOException {
    final Collection<ResourceIterator<File>> snapshots = new ArrayList<>();
    for (IndexImplementation indexProvider : legacyIndexProviders.all()) {
        ResourceIterator<File> snapshot = indexProvider.listStoreFiles();
        snapshots.add(snapshot);
        snapshot.stream().map(toNotAStoreTypeFile).collect(Collectors.toCollection(() -> files));
    }
    // the targetFiles list.
    return new MultiResource(snapshots);
}
Also used : IndexImplementation(org.neo4j.kernel.spi.legacyindex.IndexImplementation) ArrayList(java.util.ArrayList) ResourceIterator(org.neo4j.graphdb.ResourceIterator) File(java.io.File)

Example 9 with IndexImplementation

use of org.neo4j.kernel.spi.legacyindex.IndexImplementation in project neo4j by neo4j.

the class LegacyIndexMigratorTest method logErrorWithIndexNameOnIndexMigrationException.

@Test
public void logErrorWithIndexNameOnIndexMigrationException() throws IOException {
    Log log = mock(Log.class);
    when(logProvider.getLog(TestLegacyIndexMigrator.class)).thenReturn(log);
    HashMap<String, IndexImplementation> indexProviders = getIndexProviders();
    try {
        LegacyIndexMigrator indexMigrator = new TestLegacyIndexMigrator(fs, indexProviders, logProvider, false);
        indexMigrator.migrate(storeDir, migrationDir, progressMonitor, StandardV2_3.STORE_VERSION, StandardV3_0.STORE_VERSION);
        fail("Index migration should fail");
    } catch (IOException e) {
    // ignored
    }
    verify(log).error(eq("Migration of legacy indexes failed. Index: testIndex can't be migrated."), any(Throwable.class));
}
Also used : Log(org.neo4j.logging.Log) IndexImplementation(org.neo4j.kernel.spi.legacyindex.IndexImplementation) IOException(java.io.IOException) Test(org.junit.Test)

Aggregations

IndexImplementation (org.neo4j.kernel.spi.legacyindex.IndexImplementation)9 Test (org.junit.Test)2 LegacyIndexNotFoundKernelException (org.neo4j.kernel.api.exceptions.legacyindex.LegacyIndexNotFoundKernelException)2 LegacyIndexProviderTransaction (org.neo4j.kernel.spi.legacyindex.LegacyIndexProviderTransaction)2 File (java.io.File)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collections.singletonMap (java.util.Collections.singletonMap)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 Function (java.util.function.Function)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Matchers.anyString (org.mockito.Matchers.anyString)1 Matchers.eq (org.mockito.Matchers.eq)1 Mockito.mock (org.mockito.Mockito.mock)1 Mockito.when (org.mockito.Mockito.when)1 Node (org.neo4j.graphdb.Node)1 Relationship (org.neo4j.graphdb.Relationship)1