Esempio n. 1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testIndexFlip()
        public virtual void TestIndexFlip()
        {
            IndexProxyFactory       indexProxyFactory       = mock(typeof(IndexProxyFactory));
            FailedIndexProxyFactory failedIndexProxyFactory = mock(typeof(FailedIndexProxyFactory));
            FlippableIndexProxy     flipper = new FlippableIndexProxy();

            flipper.FlipTarget = indexProxyFactory;

            IndexPopulator indexPopulator1 = CreateIndexPopulator();
            IndexPopulator indexPopulator2 = CreateIndexPopulator();

            AddPopulator(indexPopulator1, 1, flipper, failedIndexProxyFactory);
            AddPopulator(indexPopulator2, 2, flipper, failedIndexProxyFactory);

            when(indexPopulator1.SampleResult()).thenThrow(SampleError);

            _multipleIndexPopulator.indexAllEntities();
            _multipleIndexPopulator.flipAfterPopulation(false);

            verify(indexPopulator1).close(false);
            verify(failedIndexProxyFactory, times(1)).create(any(typeof(Exception)));

            verify(indexPopulator2).close(true);
            verify(indexPopulator2).sampleResult();
            verify(_indexStoreView).replaceIndexCounts(anyLong(), anyLong(), anyLong(), anyLong());
            verify(_schemaState).clear();
        }
Esempio n. 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToCancelPopulationJob() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToCancelPopulationJob()
        {
            // GIVEN
            CreateNode(map(_name, "Mattias"), _first);
            IndexPopulator      populator = mock(typeof(IndexPopulator));
            FlippableIndexProxy index     = mock(typeof(FlippableIndexProxy));
            IndexStoreView      storeView = mock(typeof(IndexStoreView));
            ControlledStoreScan storeScan = new ControlledStoreScan();

            when(storeView.VisitNodes(any(typeof(int[])), any(typeof(System.Func <int, bool>)), ArgumentMatchers.any(), ArgumentMatchers.any <Visitor <NodeLabelUpdate, Exception> >(), anyBoolean())).thenReturn(storeScan);

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final IndexPopulationJob job = newIndexPopulationJob(populator, index, storeView, org.neo4j.logging.NullLogProvider.getInstance(), org.neo4j.storageengine.api.EntityType.NODE, indexDescriptor(FIRST, name, false));
            IndexPopulationJob job = NewIndexPopulationJob(populator, index, storeView, NullLogProvider.Instance, EntityType.NODE, IndexDescriptor(_first, _name, false));

            OtherThreadExecutor <Void> populationJobRunner = Cleanup.add(new OtherThreadExecutor <Void>("Population job test runner", null));
            Future <Void> runFuture = populationJobRunner.ExecuteDontWait(state =>
            {
                job.Run();
                return(null);
            });

            storeScan.Latch.waitForAllToStart();
            job.Cancel().get();
            storeScan.Latch.waitForAllToFinish();

            // WHEN
            runFuture.get();

            // THEN
            verify(populator, times(1)).close(false);
            verify(index, never()).flip(any(), any());
        }
Esempio n. 3
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: IndexProxy createPopulatingIndexProxy(final org.neo4j.storageengine.api.schema.StoreIndexDescriptor descriptor, final boolean flipToTentative, final IndexingService.Monitor monitor, final IndexPopulationJob populationJob)
        internal virtual IndexProxy CreatePopulatingIndexProxy(StoreIndexDescriptor descriptor, bool flipToTentative, IndexingService.Monitor monitor, IndexPopulationJob populationJob)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final FlippableIndexProxy flipper = new FlippableIndexProxy();
            FlippableIndexProxy flipper = new FlippableIndexProxy();

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String indexUserDescription = indexUserDescription(descriptor);
            string                 indexUserDescription   = indexUserDescription(descriptor);
            IndexPopulator         populator              = PopulatorFromProvider(descriptor, _samplingConfig, populationJob.BufferFactory());
            CapableIndexDescriptor capableIndexDescriptor = _providerMap.withCapabilities(descriptor);

            FailedIndexProxyFactory failureDelegateFactory = new FailedPopulatingIndexProxyFactory(capableIndexDescriptor, populator, indexUserDescription, new IndexCountsRemover(_storeView, descriptor.Id), _logProvider);

            MultipleIndexPopulator.IndexPopulation indexPopulation = populationJob.AddPopulator(populator, capableIndexDescriptor, indexUserDescription, flipper, failureDelegateFactory);
            PopulatingIndexProxy populatingIndex = new PopulatingIndexProxy(capableIndexDescriptor, populationJob, indexPopulation);

            flipper.FlipTo(populatingIndex);

            // Prepare for flipping to online mode
            flipper.FlipTarget = () =>
            {
                monitor.PopulationCompleteOn(descriptor);
                IndexAccessor    accessor    = OnlineAccessorFromProvider(descriptor, _samplingConfig);
                OnlineIndexProxy onlineProxy = new OnlineIndexProxy(capableIndexDescriptor, accessor, _storeView, true);
                if (flipToTentative)
                {
                    return(new TentativeConstraintIndexProxy(flipper, onlineProxy));
                }
                return(onlineProxy);
            };

            return(new ContractCheckingIndexProxy(flipper, false));
        }
Esempio n. 4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void logConstraintJobProgress() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void LogConstraintJobProgress()
        {
            // Given
            CreateNode(map(_name, "irrelephant"), _first);
            AssertableLogProvider logProvider = new AssertableLogProvider();
            FlippableIndexProxy   index       = mock(typeof(FlippableIndexProxy));

            when(index.State).thenReturn(InternalIndexState.POPULATING);
            IndexPopulator populator = spy(IndexPopulator(false));

            try
            {
                IndexPopulationJob job = NewIndexPopulationJob(populator, index, _indexStoreView, logProvider, EntityType.NODE, IndexDescriptor(_first, _name, true));

                // When
                job.Run();

                // Then
                AssertableLogProvider.LogMatcherBuilder match = inLog(typeof(IndexPopulationJob));
                logProvider.AssertExactly(match.info("Index population started: [%s]", ":FIRST(name)"), match.info("Index created. Starting data checks. Index [%s] is %s.", ":FIRST(name)", "POPULATING"), match.info(containsString("TIME/PHASE Final: SCAN[")));
            }
            finally
            {
                populator.Close(true);
            }
        }
Esempio n. 5
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: private org.neo4j.test.OtherThreadExecutor.WorkerCommand<Void, Void> dropTheIndex(final FlippableIndexProxy flippable)
        private OtherThreadExecutor.WorkerCommand <Void, Void> DropTheIndex(FlippableIndexProxy flippable)
        {
            return(state =>
            {
                flippable.Drop();
                return null;
            });
        }
Esempio n. 6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.kernel.impl.api.index.MultipleIndexPopulator.IndexPopulation addPopulator(org.neo4j.kernel.api.index.IndexPopulator indexPopulator, int id) throws org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException
        private IndexPopulation AddPopulator(IndexPopulator indexPopulator, int id)
        {
            FlippableIndexProxy indexProxy = mock(typeof(FlippableIndexProxy));

            when(indexProxy.State).thenReturn(InternalIndexState.ONLINE);
            doAnswer(invocation =>
            {
                Callable argument = invocation.getArgument(0);
                return(argument.call());
            }).when(indexProxy).flip(any(typeof(Callable)), any(typeof(FailedIndexProxyFactory)));
            return(AddPopulator(indexPopulator, id, indexProxy, mock(typeof(FailedIndexProxyFactory))));
        }
Esempio n. 7
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testFlipAfterPopulation() throws org.neo4j.kernel.api.exceptions.index.FlipFailedKernelException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void TestFlipAfterPopulation()
        {
            IndexPopulator indexPopulator1 = CreateIndexPopulator();
            IndexPopulator indexPopulator2 = CreateIndexPopulator();

            FlippableIndexProxy flipper1 = AddPopulator(indexPopulator1, 1).Flipper;
            FlippableIndexProxy flipper2 = AddPopulator(indexPopulator2, 2).Flipper;

            _multipleIndexPopulator.flipAfterPopulation(false);

            verify(flipper1).flip(any(typeof(Callable)), any(typeof(FailedIndexProxyFactory)));
            verify(flipper2).flip(any(typeof(Callable)), any(typeof(FailedIndexProxyFactory)));
        }
Esempio n. 8
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBlockAccessDuringFlipAndThenDelegateToCorrectContext() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBlockAccessDuringFlipAndThenDelegateToCorrectContext()
        {
            // GIVEN
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final IndexProxy contextBeforeFlip = mockIndexProxy();
            IndexProxy contextBeforeFlip = mockIndexProxy();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final IndexProxy contextAfterFlip = mockIndexProxy();
            IndexProxy contextAfterFlip = mockIndexProxy();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final FlippableIndexProxy flippable = new FlippableIndexProxy(contextBeforeFlip);
            FlippableIndexProxy flippable = new FlippableIndexProxy(contextBeforeFlip);

            flippable.FlipTarget = SingleProxy(contextAfterFlip);

            // And given complicated thread race condition tools
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.CountDownLatch triggerFinishFlip = new java.util.concurrent.CountDownLatch(1);
            System.Threading.CountdownEvent triggerFinishFlip = new System.Threading.CountdownEvent(1);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.util.concurrent.CountDownLatch triggerExternalAccess = new java.util.concurrent.CountDownLatch(1);
            System.Threading.CountdownEvent triggerExternalAccess = new System.Threading.CountdownEvent(1);

            OtherThreadExecutor <Void> flippingThread  = Cleanup.add(new OtherThreadExecutor <Void>("Flipping thread", null));
            OtherThreadExecutor <Void> dropIndexThread = Cleanup.add(new OtherThreadExecutor <Void>("Drop index thread", null));

            // WHEN one thread starts flipping to another context
            Future <Void> flipContextFuture = flippingThread.ExecuteDontWait(StartFlipAndWaitForLatchBeforeFinishing(flippable, triggerFinishFlip, triggerExternalAccess));

            // And I wait until the flipping thread is in the middle of "the flip"
            assertTrue(triggerExternalAccess.await(10, SECONDS));

            // And another thread comes along and drops the index
            Future <Void> dropIndexFuture = dropIndexThread.ExecuteDontWait(DropTheIndex(flippable));

            dropIndexThread.WaitUntilWaiting();

            // And the flipping thread finishes the flip
            triggerFinishFlip.Signal();

            // And both threads get to finish up and return
            dropIndexFuture.get(10, SECONDS);
            flipContextFuture.get(10, SECONDS);

            // THEN the thread wanting to drop the index should not have interacted with the original context
            // eg. it should have waited for the flip to finish
            verifyNoMoreInteractions(contextBeforeFlip);

            // But it should have gotten to drop the new index context, after the flip happened.
            verify(contextAfterFlip).drop();
        }
Esempio n. 9
0
            internal IndexPopulation(MultipleIndexPopulator outerInstance, IndexPopulator populator, CapableIndexDescriptor capableIndexDescriptor, FlippableIndexProxy flipper, FailedIndexProxyFactory failedIndexProxyFactory, string indexUserDescription)
            {
                this._outerInstance         = outerInstance;
                this.Populator              = populator;
                this.CapableIndexDescriptor = capableIndexDescriptor;
                this.IndexId = capableIndexDescriptor.Id;
                this.Flipper = flipper;
                this.FailedIndexProxyFactory = failedIndexProxyFactory;
                this.IndexUserDescription    = indexUserDescription;
                this.IndexCountsRemover      = new IndexCountsRemover(outerInstance.storeView, IndexId);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: this.batchedUpdates = new java.util.ArrayList<>(BATCH_SIZE);
                this.BatchedUpdates = new List <IndexEntryUpdate <object> >(outerInstance.BatchSize);
            }
Esempio n. 10
0
        private static IndexPopulator AddPopulator(BatchingMultipleIndexPopulator batchingPopulator, IndexDescriptor descriptor)
        {
            IndexPopulator populator = mock(typeof(IndexPopulator));

            IndexProxyFactory       indexProxyFactory       = mock(typeof(IndexProxyFactory));
            FailedIndexProxyFactory failedIndexProxyFactory = mock(typeof(FailedIndexProxyFactory));
            FlippableIndexProxy     flipper = new FlippableIndexProxy();

            flipper.FlipTarget = indexProxyFactory;

            batchingPopulator.AddPopulator(populator, descriptor.WithId(1).withoutCapabilities(), flipper, failedIndexProxyFactory, "testIndex");

            return(populator);
        }
Esempio n. 11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldBeAbleToSwitchDelegate() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldBeAbleToSwitchDelegate()
        {
            // GIVEN
            IndexProxy          actual    = mockIndexProxy();
            IndexProxy          other     = mockIndexProxy();
            FlippableIndexProxy @delegate = new FlippableIndexProxy(actual);

            @delegate.FlipTarget = SingleProxy(other);

            // WHEN
            @delegate.Flip(NoOp(), null);
            @delegate.Drop();

            // THEN
            verify(other).drop();
        }
Esempio n. 12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldTransitionToFailedStateIfPopulationJobCrashes() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldTransitionToFailedStateIfPopulationJobCrashes()
        {
            // GIVEN
            IndexPopulator failingPopulator = mock(typeof(IndexPopulator));

            doThrow(new Exception("BORK BORK")).when(failingPopulator).add(any(typeof(System.Collections.ICollection)));

            FlippableIndexProxy index = new FlippableIndexProxy();

            CreateNode(map(_name, "Taylor"), _first);
            IndexPopulationJob job = NewIndexPopulationJob(failingPopulator, index, EntityType.NODE, IndexDescriptor(_first, _name, false));

            // WHEN
            job.Run();

            // THEN
            assertThat(index.State, equalTo(InternalIndexState.FAILED));
        }
Esempio n. 13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldNotBeAbleToFlipAfterDrop() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldNotBeAbleToFlipAfterDrop()
        {
            //GIVEN
            IndexProxy        actual = mockIndexProxy();
            IndexProxy        failed = mockIndexProxy();
            IndexProxyFactory indexContextFactory = mock(typeof(IndexProxyFactory));

            FlippableIndexProxy @delegate = new FlippableIndexProxy(actual);

            @delegate.FlipTarget = indexContextFactory;

            //WHEN
            @delegate.Drop();

            //THEN
            ExpectedException.expect(typeof(IndexProxyAlreadyClosedKernelException));
            @delegate.Flip(NoOp(), SingleFailedDelegate(failed));
        }
Esempio n. 14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldCloseAndFailOnFailure() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldCloseAndFailOnFailure()
        {
            CreateNode(map(_name, "irrelephant"), _first);
            LogProvider         logProvider = NullLogProvider.Instance;
            FlippableIndexProxy index       = mock(typeof(FlippableIndexProxy));
            IndexPopulator      populator   = spy(IndexPopulator(false));
            IndexPopulationJob  job         = NewIndexPopulationJob(populator, index, _indexStoreView, logProvider, EntityType.NODE, IndexDescriptor(_first, _name, false));

            string failureMessage = "not successful";

            System.InvalidOperationException failure = new System.InvalidOperationException(failureMessage);
            doThrow(failure).when(populator).create();

            // When
            job.Run();

            // Then
            verify(populator).markAsFailed(contains(failureMessage));
        }
Esempio n. 15
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldLogJobFailure() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldLogJobFailure()
        {
            // Given
            CreateNode(map(_name, "irrelephant"), _first);
            AssertableLogProvider logProvider = new AssertableLogProvider();
            FlippableIndexProxy   index       = mock(typeof(FlippableIndexProxy));
            IndexPopulator        populator   = spy(IndexPopulator(false));
            IndexPopulationJob    job         = NewIndexPopulationJob(populator, index, _indexStoreView, logProvider, EntityType.NODE, IndexDescriptor(_first, _name, false));

            Exception failure = new System.InvalidOperationException("not successful");

            doThrow(failure).when(populator).create();

            // When
            job.Run();

            // Then
            AssertableLogProvider.LogMatcherBuilder match = inLog(typeof(IndexPopulationJob));
            logProvider.AssertAtLeastOnce(match.error(@is("Failed to populate index: [:FIRST(name)]"), sameInstance(failure)));
        }
Esempio n. 16
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldVerifyConstraintsBeforeFlippingIfToldTo() throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldVerifyConstraintsBeforeFlippingIfToldTo()
        {
            // given
            IndexProxyFactory       indexProxyFactory       = mock(typeof(IndexProxyFactory));
            FailedIndexProxyFactory failedIndexProxyFactory = mock(typeof(FailedIndexProxyFactory));
            FlippableIndexProxy     flipper = new FlippableIndexProxy();

            flipper.FlipTarget = indexProxyFactory;
            IndexPopulator indexPopulator = CreateIndexPopulator();

            AddPopulator(indexPopulator, 1, flipper, failedIndexProxyFactory);
            when(indexPopulator.SampleResult()).thenReturn(new IndexSample());

            // when
            _multipleIndexPopulator.indexAllEntities();
            _multipleIndexPopulator.flipAfterPopulation(true);

            // then
            verify(indexPopulator).verifyDeferredConstraints(any(typeof(NodePropertyAccessor)));
            verify(indexPopulator).close(true);
        }
Esempio n. 17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAbortStoreScanWaitOnDrop() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAbortStoreScanWaitOnDrop()
        {
            // given the proxy structure
            FakePopulatingIndexProxy   @delegate = new FakePopulatingIndexProxy();
            FlippableIndexProxy        flipper   = new FlippableIndexProxy(@delegate);
            OtherThreadExecutor <Void> waiter    = Cleanup.add(new OtherThreadExecutor <Void>("Waiter", null));

            // and a thread stuck in the awaitStoreScanCompletion loop
            Future <object> waiting = waiter.ExecuteDontWait(state => flipper.AwaitStoreScanCompleted(0, MILLISECONDS));

            while ([email protected])
            {
                Thread.Sleep(10);
            }

            // when
            flipper.Drop();

            // then the waiting should quickly be over
            waiting.get(10, SECONDS);
        }
Esempio n. 18
0
//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);
        }
Esempio n. 19
0
 private IndexPopulation AddPopulator(MultipleIndexPopulator multipleIndexPopulator, IndexPopulator indexPopulator, int id, FlippableIndexProxy flippableIndexProxy, FailedIndexProxyFactory failedIndexProxyFactory)
 {
     return(AddPopulator(multipleIndexPopulator, TestIndexDescriptorFactory.forLabel(id, id).withId(id), indexPopulator, flippableIndexProxy, failedIndexProxyFactory));
 }
Esempio n. 20
0
 private IndexPopulation AddPopulator(IndexPopulator indexPopulator, int id, FlippableIndexProxy flippableIndexProxy, FailedIndexProxyFactory failedIndexProxyFactory)
 {
     return(AddPopulator(_multipleIndexPopulator, indexPopulator, id, flippableIndexProxy, failedIndexProxyFactory));
 }
Esempio n. 21
0
 private IndexPopulationJob NewIndexPopulationJob(IndexPopulator populator, FlippableIndexProxy flipper, IndexStoreView storeView, LogProvider logProvider, EntityType type, IndexDescriptor descriptor)
 {
     return(NewIndexPopulationJob(mock(typeof(FailedIndexProxyFactory)), populator, flipper, storeView, logProvider, type, descriptor));
 }
 internal TentativeConstraintIndexProxy(FlippableIndexProxy flipper, OnlineIndexProxy target)
 {
     this._flipper = flipper;
     this._target  = target;
 }
Esempio n. 23
0
 internal LockingIndexUpdater(FlippableIndexProxy outerInstance, IndexUpdater @delegate) : base(@delegate)
 {
     this._outerInstance = outerInstance;
     [email protected]().@lock();
 }
Esempio n. 24
0
        private IndexPopulationJob NewIndexPopulationJob(FailedIndexProxyFactory failureDelegateFactory, IndexPopulator populator, FlippableIndexProxy flipper, IndexStoreView storeView, LogProvider logProvider, EntityType type, IndexDescriptor descriptor)
        {
            long indexId = 0;

            flipper.FlipTarget = mock(typeof(IndexProxyFactory));

            MultipleIndexPopulator multiPopulator = new MultipleIndexPopulator(storeView, logProvider, type, _stateHolder);
            IndexPopulationJob     job            = new IndexPopulationJob(multiPopulator, NO_MONITOR, false);

            job.AddPopulator(populator, descriptor.WithId(indexId).withoutCapabilities(), format(":%s(%s)", _first.name(), _name), flipper, failureDelegateFactory);
            return(job);
        }
Esempio n. 25
0
 /// <summary>
 /// Adds an <seealso cref="IndexPopulator"/> to be populated in this store scan. All participating populators must
 /// be added before calling <seealso cref="run()"/>. </summary>
 ///  <param name="populator"> <seealso cref="IndexPopulator"/> to participate. </param>
 /// <param name="capableIndexDescriptor"> <seealso cref="CapableIndexDescriptor"/> meta information about index. </param>
 /// <param name="indexUserDescription"> user description of this index. </param>
 /// <param name="flipper"> <seealso cref="FlippableIndexProxy"/> to call after a successful population. </param>
 /// <param name="failedIndexProxyFactory"> <seealso cref="FailedIndexProxyFactory"/> to use after an unsuccessful population. </param>
 internal virtual MultipleIndexPopulator.IndexPopulation AddPopulator(IndexPopulator populator, CapableIndexDescriptor capableIndexDescriptor, string indexUserDescription, FlippableIndexProxy flipper, FailedIndexProxyFactory failedIndexProxyFactory)
 {
     Debug.Assert(_storeScan == null, "Population have already started, too late to add populators at this point");
     return(this._multiPopulator.addPopulator(populator, capableIndexDescriptor, flipper, failedIndexProxyFactory, indexUserDescription));
 }
Esempio n. 26
0
        internal virtual IndexPopulation AddPopulator(IndexPopulator populator, CapableIndexDescriptor capableIndexDescriptor, FlippableIndexProxy flipper, FailedIndexProxyFactory failedIndexProxyFactory, string indexUserDescription)
        {
            IndexPopulation population = CreatePopulation(populator, capableIndexDescriptor, flipper, failedIndexProxyFactory, indexUserDescription);

            Populations.Add(population);
            return(population);
        }
Esempio n. 27
0
 private MultipleIndexPopulator.IndexPopulation AddPopulator(MultipleIndexPopulator multipleIndexPopulator, StoreIndexDescriptor descriptor, IndexPopulator indexPopulator, FlippableIndexProxy flippableIndexProxy, FailedIndexProxyFactory failedIndexProxyFactory)
 {
     return(multipleIndexPopulator.AddPopulator(indexPopulator, descriptor.WithoutCapabilities(), flippableIndexProxy, failedIndexProxyFactory, "userIndexDescription"));
 }
Esempio n. 28
0
 private IndexPopulationJob NewIndexPopulationJob(IndexPopulator populator, FlippableIndexProxy flipper, EntityType type, IndexDescriptor descriptor)
 {
     return(NewIndexPopulationJob(populator, flipper, _indexStoreView, NullLogProvider.Instance, type, descriptor));
 }
Esempio n. 29
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
//ORIGINAL LINE: private org.neo4j.test.OtherThreadExecutor.WorkerCommand<Void, Void> startFlipAndWaitForLatchBeforeFinishing(final FlippableIndexProxy flippable, final java.util.concurrent.CountDownLatch triggerFinishFlip, final java.util.concurrent.CountDownLatch triggerExternalAccess)
        private OtherThreadExecutor.WorkerCommand <Void, Void> StartFlipAndWaitForLatchBeforeFinishing(FlippableIndexProxy flippable, System.Threading.CountdownEvent triggerFinishFlip, System.Threading.CountdownEvent triggerExternalAccess)
        {
            return(state =>
            {
                flippable.Flip(() =>
                {
                    triggerExternalAccess.Signal();
                    assertTrue(awaitLatch(triggerFinishFlip));
                    return true;
                }, null);
                return null;
            });
        }
Esempio n. 30
0
 private IndexPopulation CreatePopulation(IndexPopulator populator, CapableIndexDescriptor capableIndexDescriptor, FlippableIndexProxy flipper, FailedIndexProxyFactory failedIndexProxyFactory, string indexUserDescription)
 {
     return(new IndexPopulation(this, populator, capableIndexDescriptor, flipper, failedIndexProxyFactory, indexUserDescription));
 }