Search in sources :

Example 11 with SchemaStorage

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

the class IndexStatisticsTest method shouldRemoveIndexStatisticsAfterIndexIsDeleted.

@Test
public void shouldRemoveIndexStatisticsAfterIndexIsDeleted() throws KernelException {
    // given
    createSomePersons();
    NewIndexDescriptor index = awaitOnline(createIndex("Person", "name"));
    SchemaStorage storage = new SchemaStorage(neoStores().getSchemaStore());
    long indexId = storage.indexGetForSchema(index).getId();
    // when
    dropIndex(index);
    // then
    try {
        indexSelectivity(index);
        fail("Expected IndexNotFoundKernelException to be thrown");
    } catch (IndexNotFoundKernelException e) {
        DoubleLongRegister actual = getTracker().indexSample(indexId, Registers.newDoubleLongRegister());
        assertDoubleLongEquals(0L, 0L, actual);
    }
    // and then index size and index updates are zero on disk
    DoubleLongRegister actual = getTracker().indexUpdatesAndSize(indexId, Registers.newDoubleLongRegister());
    assertDoubleLongEquals(0L, 0L, actual);
}
Also used : NewIndexDescriptor(org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor) SchemaStorage(org.neo4j.kernel.impl.store.SchemaStorage) DoubleLongRegister(org.neo4j.register.Register.DoubleLongRegister) IndexNotFoundKernelException(org.neo4j.kernel.api.exceptions.index.IndexNotFoundKernelException) Test(org.junit.Test)

Aggregations

SchemaStorage (org.neo4j.kernel.impl.store.SchemaStorage)11 Test (org.junit.Test)7 IndexRule (org.neo4j.kernel.impl.store.record.IndexRule)7 ArrayList (java.util.ArrayList)3 SchemaRuleUtil.constraintIndexRule (org.neo4j.consistency.checking.SchemaRuleUtil.constraintIndexRule)3 ConsistencySummaryStatistics (org.neo4j.consistency.report.ConsistencySummaryStatistics)3 NewIndexDescriptor (org.neo4j.kernel.api.schema_new.index.NewIndexDescriptor)3 IndexSamplingConfig (org.neo4j.kernel.impl.api.index.sampling.IndexSamplingConfig)3 IndexAccessor (org.neo4j.kernel.api.index.IndexAccessor)2 IndexUpdater (org.neo4j.kernel.api.index.IndexUpdater)2 NeoStores (org.neo4j.kernel.impl.store.NeoStores)2 SchemaStore (org.neo4j.kernel.impl.store.SchemaStore)2 ConstraintRule (org.neo4j.kernel.impl.store.record.ConstraintRule)2 DynamicRecord (org.neo4j.kernel.impl.store.record.DynamicRecord)2 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 Matchers.anyLong (org.mockito.Matchers.anyLong)1 PropertyChain (org.neo4j.consistency.checking.PropertyChain)1 SchemaRecordCheck (org.neo4j.consistency.checking.SchemaRecordCheck)1 CacheTask (org.neo4j.consistency.checking.cache.CacheTask)1 IndexEntryProcessor (org.neo4j.consistency.checking.index.IndexEntryProcessor)1