Search in sources :

Example 1 with TrackingIndexExtensionFactory

use of org.neo4j.kernel.impl.index.schema.tracking.TrackingIndexExtensionFactory in project neo4j by neo4j.

the class UniqueIndexSeekIT method uniqueIndexSeekDoNotLeakIndexReaders.

@ParameterizedTest
@MethodSource("indexProviderFactories")
void uniqueIndexSeekDoNotLeakIndexReaders(AbstractIndexProviderFactory providerFactory) throws KernelException {
    TrackingIndexExtensionFactory indexExtensionFactory = new TrackingIndexExtensionFactory(providerFactory);
    GraphDatabaseAPI database = createDatabase(indexExtensionFactory, providerFactory.descriptor());
    DependencyResolver dependencyResolver = database.getDependencyResolver();
    Config config = dependencyResolver.resolveDependency(Config.class);
    try {
        Label label = label("spaceship");
        String nameProperty = "name";
        createUniqueConstraint(database, label, nameProperty);
        generateRandomData(database, label, nameProperty);
        assertNotNull(indexExtensionFactory.getIndexProvider(config.get(default_database)));
        assertThat(numberOfClosedReaders()).isGreaterThan(0L);
        assertThat(numberOfOpenReaders()).isGreaterThan(0L);
        assertThat(numberOfClosedReaders()).isCloseTo(numberOfOpenReaders(), within(1L));
        lockNodeUsingUniqueIndexSeek(database, nameProperty);
        assertThat(numberOfClosedReaders()).isCloseTo(numberOfOpenReaders(), within(1L));
    } finally {
        managementService.shutdown();
    }
}
Also used : TrackingIndexExtensionFactory(org.neo4j.kernel.impl.index.schema.tracking.TrackingIndexExtensionFactory) GraphDatabaseAPI(org.neo4j.kernel.internal.GraphDatabaseAPI) Config(org.neo4j.configuration.Config) Label(org.neo4j.graphdb.Label) DependencyResolver(org.neo4j.common.DependencyResolver) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)1 MethodSource (org.junit.jupiter.params.provider.MethodSource)1 DependencyResolver (org.neo4j.common.DependencyResolver)1 Config (org.neo4j.configuration.Config)1 Label (org.neo4j.graphdb.Label)1 TrackingIndexExtensionFactory (org.neo4j.kernel.impl.index.schema.tracking.TrackingIndexExtensionFactory)1 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)1