Exemple #1
0
        internal virtual IndexProxy CreateFailedIndexProxy(StoreIndexDescriptor descriptor, IndexPopulationFailure populationFailure)
        {
            // Note about the buffer factory instantiation here. Question is why an index populator is instantiated for a failed index proxy to begin with.
            // The byte buffer factory should not be used here anyway so the buffer size doesn't actually matter.
            IndexPopulator         indexPopulator         = PopulatorFromProvider(descriptor, _samplingConfig, heapBufferFactory(1024));
            CapableIndexDescriptor capableIndexDescriptor = _providerMap.withCapabilities(descriptor);
            string     indexUserDescription = indexUserDescription(descriptor);
            IndexProxy proxy;

            proxy = new FailedIndexProxy(capableIndexDescriptor, indexUserDescription, indexPopulator, populationFailure, new IndexCountsRemover(_storeView, descriptor.Id), _logProvider);
            proxy = new ContractCheckingIndexProxy(proxy, true);
            return(proxy);
        }
Exemple #2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldRemoveIndexCountsWhenTheIndexItselfIsDropped() throws java.io.IOException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldRemoveIndexCountsWhenTheIndexItselfIsDropped()
        {
            // given
            string           userDescription = "description";
            FailedIndexProxy index           = new FailedIndexProxy(forSchema(forLabel(1, 2), IndexProviderDescriptor.UNDECIDED).withId(1).withoutCapabilities(), userDescription, _indexPopulator, _indexPopulationFailure, _indexCountsRemover, NullLogProvider.Instance);

            // when
            index.Drop();

            // then
            verify(_indexPopulator).drop();
            verify(_indexCountsRemover).remove();
            verifyNoMoreInteractions(_indexPopulator, _indexCountsRemover);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void mustFlipToFailedIfFailureToApplyLastBatchWhileFlipping() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void MustFlipToFailedIfFailureToApplyLastBatchWhileFlipping()
        {
            // given
            NullLogProvider logProvider = NullLogProvider.Instance;
            IndexStoreView  storeView   = EmptyIndexStoreViewThatProcessUpdates();

            Org.Neo4j.Kernel.Api.Index.IndexPopulator_Adapter populator = EmptyPopulatorWithThrowingUpdater();
            FailedIndexProxy    failedProxy = FailedIndexProxy(storeView, populator);
            OnlineIndexProxy    onlineProxy = OnlineIndexProxy(storeView);
            FlippableIndexProxy flipper     = new FlippableIndexProxy();

            flipper.FlipTarget = () => onlineProxy;
            MultipleIndexPopulator multipleIndexPopulator = new MultipleIndexPopulator(storeView, logProvider, EntityType.NODE, mock(typeof(SchemaState)));

            MultipleIndexPopulator.IndexPopulation indexPopulation = multipleIndexPopulator.AddPopulator(populator, DummyMeta(), flipper, t => failedProxy, "userDescription");
            multipleIndexPopulator.QueueUpdate(SomeUpdate());
            multipleIndexPopulator.IndexAllEntities().run();

            // when
            indexPopulation.Flip(false);

            // then
            assertSame("flipper should have flipped to failing proxy", flipper.State, InternalIndexState.FAILED);
        }