private DynamicIndexStoreView DynamicIndexStoreViewWrapper(ThreadStart customAction, NeoStores neoStores, LabelScanStore labelScanStore)
        {
            LockService            locks = LockService.NO_LOCK_SERVICE;
            NeoStoreIndexStoreView neoStoreIndexStoreView = new NeoStoreIndexStoreView(locks, neoStores);

            return(new DynamicIndexStoreViewWrapper(this, neoStoreIndexStoreView, labelScanStore, locks, neoStores, customAction));
        }
Beispiel #2
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;
            }
        }
Beispiel #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void populateFromQueuePopulatesWhenThresholdReached() throws Exception
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void PopulateFromQueuePopulatesWhenThresholdReached()
        {
            SetProperty(QUEUE_THRESHOLD_NAME, 2);

            NeoStores neoStores = mock(typeof(NeoStores));
            NodeStore nodeStore = mock(typeof(NodeStore));

            when(neoStores.NodeStore).thenReturn(nodeStore);

            NeoStoreIndexStoreView         storeView         = new NeoStoreIndexStoreView(LockService.NO_LOCK_SERVICE, neoStores);
            BatchingMultipleIndexPopulator batchingPopulator = new BatchingMultipleIndexPopulator(storeView, ImmediateExecutor(), NullLogProvider.Instance, mock(typeof(SchemaState)));

            IndexPopulator populator1 = AddPopulator(batchingPopulator, _index1);
            IndexUpdater   updater1   = mock(typeof(IndexUpdater));

            when(populator1.NewPopulatingUpdater(any())).thenReturn(updater1);

            IndexPopulator populator2 = AddPopulator(batchingPopulator, _index42);
            IndexUpdater   updater2   = mock(typeof(IndexUpdater));

            when(populator2.NewPopulatingUpdater(any())).thenReturn(updater2);

            batchingPopulator.IndexAllEntities();
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.kernel.api.index.IndexEntryUpdate<?> update1 = add(1, index1.schema(), "foo");
            IndexEntryUpdate <object> update1 = add(1, _index1.schema(), "foo");
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.kernel.api.index.IndexEntryUpdate<?> update2 = add(2, index42.schema(), "bar");
            IndexEntryUpdate <object> update2 = add(2, _index42.schema(), "bar");
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: org.neo4j.kernel.api.index.IndexEntryUpdate<?> update3 = add(3, index1.schema(), "baz");
            IndexEntryUpdate <object> update3 = add(3, _index1.schema(), "baz");

            batchingPopulator.QueueUpdate(update1);
            batchingPopulator.QueueUpdate(update2);
            batchingPopulator.QueueUpdate(update3);

            batchingPopulator.PopulateFromQueueBatched(42);

            verify(updater1).process(update1);
            verify(updater1).process(update3);
            verify(updater2).process(update2);
        }
Beispiel #4
0
        private DirectStoreAccess DirectStoreAccess(bool readOnly)
        {
            if (_directStoreAccess == null)
            {
                _life.start();
                JobScheduler scheduler = _life.add(JobSchedulerFactory.createInitialisedScheduler());
                _fileSystem = new DefaultFileSystemAbstraction();
                PageCache   pageCache   = GetPageCache(_fileSystem);
                LogProvider logProvider = NullLogProvider.Instance;
                Config      config      = Config.defaults(GraphDatabaseSettings.read_only, readOnly ? TRUE : FALSE);
                DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(_fileSystem);
                StoreFactory storeFactory = new StoreFactory(_directory.databaseLayout(), config, idGeneratorFactory, pageCache, _fileSystem, logProvider, EmptyVersionContextSupplier.EMPTY);
                _neoStore = storeFactory.OpenAllNeoStores();
                StoreAccess nativeStores;
                if (_keepStatistics)
                {
                    AccessStatistics accessStatistics = new AccessStatistics();
                    _statistics  = new VerboseStatistics(accessStatistics, new DefaultCounts(defaultConsistencyCheckThreadsNumber()), NullLog.Instance);
                    nativeStores = new AccessStatsKeepingStoreAccess(_neoStore, accessStatistics);
                }
                else
                {
                    _statistics  = Statistics.NONE;
                    nativeStores = new StoreAccess(_neoStore);
                }
                nativeStores.Initialize();

                IndexStoreView indexStoreView = new NeoStoreIndexStoreView(LockService.NO_LOCK_SERVICE, nativeStores.RawNeoStores);

                Monitors         monitors       = new Monitors();
                LabelScanStore   labelScanStore = StartLabelScanStore(pageCache, indexStoreView, monitors, readOnly);
                IndexProviderMap indexes        = CreateIndexes(pageCache, _fileSystem, _directory.databaseDir(), config, scheduler, logProvider, monitors);
                TokenHolders     tokenHolders   = new TokenHolders(new DelegatingTokenHolder(new ReadOnlyTokenCreator(), Org.Neo4j.Kernel.impl.core.TokenHolder_Fields.TYPE_PROPERTY_KEY), new DelegatingTokenHolder(new ReadOnlyTokenCreator(), Org.Neo4j.Kernel.impl.core.TokenHolder_Fields.TYPE_LABEL), new DelegatingTokenHolder(new ReadOnlyTokenCreator(), Org.Neo4j.Kernel.impl.core.TokenHolder_Fields.TYPE_RELATIONSHIP_TYPE));
                tokenHolders.PropertyKeyTokens().InitialTokens      = _neoStore.PropertyKeyTokenStore.Tokens;
                tokenHolders.LabelTokens().InitialTokens            = _neoStore.LabelTokenStore.Tokens;
                tokenHolders.RelationshipTypeTokens().InitialTokens = _neoStore.RelationshipTypeTokenStore.Tokens;
                _directStoreAccess = new DirectStoreAccess(nativeStores, labelScanStore, indexes, tokenHolders);
            }
            return(_directStoreAccess);
        }
 internal DynamicIndexStoreViewWrapper(MultiIndexPopulationConcurrentUpdatesIT outerInstance, NeoStoreIndexStoreView neoStoreIndexStoreView, LabelScanStore labelScanStore, LockService locks, NeoStores neoStores, ThreadStart customAction) : base(neoStoreIndexStoreView, labelScanStore, locks, neoStores, NullLogProvider.Instance)
 {
     this._outerInstance = outerInstance;
     this.CustomAction   = customAction;
     this.NeoStores      = neoStores;
 }