protected internal virtual void Fail(IndexPopulation population, Exception failure) { if (!RemoveFromOngoingPopulations(population)) { return; } // If the cause of index population failure is a conflict in a (unique) index, the conflict is the failure if (failure is IndexPopulationFailedKernelException) { Exception cause = failure.InnerException; if (cause is IndexEntryConflictException) { failure = cause; } } Log.error(format("Failed to populate index: [%s]", population.IndexUserDescription), failure); // The flipper will have already flipped to a failed index context here, but // it will not include the cause of failure, so we do another flip to a failed // context that does. // The reason for having the flipper transition to the failed index context in the first // place is that we would otherwise introduce a race condition where updates could come // in to the old context, if something failed in the job we send to the flipper. IndexPopulationFailure indexPopulationFailure = failure(failure); population.FlipToFailed(indexPopulationFailure); try { population.Populator.markAsFailed(indexPopulationFailure.AsString()); population.Populator.close(false); } catch (Exception e) { Log.error(format("Unable to close failed populator for index: [%s]", population.IndexUserDescription), e); } }
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); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldLogReasonForDroppingIndex() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldLogReasonForDroppingIndex() { // given AssertableLogProvider logProvider = new AssertableLogProvider(); // when (new FailedIndexProxy(forSchema(forLabel(0, 0), IndexProviderDescriptor.UNDECIDED).withId(1).withoutCapabilities(), "foo", mock(typeof(IndexPopulator)), IndexPopulationFailure.Failure("it broke"), _indexCountsRemover, logProvider)).drop(); // then logProvider.AssertAtLeastOnce(inLog(typeof(FailedIndexProxy)).info("FailedIndexProxy#drop index on foo dropped due to:\nit broke")); }
private FailedIndexProxy FailedIndexProxy(IndexStoreView storeView, Org.Neo4j.Kernel.Api.Index.IndexPopulator_Adapter populator) { return(new FailedIndexProxy(DummyMeta(), "userDescription", populator, IndexPopulationFailure.Failure("failure"), new IndexCountsRemover(storeView, 0), NullLogProvider.Instance)); }
internal virtual void FlipToFailed(IndexPopulationFailure failure) { Flipper.flipTo(new FailedIndexProxy(CapableIndexDescriptor, IndexUserDescription, Populator, failure, IndexCountsRemover, outerInstance.logProvider)); }
internal AbstractSwallowingIndexProxy(CapableIndexDescriptor capableIndexDescriptor, IndexPopulationFailure populationFailure) { this._capableIndexDescriptor = capableIndexDescriptor; this._populationFailure = populationFailure; }
internal FailedIndexProxy(CapableIndexDescriptor capableIndexDescriptor, string indexUserDescription, IndexPopulator populator, IndexPopulationFailure populationFailure, IndexCountsRemover indexCountsRemover, LogProvider logProvider) : base(capableIndexDescriptor, populationFailure) { this.Populator = populator; this._indexUserDescription = indexUserDescription; this._indexCountsRemover = indexCountsRemover; this._log = logProvider.getLog(this.GetType()); }