Search in sources :

Example 1 with LegacyIndexProviderLookup

use of org.neo4j.kernel.impl.api.LegacyIndexProviderLookup in project neo4j by neo4j.

the class NeoStoreFileListingTest method shouldCloseIndexAndLabelScanSnapshots.

@Test
public void shouldCloseIndexAndLabelScanSnapshots() throws Exception {
    // Given
    LabelScanStore labelScanStore = mock(LabelScanStore.class);
    IndexingService indexingService = mock(IndexingService.class);
    LegacyIndexProviderLookup legacyIndexes = mock(LegacyIndexProviderLookup.class);
    when(legacyIndexes.all()).thenReturn(Collections.emptyList());
    File storeDir = mock(File.class);
    filesInStoreDirAre(storeDir, STANDARD_STORE_DIR_FILES, STANDARD_STORE_DIR_DIRECTORIES);
    StorageEngine storageEngine = mock(StorageEngine.class);
    NeoStoreFileListing fileListing = new NeoStoreFileListing(storeDir, labelScanStore, indexingService, legacyIndexes, storageEngine);
    ResourceIterator<File> scanSnapshot = scanStoreFilesAre(labelScanStore, new String[] { "blah/scan.store", "scan.more" });
    ResourceIterator<File> indexSnapshot = indexFilesAre(indexingService, new String[] { "schema/index/my.index" });
    ResourceIterator<StoreFileMetadata> result = fileListing.listStoreFiles(false);
    // When
    result.close();
    // Then
    verify(scanSnapshot).close();
    verify(indexSnapshot).close();
}
Also used : LabelScanStore(org.neo4j.kernel.api.labelscan.LabelScanStore) LegacyIndexProviderLookup(org.neo4j.kernel.impl.api.LegacyIndexProviderLookup) IndexingService(org.neo4j.kernel.impl.api.index.IndexingService) StoreFileMetadata(org.neo4j.storageengine.api.StoreFileMetadata) StorageEngine(org.neo4j.storageengine.api.StorageEngine) StoreFile(org.neo4j.kernel.impl.storemigration.StoreFile) File(java.io.File) PhysicalLogFile(org.neo4j.kernel.impl.transaction.log.PhysicalLogFile) Test(org.junit.Test)

Example 2 with LegacyIndexProviderLookup

use of org.neo4j.kernel.impl.api.LegacyIndexProviderLookup in project neo4j by neo4j.

the class RecordStorageEngineRule method get.

private RecordStorageEngine get(FileSystemAbstraction fs, PageCache pageCache, SchemaIndexProvider schemaIndexProvider, DatabaseHealth databaseHealth, File storeDirectory, Function<BatchTransactionApplierFacade, BatchTransactionApplierFacade> transactionApplierTransformer) {
    if (!fs.fileExists(storeDirectory) && !fs.mkdir(storeDirectory)) {
        throw new IllegalStateException();
    }
    IdGeneratorFactory idGeneratorFactory = new EphemeralIdGenerator.Factory();
    LabelScanStoreProvider labelScanStoreProvider = nativeLabelScanStoreProvider(storeDirectory, fs, pageCache);
    LegacyIndexProviderLookup legacyIndexProviderLookup = mock(LegacyIndexProviderLookup.class);
    when(legacyIndexProviderLookup.all()).thenReturn(Iterables.empty());
    IndexConfigStore indexConfigStore = new IndexConfigStore(storeDirectory, fs);
    JobScheduler scheduler = life.add(new Neo4jJobScheduler());
    Config config = Config.defaults();
    Supplier<KernelTransactionsSnapshot> txSnapshotSupplier = () -> new KernelTransactionsSnapshot(Collections.emptySet(), 0);
    return life.add(new ExtendedRecordStorageEngine(storeDirectory, config, idGeneratorFactory, IdReuseEligibility.ALWAYS, new CommunityIdTypeConfigurationProvider(), pageCache, fs, NullLogProvider.getInstance(), mock(PropertyKeyTokenHolder.class), mock(LabelTokenHolder.class), mock(RelationshipTypeTokenHolder.class), () -> {
    }, new StandardConstraintSemantics(), scheduler, mock(TokenNameLookup.class), new ReentrantLockService(), schemaIndexProvider, IndexingService.NO_MONITOR, databaseHealth, labelScanStoreProvider, legacyIndexProviderLookup, indexConfigStore, new SynchronizedArrayIdOrderingQueue(20), txSnapshotSupplier, transactionApplierTransformer));
}
Also used : JobScheduler(org.neo4j.kernel.impl.util.JobScheduler) Neo4jJobScheduler(org.neo4j.kernel.impl.util.Neo4jJobScheduler) LabelScanStoreProvider(org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider) NeoStoreDataSourceRule.nativeLabelScanStoreProvider(org.neo4j.test.rule.NeoStoreDataSourceRule.nativeLabelScanStoreProvider) LegacyIndexProviderLookup(org.neo4j.kernel.impl.api.LegacyIndexProviderLookup) Config(org.neo4j.kernel.configuration.Config) IndexConfigStore(org.neo4j.kernel.impl.index.IndexConfigStore) IdGeneratorFactory(org.neo4j.kernel.impl.store.id.IdGeneratorFactory) IdGeneratorFactory(org.neo4j.kernel.impl.store.id.IdGeneratorFactory) KernelTransactionsSnapshot(org.neo4j.kernel.impl.api.KernelTransactionsSnapshot) Neo4jJobScheduler(org.neo4j.kernel.impl.util.Neo4jJobScheduler) CommunityIdTypeConfigurationProvider(org.neo4j.kernel.impl.store.id.configuration.CommunityIdTypeConfigurationProvider) SynchronizedArrayIdOrderingQueue(org.neo4j.kernel.impl.util.SynchronizedArrayIdOrderingQueue) ReentrantLockService(org.neo4j.kernel.impl.locking.ReentrantLockService) StandardConstraintSemantics(org.neo4j.kernel.impl.constraints.StandardConstraintSemantics)

Aggregations

LegacyIndexProviderLookup (org.neo4j.kernel.impl.api.LegacyIndexProviderLookup)2 File (java.io.File)1 Test (org.junit.Test)1 LabelScanStore (org.neo4j.kernel.api.labelscan.LabelScanStore)1 Config (org.neo4j.kernel.configuration.Config)1 KernelTransactionsSnapshot (org.neo4j.kernel.impl.api.KernelTransactionsSnapshot)1 IndexingService (org.neo4j.kernel.impl.api.index.IndexingService)1 LabelScanStoreProvider (org.neo4j.kernel.impl.api.scan.LabelScanStoreProvider)1 StandardConstraintSemantics (org.neo4j.kernel.impl.constraints.StandardConstraintSemantics)1 IndexConfigStore (org.neo4j.kernel.impl.index.IndexConfigStore)1 ReentrantLockService (org.neo4j.kernel.impl.locking.ReentrantLockService)1 IdGeneratorFactory (org.neo4j.kernel.impl.store.id.IdGeneratorFactory)1 CommunityIdTypeConfigurationProvider (org.neo4j.kernel.impl.store.id.configuration.CommunityIdTypeConfigurationProvider)1 StoreFile (org.neo4j.kernel.impl.storemigration.StoreFile)1 PhysicalLogFile (org.neo4j.kernel.impl.transaction.log.PhysicalLogFile)1 JobScheduler (org.neo4j.kernel.impl.util.JobScheduler)1 Neo4jJobScheduler (org.neo4j.kernel.impl.util.Neo4jJobScheduler)1 SynchronizedArrayIdOrderingQueue (org.neo4j.kernel.impl.util.SynchronizedArrayIdOrderingQueue)1 StorageEngine (org.neo4j.storageengine.api.StorageEngine)1 StoreFileMetadata (org.neo4j.storageengine.api.StoreFileMetadata)1