Пример #1
0
        private IndexProviderMap CreateIndexes(PageCache pageCache, FileSystemAbstraction fileSystem, File storeDir, Config config, JobScheduler scheduler, LogProvider logProvider, Monitors monitors)
        {
            LogService               logService   = new SimpleLogService(logProvider, logProvider);
            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));
            DatabaseKernelExtensions extensions   = _life.add(instantiateKernelExtensions(storeDir, fileSystem, config, logService, pageCache, scheduler, RecoveryCleanupWorkCollector.ignore(), DatabaseInfo.COMMUNITY, monitors, tokenHolders));

            return(_life.add(new DefaultIndexProviderMap(extensions, config)));
        }
Пример #2
0
 internal ConsistencyCheckTasks(ProgressMonitorFactory.MultiPartBuilder multiPartBuilder, StoreProcessor defaultProcessor, StoreAccess nativeStores, Statistics statistics, CacheAccess cacheAccess, LabelScanStore labelScanStore, IndexAccessors indexes, TokenHolders tokenHolders, MultiPassStore.Factory multiPass, ConsistencyReporter reporter, int numberOfThreads)
 {
     this._multiPartBuilder = multiPartBuilder;
     this._defaultProcessor = defaultProcessor;
     this._nativeStores     = nativeStores;
     this._statistics       = statistics;
     this._cacheAccess      = cacheAccess;
     this._tokenHolders     = tokenHolders;
     this._multiPass        = multiPass;
     this._reporter         = reporter;
     this._labelScanStore   = labelScanStore;
     this._indexes          = indexes;
     this._numberOfThreads  = numberOfThreads;
 }
Пример #3
0
        internal ModularDatabaseCreationContext(string databaseName, PlatformModule platformModule, DatabaseEditionContext editionContext, Procedures procedures, GraphDatabaseFacade facade)
        {
            this._databaseName = databaseName;
            this._config       = platformModule.Config;
            DatabaseIdContext idContext = editionContext.IdContext;

            this._idGeneratorFactory = idContext.IdGeneratorFactory;
            this._idController       = idContext.IdController;
            this._databaseLayout     = platformModule.StoreLayout.databaseLayout(databaseName);
            this._logService         = platformModule.Logging;
            this._scheduler          = platformModule.JobScheduler;
            this._globalDependencies = platformModule.Dependencies;
            this._tokenHolders       = editionContext.CreateTokenHolders();
            this._tokenNameLookup    = new NonTransactionalTokenNameLookup(_tokenHolders);
            this._locks = editionContext.CreateLocks();
            this._statementLocksFactory    = editionContext.CreateStatementLocksFactory();
            this._schemaWriteGuard         = editionContext.SchemaWriteGuard;
            this._transactionEventHandlers = new TransactionEventHandlers(facade);
            this._monitors = new Monitors(platformModule.Monitors);
            this._indexingServiceMonitor = _monitors.newMonitor(typeof(IndexingService.Monitor));
            this._physicalLogMonitor     = _monitors.newMonitor(typeof(LogFileCreationMonitor));
            this._fs = platformModule.FileSystem;
            this._transactionStats = editionContext.CreateTransactionMonitor();
            this._databaseHealth   = new DatabaseHealth(platformModule.PanicEventGenerator, _logService.getInternalLog(typeof(DatabaseHealth)));
            this._transactionHeaderInformationFactory = editionContext.HeaderInformationFactory;
            this._commitProcessFactory  = editionContext.CommitProcessFactory;
            this._autoIndexing          = new InternalAutoIndexing(platformModule.Config, _tokenHolders.propertyKeyTokens());
            this._indexConfigStore      = new IndexConfigStore(_databaseLayout, _fs);
            this._explicitIndexProvider = new DefaultExplicitIndexProvider();
            this._pageCache             = platformModule.PageCache;
            this._constraintSemantics   = editionContext.ConstraintSemantics;
            this._tracers    = platformModule.Tracers;
            this._procedures = procedures;
            this._ioLimiter  = editionContext.IoLimiter;
            this._clock      = platformModule.Clock;
            this._databaseAvailabilityGuard    = editionContext.CreateDatabaseAvailabilityGuard(_clock, _logService, _config);
            this._databaseAvailability         = new DatabaseAvailability(_databaseAvailabilityGuard, _transactionStats, platformModule.Clock, AwaitActiveTransactionDeadlineMillis);
            this._coreAPIAvailabilityGuard     = new CoreAPIAvailabilityGuard(_databaseAvailabilityGuard, editionContext.TransactionStartTimeout);
            this._accessCapability             = editionContext.AccessCapability;
            this._storeCopyCheckPointMutex     = new StoreCopyCheckPointMutex();
            this._recoveryCleanupWorkCollector = platformModule.RecoveryCleanupWorkCollector;
            this._databaseInfo               = platformModule.DatabaseInfo;
            this._versionContextSupplier     = platformModule.VersionContextSupplier;
            this._collectionsFactorySupplier = platformModule.CollectionsFactorySupplier;
            this._kernelExtensionFactories   = platformModule.KernelExtensionFactories;
            this._watcherServiceFactory      = editionContext.WatcherServiceFactory;
            this._facade          = facade;
            this._engineProviders = platformModule.EngineProviders;
        }
Пример #4
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;
            }
        }
Пример #5
0
        internal FulltextIndexProvider(IndexProviderDescriptor descriptor, IndexDirectoryStructure.Factory directoryStructureFactory, FileSystemAbstraction fileSystem, Config config, TokenHolders tokenHolders, DirectoryFactory directoryFactory, OperationalMode operationalMode, JobScheduler scheduler, AuxiliaryTransactionStateManager auxiliaryTransactionStateManager, Log log) : base(descriptor, directoryStructureFactory)
        {
            this._fileSystem      = fileSystem;
            this._config          = config;
            this._tokenHolders    = tokenHolders;
            this._operationalMode = operationalMode;
            this._auxiliaryTransactionStateManager = auxiliaryTransactionStateManager;
            this._log = log;

            _defaultAnalyzerName = config.Get(FulltextConfig.FulltextDefaultAnalyzer);
            _defaultEventuallyConsistentSetting = Convert.ToString(config.Get(FulltextConfig.EventuallyConsistent));
            _indexUpdateSink     = new IndexUpdateSink(scheduler, config.Get(FulltextConfig.EventuallyConsistentIndexUpdateQueueMaxLength));
            _openOnlineAccessors = new ConcurrentDictionary <StoreIndexDescriptor, FulltextIndexAccessor>();
            _indexStorageFactory = BuildIndexStorageFactory(fileSystem, directoryFactory);
        }
Пример #6
0
 internal RecordStorageReader(TokenHolders tokenHolders, SchemaStorage schemaStorage, NeoStores neoStores, IndexingService indexService, SchemaCache schemaCache, System.Func <IndexReaderFactory> indexReaderFactory, System.Func <LabelScanReader> labelScanReaderSupplier, RecordStorageCommandCreationContext commandCreationContext)
 {
     this._tokenHolders           = tokenHolders;
     this._neoStores              = neoStores;
     this._schemaStorage          = schemaStorage;
     this._indexService           = indexService;
     this._nodeStore              = neoStores.NodeStore;
     this._relationshipStore      = neoStores.RelationshipStore;
     this._relationshipGroupStore = neoStores.RelationshipGroupStore;
     this._propertyStore          = neoStores.PropertyStore;
     this._counts      = neoStores.Counts;
     this._schemaCache = schemaCache;
     this._indexReaderFactorySupplier = indexReaderFactory;
     this._labelScanReaderSupplier    = labelScanReaderSupplier;
     this._commandCreationContext     = commandCreationContext;
 }
Пример #7
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);
        }
Пример #8
0
 public KernelTransactions(Config config, StatementLocksFactory statementLocksFactory, ConstraintIndexCreator constraintIndexCreator, StatementOperationParts statementOperations, SchemaWriteGuard schemaWriteGuard, TransactionHeaderInformationFactory txHeaderFactory, TransactionCommitProcess transactionCommitProcess, AuxiliaryTransactionStateManager auxTxStateManager, TransactionHooks hooks, TransactionMonitor transactionMonitor, AvailabilityGuard databaseAvailabilityGuard, Tracers tracers, StorageEngine storageEngine, Procedures procedures, TransactionIdStore transactionIdStore, SystemNanoClock clock, AtomicReference <CpuClock> cpuClockRef, AtomicReference <HeapAllocation> heapAllocationRef, AccessCapability accessCapability, AutoIndexing autoIndexing, ExplicitIndexStore explicitIndexStore, VersionContextSupplier versionContextSupplier, CollectionsFactorySupplier collectionsFactorySupplier, ConstraintSemantics constraintSemantics, SchemaState schemaState, IndexingService indexingService, TokenHolders tokenHolders, string currentDatabaseName, Dependencies dataSourceDependencies)
 {
     if (!InstanceFieldsInitialized)
     {
         InitializeInstanceFields();
         InstanceFieldsInitialized = true;
     }
     this._config = config;
     this._statementLocksFactory  = statementLocksFactory;
     this._constraintIndexCreator = constraintIndexCreator;
     this._statementOperations    = statementOperations;
     this._schemaWriteGuard       = schemaWriteGuard;
     this._transactionHeaderInformationFactory = txHeaderFactory;
     this._transactionCommitProcess            = transactionCommitProcess;
     this._auxTxStateManager         = auxTxStateManager;
     this._hooks                     = hooks;
     this._transactionMonitor        = transactionMonitor;
     this._databaseAvailabilityGuard = databaseAvailabilityGuard;
     this._tracers                   = tracers;
     this._storageEngine             = storageEngine;
     this._procedures                = procedures;
     this._transactionIdStore        = transactionIdStore;
     this._cpuClockRef               = cpuClockRef;
     this._heapAllocationRef         = heapAllocationRef;
     this._accessCapability          = accessCapability;
     this._autoIndexing              = autoIndexing;
     this._explicitIndexStore        = explicitIndexStore;
     this._indexingService           = indexingService;
     this._tokenHolders              = tokenHolders;
     this._currentDatabaseName       = currentDatabaseName;
     this._dataSourceDependencies    = dataSourceDependencies;
     this._versionContextSupplier    = versionContextSupplier;
     this._clock                     = clock;
     DoBlockNewTransactions();
     this._collectionsFactorySupplier = collectionsFactorySupplier;
     this._constraintSemantics        = constraintSemantics;
     this._schemaState = schemaState;
 }
Пример #9
0
        public static List <TokenHolders> GetTokens(ApplicationDbContext _context)
        {
            List <TokenHolders> list = new List <TokenHolders>();
            var             result   = "";
            HttpWebRequest  request  = (HttpWebRequest)WebRequest.Create("https://etherscan.io/token/generic-tokenholders2?a=0xc324a2f6b05880503444451b8b27e6f9e63287cb&s=3000000000000000000000000000");
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            using (StreamReader reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.Default))
            {
                result = reader.ReadToEnd();

                var htmlDoc = new HtmlAgilityPack.HtmlDocument();
                htmlDoc.LoadHtml(result);
                IList <HtmlNode> nodes = htmlDoc.QuerySelectorAll("div#maintable > table.table > tr");
                Int32            i     = 0;
                foreach (HtmlNode nodeItem in nodes)
                {
                    if (i >= 4)
                    {
                        break;
                    }

                    if (i != 0)
                    {
                        TokenHolders     tokenHolders = new TokenHolders();
                        IList <HtmlNode> item         = nodeItem.QuerySelectorAll("td");
                        tokenHolders.Rand       = i.ToString();
                        tokenHolders.Address    = item[1].QuerySelector("span > a").InnerText;
                        tokenHolders.Quantity   = item[2].InnerText;
                        tokenHolders.Percentage = item[3].InnerText;
                        list.Add(tokenHolders);
                    }

                    i++;
                }
            }
            return(list);
        }
Пример #10
0
        public CoreStateMachinesModule(MemberId myself, PlatformModule platformModule, File clusterStateDirectory, Config config, RaftReplicator replicator, RaftMachine raftMachine, Dependencies dependencies, LocalDatabase localDatabase)
        {
            StateStorage <IdAllocationState>        idAllocationState;
            StateStorage <ReplicatedLockTokenState> lockTokenState;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.kernel.lifecycle.LifeSupport life = platformModule.life;
            LifeSupport life = platformModule.Life;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.neo4j.io.fs.FileSystemAbstraction fileSystem = platformModule.fileSystem;
            FileSystemAbstraction fileSystem  = platformModule.FileSystem;
            LogService            logging     = platformModule.Logging;
            LogProvider           logProvider = logging.InternalLogProvider;

            lockTokenState = life.Add(new DurableStateStorage <>(fileSystem, clusterStateDirectory, LOCK_TOKEN_NAME, new ReplicatedLockTokenState.Marshal(new MemberId.Marshal()), config.Get(replicated_lock_token_state_size), logProvider));

            idAllocationState = life.Add(new DurableStateStorage <>(fileSystem, clusterStateDirectory, ID_ALLOCATION_NAME, new IdAllocationState.Marshal(), config.Get(id_alloc_state_size), logProvider));

            ReplicatedIdAllocationStateMachine idAllocationStateMachine = new ReplicatedIdAllocationStateMachine(idAllocationState);

            IDictionary <IdType, int> allocationSizes = GetIdTypeAllocationSizeFromConfig(config);

            ReplicatedIdRangeAcquirer idRangeAcquirer = new ReplicatedIdRangeAcquirer(replicator, idAllocationStateMachine, allocationSizes, myself, logProvider);

            IdTypeConfigurationProvider = new EnterpriseIdTypeConfigurationProvider(config);
            CommandIndexTracker commandIndexTracker = dependencies.SatisfyDependency(new CommandIndexTracker());

            FreeIdCondition         = new IdReusabilityCondition(commandIndexTracker, raftMachine, myself);
            this.IdGeneratorFactory = CreateIdGeneratorFactory(fileSystem, idRangeAcquirer, logProvider, IdTypeConfigurationProvider);

            TokenRegistry relationshipTypeTokenRegistry = new TokenRegistry(Org.Neo4j.Kernel.impl.core.TokenHolder_Fields.TYPE_RELATIONSHIP_TYPE);

            System.Func <StorageEngine>           storageEngineSupplier       = () => localDatabase.DataSource().DependencyResolver.resolveDependency(typeof(StorageEngine));
            ReplicatedRelationshipTypeTokenHolder relationshipTypeTokenHolder = new ReplicatedRelationshipTypeTokenHolder(relationshipTypeTokenRegistry, replicator, this.IdGeneratorFactory, storageEngineSupplier);

            TokenRegistry propertyKeyTokenRegistry = new TokenRegistry(Org.Neo4j.Kernel.impl.core.TokenHolder_Fields.TYPE_PROPERTY_KEY);
            ReplicatedPropertyKeyTokenHolder propertyKeyTokenHolder = new ReplicatedPropertyKeyTokenHolder(propertyKeyTokenRegistry, replicator, this.IdGeneratorFactory, storageEngineSupplier);

            TokenRegistry labelTokenRegistry            = new TokenRegistry(Org.Neo4j.Kernel.impl.core.TokenHolder_Fields.TYPE_LABEL);
            ReplicatedLabelTokenHolder labelTokenHolder = new ReplicatedLabelTokenHolder(labelTokenRegistry, replicator, this.IdGeneratorFactory, storageEngineSupplier);

            ReplicatedLockTokenStateMachine replicatedLockTokenStateMachine = new ReplicatedLockTokenStateMachine(lockTokenState);

            VersionContextSupplier      versionContextSupplier = platformModule.VersionContextSupplier;
            ReplicatedTokenStateMachine labelTokenStateMachine = new ReplicatedTokenStateMachine(labelTokenRegistry, logProvider, versionContextSupplier);

            ReplicatedTokenStateMachine propertyKeyTokenStateMachine = new ReplicatedTokenStateMachine(propertyKeyTokenRegistry, logProvider, versionContextSupplier);

            ReplicatedTokenStateMachine relationshipTypeTokenStateMachine = new ReplicatedTokenStateMachine(relationshipTypeTokenRegistry, logProvider, versionContextSupplier);

            PageCursorTracerSupplier          cursorTracerSupplier     = platformModule.Tracers.pageCursorTracerSupplier;
            ReplicatedTransactionStateMachine replicatedTxStateMachine = new ReplicatedTransactionStateMachine(commandIndexTracker, replicatedLockTokenStateMachine, config.Get(state_machine_apply_max_batch_size), logProvider, cursorTracerSupplier, versionContextSupplier);

            dependencies.SatisfyDependencies(replicatedTxStateMachine);

            LocksFactory lockFactory = createLockFactory(config, logging);

            LocksSupplier = () => CreateLockManager(lockFactory, config, platformModule.Clock, replicator, myself, raftMachine, replicatedLockTokenStateMachine);

            RecoverConsensusLogIndex consensusLogIndexRecovery = new RecoverConsensusLogIndex(localDatabase, logProvider);

            CoreStateMachines = new CoreStateMachines(replicatedTxStateMachine, labelTokenStateMachine, relationshipTypeTokenStateMachine, propertyKeyTokenStateMachine, replicatedLockTokenStateMachine, idAllocationStateMachine, new DummyMachine(), localDatabase, consensusLogIndexRecovery);

            CommitProcessFactory = (appender, applier, ignored) =>
            {
                localDatabase.RegisterCommitProcessDependencies(appender, applier);
                return(new ReplicatedTransactionCommitProcess(replicator));
            };

            this.TokenHolders = new TokenHolders(propertyKeyTokenHolder, labelTokenHolder, relationshipTypeTokenHolder);
            dependencies.SatisfyDependencies(TokenHolders);
        }
Пример #11
0
 public KernelToken(StorageReader store, KernelTransactionImplementation ktx, TokenHolders tokenHolders)
 {
     this._store        = store;
     this._ktx          = ktx;
     this._tokenHolders = tokenHolders;
 }
Пример #12
0
 internal TestKernelTransactions(StatementLocksFactory statementLocksFactory, ConstraintIndexCreator constraintIndexCreator, StatementOperationParts statementOperations, SchemaWriteGuard schemaWriteGuard, TransactionHeaderInformationFactory txHeaderFactory, TransactionCommitProcess transactionCommitProcess, AuxiliaryTransactionStateManager auxTxStateManager, TransactionHooks hooks, TransactionMonitor transactionMonitor, AvailabilityGuard databaseAvailabilityGuard, Tracers tracers, StorageEngine storageEngine, Procedures procedures, TransactionIdStore transactionIdStore, SystemNanoClock clock, AccessCapability accessCapability, AutoIndexing autoIndexing, VersionContextSupplier versionContextSupplier, TokenHolders tokenHolders, Dependencies dataSourceDependencies) : base(Config.defaults(), statementLocksFactory, constraintIndexCreator, statementOperations, schemaWriteGuard, txHeaderFactory, transactionCommitProcess, auxTxStateManager, hooks, transactionMonitor, databaseAvailabilityGuard, tracers, storageEngine, procedures, transactionIdStore, clock, new AtomicReference <CpuClock>(CpuClock.NOT_AVAILABLE), new AtomicReference <HeapAllocation>(HeapAllocation.NOT_AVAILABLE), accessCapability, autoIndexing, mock(typeof(ExplicitIndexStore)), versionContextSupplier, ON_HEAP, new StandardConstraintSemantics(), mock(typeof(SchemaState)), mock(typeof(IndexingService)), tokenHolders, DEFAULT_DATABASE_NAME, dataSourceDependencies)
 {
 }
Пример #13
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public Result runFullConsistencyCheck(org.neo4j.io.layout.DatabaseLayout databaseLayout, org.neo4j.kernel.configuration.Config config, org.neo4j.helpers.progress.ProgressMonitorFactory progressFactory, final org.neo4j.logging.LogProvider logProvider, final org.neo4j.io.fs.FileSystemAbstraction fileSystem, final org.neo4j.io.pagecache.PageCache pageCache, final boolean verbose, java.io.File reportDir, org.neo4j.consistency.checking.full.ConsistencyFlags consistencyFlags) throws org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException
//JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected:
        public virtual Result RunFullConsistencyCheck(DatabaseLayout databaseLayout, Config config, ProgressMonitorFactory progressFactory, LogProvider logProvider, FileSystemAbstraction fileSystem, PageCache pageCache, bool verbose, File reportDir, ConsistencyFlags consistencyFlags)
        {
            AssertRecovered(databaseLayout, config, fileSystem, pageCache);
            Log log = logProvider.getLog(this.GetType());

            config.augment(GraphDatabaseSettings.read_only, TRUE);
            config.augment(GraphDatabaseSettings.pagecache_warmup_enabled, FALSE);

            StoreFactory factory = new StoreFactory(databaseLayout, config, new DefaultIdGeneratorFactory(fileSystem), pageCache, fileSystem, logProvider, EmptyVersionContextSupplier.EMPTY);

            ConsistencySummaryStatistics summary;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final java.io.File reportFile = chooseReportPath(reportDir);
            File reportFile = ChooseReportPath(reportDir);

            Suppliers.Lazy <PrintWriter> reportWriterSupplier = GetReportWriterSupplier(fileSystem, reportFile);
            Log reportLog = new ConsistencyReportLog(reportWriterSupplier);

            // Bootstrap kernel extensions
            Monitors                 monitors     = new Monitors();
            LifeSupport              life         = new LifeSupport();
            JobScheduler             jobScheduler = life.Add(JobSchedulerFactory.createInitialisedScheduler());
            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));
            DatabaseKernelExtensions extensions   = life.Add(instantiateKernelExtensions(databaseLayout.DatabaseDirectory(), fileSystem, config, new SimpleLogService(logProvider, logProvider), pageCache, jobScheduler, RecoveryCleanupWorkCollector.ignore(), TOOL, monitors, tokenHolders));
            DefaultIndexProviderMap  indexes      = life.Add(new DefaultIndexProviderMap(extensions, config));

            try
            {
                using (NeoStores neoStores = factory.OpenAllNeoStores())
                {
                    // Load tokens before starting extensions, etc.
                    tokenHolders.PropertyKeyTokens().InitialTokens      = neoStores.PropertyKeyTokenStore.Tokens;
                    tokenHolders.LabelTokens().InitialTokens            = neoStores.LabelTokenStore.Tokens;
                    tokenHolders.RelationshipTypeTokens().InitialTokens = neoStores.RelationshipTypeTokenStore.Tokens;

                    life.Start();

                    LabelScanStore labelScanStore = new NativeLabelScanStore(pageCache, databaseLayout, fileSystem, Org.Neo4j.Kernel.Impl.Api.scan.FullStoreChangeStream_Fields.Empty, true, monitors, RecoveryCleanupWorkCollector.ignore());
                    life.Add(labelScanStore);

                    int              numberOfThreads = DefaultConsistencyCheckThreadsNumber();
                    Statistics       statistics;
                    StoreAccess      storeAccess;
                    AccessStatistics stats = new AccessStatistics();
                    if (verbose)
                    {
                        statistics  = new VerboseStatistics(stats, new DefaultCounts(numberOfThreads), log);
                        storeAccess = new AccessStatsKeepingStoreAccess(neoStores, stats);
                    }
                    else
                    {
                        statistics  = Statistics.NONE;
                        storeAccess = new StoreAccess(neoStores);
                    }
                    storeAccess.Initialize();
                    DirectStoreAccess stores = new DirectStoreAccess(storeAccess, labelScanStore, indexes, tokenHolders);
                    FullCheck         check  = new FullCheck(progressFactory, statistics, numberOfThreads, consistencyFlags, config, true);
                    summary = check.Execute(stores, new DuplicatingLog(log, reportLog));
                }
            }
            finally
            {
                life.Shutdown();
                if (reportWriterSupplier.Initialised)
                {
                    reportWriterSupplier.get().close();
                }
            }

            if (!summary.Consistent)
            {
                log.Warn("See '%s' for a detailed consistency report.", reportFile.Path);
                return(Result.failure(reportFile));
            }
            return(Result.success(reportFile));
        }