Ejemplo n.º 1
0
 private void EnsureTreeInstantiated()
 {
     if (tree == null)
     {
         instantiateTree(RecoveryCleanupWorkCollector.ignore(), NO_HEADER_WRITER);
     }
 }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setup()
        public virtual void Setup()
        {
            DefaultFileSystemAbstraction fs = this._fs.get();
            PageCache     pc     = _pageCacheRule.getPageCache(fs);
            File          file   = _directory.file("index");
            GenericLayout layout = new GenericLayout(1, _indexSettings);
            RecoveryCleanupWorkCollector collector = RecoveryCleanupWorkCollector.ignore();

            _descriptor = TestIndexDescriptorFactory.forLabel(1, 1).withId(1);
            IndexDirectoryStructure.Factory factory   = IndexDirectoryStructure.directoriesByProvider(_directory.storeDir());
            IndexDirectoryStructure         structure = factory.ForProvider(GenericNativeIndexProvider.Descriptor);
            IndexDropAction dropAction = new FileSystemIndexDropAction(fs, structure);

            _accessor = new GenericNativeIndexAccessor(pc, fs, file, layout, collector, EMPTY, _descriptor, _indexSettings, new StandardConfiguration(), dropAction, false);
        }
Ejemplo n.º 3
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));
        }
Ejemplo n.º 4
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)));
        }