Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void populatorMarkedAsFailed() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void PopulatorMarkedAsFailed()
        {
            SetProperty(BATCH_SIZE_NAME, 2);

            EntityUpdates  update1   = NodeUpdates(1, PROPERTY_ID, "aaa", LABEL_ID);
            EntityUpdates  update2   = NodeUpdates(1, PROPERTY_ID, "bbb", LABEL_ID);
            IndexStoreView storeView = NewStoreView(update1, update2);

            Exception batchFlushError = new Exception("Batch failed");

            IndexPopulator  populator;
            ExecutorService executor = Executors.newSingleThreadExecutor();

            try
            {
                BatchingMultipleIndexPopulator batchingPopulator = new BatchingMultipleIndexPopulator(storeView, executor, NullLogProvider.Instance, mock(typeof(SchemaState)));

                populator = AddPopulator(batchingPopulator, _index1);
                IList <IndexEntryUpdate <IndexDescriptor> > expected = ForUpdates(_index1, update1, update2);
                doThrow(batchFlushError).when(populator).add(expected);

                batchingPopulator.IndexAllEntities().run();
            }
            finally
            {
                executor.shutdown();
                executor.awaitTermination(1, TimeUnit.MINUTES);
            }

            verify(populator).markAsFailed(failure(batchFlushError).asString());
        }
//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());
        }
Example #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void populatorMarkedAsFailedAndUpdatesNotAdded() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void PopulatorMarkedAsFailedAndUpdatesNotAdded()
        {
            SetProperty(BATCH_SIZE_NAME, 2);

            EntityUpdates  update1   = NodeUpdates(1, PROPERTY_ID, "aaa", LABEL_ID);
            EntityUpdates  update2   = NodeUpdates(1, PROPERTY_ID, "bbb", LABEL_ID);
            EntityUpdates  update3   = NodeUpdates(1, PROPERTY_ID, "ccc", LABEL_ID);
            EntityUpdates  update4   = NodeUpdates(1, PROPERTY_ID, "ddd", LABEL_ID);
            EntityUpdates  update5   = NodeUpdates(1, PROPERTY_ID, "eee", LABEL_ID);
            IndexStoreView storeView = NewStoreView(update1, update2, update3, update4, update5);

            Exception batchFlushError = new Exception("Batch failed");

            BatchingMultipleIndexPopulator batchingPopulator = new BatchingMultipleIndexPopulator(storeView, SameThreadExecutor(), NullLogProvider.Instance, mock(typeof(SchemaState)));

            IndexPopulator populator = AddPopulator(batchingPopulator, _index1);

            doThrow(batchFlushError).when(populator).add(ForUpdates(_index1, update3, update4));

            batchingPopulator.IndexAllEntities().run();

            verify(populator).add(ForUpdates(_index1, update1, update2));
            verify(populator).add(ForUpdates(_index1, update3, update4));
            verify(populator).markAsFailed(failure(batchFlushError).asString());
            verify(populator, never()).add(ForUpdates(_index1, update5));
        }
Example #4
0
 public IndexSamplingControllerFactory(IndexSamplingConfig config, IndexStoreView storeView, JobScheduler scheduler, TokenNameLookup tokenNameLookup, LogProvider logProvider)
 {
     this._config          = config;
     this._storeView       = storeView;
     this._scheduler       = scheduler;
     this._tokenNameLookup = tokenNameLookup;
     this._logProvider     = logProvider;
 }
Example #5
0
 internal IndexProxyCreator(IndexSamplingConfig samplingConfig, IndexStoreView storeView, IndexProviderMap providerMap, TokenNameLookup tokenNameLookup, LogProvider logProvider)
 {
     this._samplingConfig  = samplingConfig;
     this._storeView       = storeView;
     this._providerMap     = providerMap;
     this._tokenNameLookup = tokenNameLookup;
     this._logProvider     = logProvider;
 }
Example #6
0
        private IndexSamplingJob CreateIndexSamplingJob(IndexAccessor fusionAccessor)
        {
            IndexStoreView                storeView  = Org.Neo4j.Kernel.Impl.Api.index.IndexStoreView_Fields.Empty;
            IndexProxyAdapter             indexProxy = new IndexProxyAdapterAnonymousInnerClass(this, fusionAccessor);
            OnlineIndexSamplingJobFactory onlineIndexSamplingJobFactory = new OnlineIndexSamplingJobFactory(storeView, simpleNameLookup, Instance);

            return(onlineIndexSamplingJobFactory.Create(1, indexProxy));
        }
 internal OnlineIndexSamplingJob(long indexId, IndexProxy indexProxy, IndexStoreView storeView, string indexUserDescription, LogProvider logProvider)
 {
     this._indexId              = indexId;
     this._indexProxy           = indexProxy;
     this._storeView            = storeView;
     this._log                  = logProvider.getLog(this.GetType());
     this._indexUserDescription = indexUserDescription;
 }
 public MultipleIndexPopulator(IndexStoreView storeView, LogProvider logProvider, EntityType type, SchemaState schemaState)
 {
     this._storeView    = storeView;
     this._logProvider  = logProvider;
     this.Log           = logProvider.GetLog(typeof(IndexPopulationJob));
     this._type         = type;
     this._schemaState  = schemaState;
     this._phaseTracker = new LoggingPhaseTracker(logProvider.GetLog(typeof(IndexPopulationJob)));
 }
 /// <summary>
 /// Creates a new multi-threaded populator for the given store view. </summary>
 ///  <param name="storeView"> the view of the store as a visitable of nodes </param>
 /// <param name="logProvider"> the log provider </param>
 /// <param name="type"> entity type to populate </param>
 /// <param name="schemaState"> the schema state </param>
 internal BatchingMultipleIndexPopulator(IndexStoreView storeView, LogProvider logProvider, EntityType type, SchemaState schemaState) : base(storeView, logProvider, type, schemaState)
 {
     if (!InstanceFieldsInitialized)
     {
         InitializeInstanceFields();
         InstanceFieldsInitialized = true;
     }
     this._executor = CreateThreadPool();
 }
 /// <summary>
 /// Creates a new multi-threaded populator with the specified thread pool.
 /// <para>
 /// <b>NOTE:</b> for testing only.
 ///
 /// </para>
 /// </summary>
 /// <param name="storeView"> the view of the store as a visitable of nodes </param>
 /// <param name="executor"> the thread pool to use for batched index insertions </param>
 /// <param name="logProvider"> the log provider </param>
 /// <param name="schemaState"> the schema state </param>
 internal BatchingMultipleIndexPopulator(IndexStoreView storeView, ExecutorService executor, LogProvider logProvider, SchemaState schemaState) : base(storeView, logProvider, EntityType.NODE, schemaState)
 {
     if (!InstanceFieldsInitialized)
     {
         InitializeInstanceFields();
         InstanceFieldsInitialized = true;
     }
     this._executor = executor;
 }
Example #11
0
 internal OnlineIndexProxy(CapableIndexDescriptor capableIndexDescriptor, IndexAccessor accessor, IndexStoreView storeView, bool forcedIdempotentMode)
 {
     Debug.Assert(accessor != null);
     this._indexId = capableIndexDescriptor.Id;
     this._capableIndexDescriptor = capableIndexDescriptor;
     this.Accessor              = accessor;
     this._storeView            = storeView;
     this._forcedIdempotentMode = forcedIdempotentMode;
     this._indexCountsRemover   = new IndexCountsRemover(storeView, _indexId);
 }
Example #12
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") private static IndexStoreView newStoreView(EntityUpdates... updates)
        private static IndexStoreView NewStoreView(params EntityUpdates[] updates)
        {
            IndexStoreView storeView = mock(typeof(IndexStoreView));

            when(storeView.VisitNodes(any(), any(), any(), any(), anyBoolean())).thenAnswer(invocation =>
            {
                Visitor <EntityUpdates, IndexPopulationFailedKernelException> visitorArg = invocation.getArgument(2);
                return(new IndexEntryUpdateScan(updates, visitorArg));
            });
            return(storeView);
        }
Example #13
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeEach void before() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        internal virtual void Before()
        {
            _directory = new RAMDirectory();
            DirectoryFactory directoryFactory = new Org.Neo4j.Kernel.Api.Impl.Index.storage.DirectoryFactory_Single(new Org.Neo4j.Kernel.Api.Impl.Index.storage.DirectoryFactory_UncloseableDirectory(_directory));

            _provider       = new LuceneIndexProvider(_fs, directoryFactory, defaultDirectoryStructure(_testDir.directory("folder")), IndexProvider.Monitor_Fields.EMPTY, Config.defaults(), OperationalMode.single);
            _indexStoreView = mock(typeof(IndexStoreView));
            IndexSamplingConfig samplingConfig = new IndexSamplingConfig(Config.defaults());

            _index          = IndexDescriptorFactory.forSchema(forLabel(42, PROPERTY_KEY_ID), _provider.ProviderDescriptor).withId(0);
            _indexPopulator = _provider.getPopulator(_index, samplingConfig, heapBufferFactory(1024));
            _indexPopulator.create();
        }
Example #14
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void before() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void Before()
        {
            _db             = ( GraphDatabaseAPI )(new TestGraphDatabaseFactory()).newImpermanentDatabaseBuilder().setConfig(GraphDatabaseSettings.record_id_batch_size, "1").newGraphDatabase();
            _kernel         = _db.DependencyResolver.resolveDependency(typeof(Kernel));
            _stateHolder    = new DatabaseSchemaState(NullLogProvider.Instance);
            _indexStoreView = _indexStoreView();

            using (Transaction tx = _kernel.beginTransaction(@implicit, AUTH_DISABLED))
            {
                _labelId = tx.TokenWrite().labelGetOrCreateForName(_first.name());
                tx.TokenWrite().labelGetOrCreateForName(_second.name());
                tx.Success();
            }
        }
Example #15
0
        public RecordStorageEngine(DatabaseLayout databaseLayout, Config config, PageCache pageCache, FileSystemAbstraction fs, LogProvider logProvider, LogProvider userLogProvider, TokenHolders tokenHolders, SchemaState schemaState, ConstraintSemantics constraintSemantics, JobScheduler scheduler, TokenNameLookup tokenNameLookup, LockService lockService, IndexProviderMap indexProviderMap, IndexingService.Monitor indexingServiceMonitor, DatabaseHealth databaseHealth, ExplicitIndexProvider explicitIndexProvider, IndexConfigStore indexConfigStore, IdOrderingQueue explicitIndexTransactionOrdering, IdGeneratorFactory idGeneratorFactory, IdController idController, Monitors monitors, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, OperationalMode operationalMode, VersionContextSupplier versionContextSupplier)
        {
            this._tokenHolders   = tokenHolders;
            this._schemaState    = schemaState;
            this._lockService    = lockService;
            this._databaseHealth = databaseHealth;
            this._explicitIndexProviderLookup      = explicitIndexProvider;
            this._indexConfigStore                 = indexConfigStore;
            this._constraintSemantics              = constraintSemantics;
            this._explicitIndexTransactionOrdering = explicitIndexTransactionOrdering;

            this._idController = idController;
            StoreFactory factory = new StoreFactory(databaseLayout, config, idGeneratorFactory, pageCache, fs, logProvider, versionContextSupplier);

            _neoStores = factory.OpenAllNeoStores(true);

            try
            {
                _schemaCache   = new SchemaCache(constraintSemantics, Collections.emptyList(), indexProviderMap);
                _schemaStorage = new SchemaStorage(_neoStores.SchemaStore);

                NeoStoreIndexStoreView neoStoreIndexStoreView = new NeoStoreIndexStoreView(lockService, _neoStores);
                bool readOnly = config.Get(GraphDatabaseSettings.read_only) && operationalMode == OperationalMode.single;
                monitors.AddMonitorListener(new LoggingMonitor(logProvider.GetLog(typeof(NativeLabelScanStore))));
                _labelScanStore = new NativeLabelScanStore(pageCache, databaseLayout, fs, new FullLabelStream(neoStoreIndexStoreView), readOnly, monitors, recoveryCleanupWorkCollector);

                _indexStoreView        = new DynamicIndexStoreView(neoStoreIndexStoreView, _labelScanStore, lockService, _neoStores, logProvider);
                this._indexProviderMap = indexProviderMap;
                _indexingService       = IndexingServiceFactory.createIndexingService(config, scheduler, indexProviderMap, _indexStoreView, tokenNameLookup, Iterators.asList(_schemaStorage.loadAllSchemaRules()), logProvider, userLogProvider, indexingServiceMonitor, schemaState, readOnly);

                _integrityValidator = new IntegrityValidator(_neoStores, _indexingService);
                _cacheAccess        = new BridgingCacheAccess(_schemaCache, schemaState, tokenHolders);

                _explicitIndexApplierLookup = new Org.Neo4j.Kernel.Impl.Api.ExplicitIndexApplierLookup_Direct(explicitIndexProvider);

                _labelScanStoreSync = new WorkSync <Supplier <LabelScanWriter>, LabelUpdateWork>(_labelScanStore.newWriter);

                _commandReaderFactory = new RecordStorageCommandReaderFactory();
                _indexUpdatesSync     = new WorkSync <IndexingUpdateService, IndexUpdatesWork>(_indexingService);

                _denseNodeThreshold = config.Get(GraphDatabaseSettings.dense_node_threshold);
                _recordIdBatchSize  = config.Get(GraphDatabaseSettings.record_id_batch_size);
            }
            catch (Exception failure)
            {
                _neoStores.close();
                throw failure;
            }
        }
Example #16
0
        private LabelScanStore StartLabelScanStore(PageCache pageCache, IndexStoreView indexStoreView, Monitors monitors, bool readOnly)
        {
            NativeLabelScanStore labelScanStore = new NativeLabelScanStore(pageCache, _directory.databaseLayout(), _fileSystem, new FullLabelStream(indexStoreView), readOnly, monitors, RecoveryCleanupWorkCollector.immediate());

            try
            {
                labelScanStore.Init();
                labelScanStore.Start();
            }
            catch (IOException e)
            {
                throw new UncheckedIOException(e);
            }
            return(labelScanStore);
        }
Example #17
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void batchIsFlushedWhenThresholdReached() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void BatchIsFlushedWhenThresholdReached()
        {
            SetProperty(BATCH_SIZE_NAME, 2);

            EntityUpdates  update1   = NodeUpdates(1, PROPERTY_ID, "foo", LABEL_ID);
            EntityUpdates  update2   = NodeUpdates(2, PROPERTY_ID, "bar", LABEL_ID);
            EntityUpdates  update3   = NodeUpdates(3, PROPERTY_ID, "baz", LABEL_ID);
            IndexStoreView storeView = NewStoreView(update1, update2, update3);

            BatchingMultipleIndexPopulator batchingPopulator = new BatchingMultipleIndexPopulator(storeView, SameThreadExecutor(), NullLogProvider.Instance, mock(typeof(SchemaState)));

            IndexPopulator populator = AddPopulator(batchingPopulator, _index1);

            batchingPopulator.IndexAllEntities().run();

            verify(populator).add(ForUpdates(_index1, update1, update2));
            verify(populator).add(ForUpdates(_index1, update3));
        }
Example #18
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void pendingBatchesFlushedAfterStoreScan() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void PendingBatchesFlushedAfterStoreScan()
        {
            EntityUpdates  update1   = NodeUpdates(1, PROPERTY_ID, "foo", LABEL_ID);
            EntityUpdates  update2   = NodeUpdates(2, PROPERTY_ID, "bar", LABEL_ID);
            EntityUpdates  update3   = NodeUpdates(3, PROPERTY_ID, "baz", LABEL_ID);
            EntityUpdates  update42  = NodeUpdates(4, 42, "42", 42);
            IndexStoreView storeView = NewStoreView(update1, update2, update3, update42);

            BatchingMultipleIndexPopulator batchingPopulator = new BatchingMultipleIndexPopulator(storeView, SameThreadExecutor(), NullLogProvider.Instance, mock(typeof(SchemaState)));

            IndexPopulator populator1  = AddPopulator(batchingPopulator, _index1);
            IndexPopulator populator42 = AddPopulator(batchingPopulator, _index42);

            batchingPopulator.IndexAllEntities().run();

            verify(populator1).add(ForUpdates(_index1, update1, update2, update3));
            verify(populator42).add(ForUpdates(_index42, update42));
        }
Example #19
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldApplyBatchesInParallel() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldApplyBatchesInParallel()
        {
            // given
            SetProperty(BATCH_SIZE_NAME, 2);
            EntityUpdates[] updates = new EntityUpdates[9];
            for (int i = 0; i < updates.Length; i++)
            {
                updates[i] = NodeUpdates(i, PROPERTY_ID, i.ToString(), LABEL_ID);
            }
            IndexStoreView  storeView = NewStoreView(updates);
            ExecutorService executor  = SameThreadExecutor();
            BatchingMultipleIndexPopulator batchingPopulator = new BatchingMultipleIndexPopulator(storeView, executor, NullLogProvider.Instance, mock(typeof(SchemaState)));

            AddPopulator(batchingPopulator, _index1);

            // when
            batchingPopulator.IndexAllEntities().run();

            // then
            verify(executor, atLeast(5)).execute(any(typeof(ThreadStart)));
        }
Example #20
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void executorShutdownAfterStoreScanCompletes() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ExecutorShutdownAfterStoreScanCompletes()
        {
            EntityUpdates  update    = NodeUpdates(1, PROPERTY_ID, "foo", LABEL_ID);
            IndexStoreView storeView = NewStoreView(update);

            ExecutorService executor = ImmediateExecutor();

            when(executor.awaitTermination(anyLong(), any())).thenReturn(true);

            BatchingMultipleIndexPopulator batchingPopulator = new BatchingMultipleIndexPopulator(storeView, executor, NullLogProvider.Instance, mock(typeof(SchemaState)));

            StoreScan <IndexPopulationFailedKernelException> storeScan = batchingPopulator.IndexAllEntities();

            verify(executor, never()).shutdown();

            storeScan.Run();
            verify(executor, never()).shutdown();
            verify(executor, never()).awaitTermination(anyLong(), any());

            batchingPopulator.Close(true);
            verify(executor).shutdown();
            verify(executor).awaitTermination(anyLong(), any());
        }
Example #21
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);
        }
Example #22
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test @SuppressWarnings("unchecked") public void executorForcefullyShutdownIfStoreScanFails() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ExecutorForcefullyShutdownIfStoreScanFails()
        {
            IndexStoreView        storeView        = mock(typeof(IndexStoreView));
            StoreScan <Exception> failingStoreScan = mock(typeof(StoreScan));
            Exception             scanError        = new Exception();

            doThrow(scanError).when(failingStoreScan).run();
            when(storeView.VisitNodes(any(), any(), any(), any(), anyBoolean())).thenReturn(failingStoreScan);

            ExecutorService executor = ImmediateExecutor();

            when(executor.awaitTermination(anyLong(), any())).thenReturn(true);

            BatchingMultipleIndexPopulator batchingPopulator = new BatchingMultipleIndexPopulator(storeView, executor, NullLogProvider.Instance, mock(typeof(SchemaState)));

            StoreScan <IndexPopulationFailedKernelException> storeScan = batchingPopulator.IndexAllEntities();

            verify(executor, never()).shutdown();

            try
            {
                storeScan.Run();
                fail("Exception expected");
            }
            catch (Exception t)
            {
                assertSame(scanError, t);
            }

            verify(executor, never()).shutdownNow();
            verify(executor, never()).awaitTermination(anyLong(), any());

            batchingPopulator.Close(false);
            verify(executor).shutdownNow();
            verify(executor).awaitTermination(anyLong(), any());
        }
Example #23
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: public IndexCountsRemover(final IndexStoreView storeView, final long indexId)
        public IndexCountsRemover(IndexStoreView storeView, long indexId)
        {
            this._storeView = storeView;
            this._indexId   = indexId;
        }
 public OnlineIndexSamplingJobFactory(IndexStoreView storeView, TokenNameLookup nameLookup, LogProvider logProvider)
 {
     this._storeView   = storeView;
     this._logProvider = logProvider;
     this._nameLookup  = nameLookup;
 }
Example #25
0
 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));
 }
Example #26
0
 public abstract MultipleIndexPopulator Create(IndexStoreView storeView, LogProvider logProvider, EntityType type, SchemaState schemaState);
Example #27
0
 public UpdateCountingIndexUpdater(IndexStoreView storeView, long indexId, IndexUpdater @delegate)
 {
     this._storeView = storeView;
     this._indexId   = indexId;
     this.@delegate  = @delegate;
 }
Example #28
0
        public static IndexingService CreateIndexingService(Config config, JobScheduler scheduler, IndexProviderMap providerMap, IndexStoreView storeView, TokenNameLookup tokenNameLookup, IEnumerable <SchemaRule> schemaRules, LogProvider internalLogProvider, LogProvider userLogProvider, IndexingService.Monitor monitor, SchemaState schemaState, bool readOnly)
        {
            IndexSamplingConfig            samplingConfig        = new IndexSamplingConfig(config);
            MultiPopulatorFactory          multiPopulatorFactory = MultiPopulatorFactory.ForConfig(config);
            IndexMapReference              indexMapRef           = new IndexMapReference();
            IndexSamplingControllerFactory factory = new IndexSamplingControllerFactory(samplingConfig, storeView, scheduler, tokenNameLookup, internalLogProvider);
            IndexSamplingController        indexSamplingController = factory.Create(indexMapRef);
            IndexProxyCreator              proxySetup = new IndexProxyCreator(samplingConfig, storeView, providerMap, tokenNameLookup, internalLogProvider);

            return(new IndexingService(proxySetup, providerMap, indexMapRef, storeView, schemaRules, indexSamplingController, tokenNameLookup, scheduler, schemaState, multiPopulatorFactory, internalLogProvider, userLogProvider, monitor, readOnly));
        }
Example #29
0
 private OnlineIndexProxy OnlineIndexProxy(IndexStoreView storeView)
 {
     return(new OnlineIndexProxy(DummyMeta(), Org.Neo4j.Kernel.Api.Index.IndexAccessor_Fields.Empty, storeView, false));
 }
Example #30
0
 public override MultipleIndexPopulator Create(IndexStoreView storeView, LogProvider logProvider, EntityType type, SchemaState schemaState)
 {
     return(new BatchingMultipleIndexPopulator(storeView, logProvider, type, schemaState));
 }