//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public org.neo4j.kernel.impl.store.NeoStores build() throws java.io.IOException public virtual NeoStores Build() { if (Fs == null) { Fs = outerInstance.ruleFs(); } if (Config == null) { Config = new string[0]; } Config dbConfig = ConfigOf(Config); if (PageCache == null) { outerInstance.jobScheduler = new ThreadPoolJobScheduler(); PageCache = outerInstance.rulePageCache(dbConfig, Fs, outerInstance.jobScheduler); } if (Format == null) { Format = RecordFormatSelector.selectForConfig(dbConfig, NullLogProvider.Instance); } if (IdGeneratorFactory == null) { //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: IdGeneratorFactory = DefaultIdGeneratorFactory::new; } return(outerInstance.open(Fs, PageCache, Format, IdGeneratorFactory, Config)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void createRandomData(int count) throws Exception private void CreateRandomData(int count) { Config config = Config.defaults(); RecordFormats recordFormats = RecordFormatSelector.selectForConfig(config, NullLogProvider.Instance); using (RandomDataInput input = new RandomDataInput(this, count), JobScheduler jobScheduler = new ThreadPoolJobScheduler()) { BatchImporter importer = new ParallelBatchImporter(_directory.databaseLayout(), _fileSystemRule.get(), null, DEFAULT, NullLogService.Instance, ExecutionMonitors.invisible(), EMPTY, config, recordFormats, NO_MONITOR, jobScheduler); importer.DoImport(input); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static void run(final org.neo4j.io.fs.FileSystemAbstraction fs, final java.io.File storeDirectory, org.neo4j.kernel.configuration.Config config, org.neo4j.logging.LogProvider userLogProvider) throws Exception //JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: public static void Run(FileSystemAbstraction fs, File storeDirectory, Config config, LogProvider userLogProvider) { StoreLogService logService = StoreLogService.withUserLogProvider(userLogProvider).withInternalLog(config.Get(store_internal_log_path)).build(fs); VisibleMigrationProgressMonitor progressMonitor = new VisibleMigrationProgressMonitor(logService.GetUserLog(typeof(StoreMigration))); LifeSupport life = new LifeSupport(); life.Add(logService); // Add participants from kernel extensions... DefaultExplicitIndexProvider migrationIndexProvider = new DefaultExplicitIndexProvider(); Log log = userLogProvider.GetLog(typeof(StoreMigration)); JobScheduler jobScheduler = JobSchedulerFactory.createInitialisedScheduler(); try { using (PageCache pageCache = createPageCache(fs, config, jobScheduler)) { Dependencies deps = new Dependencies(); Monitors monitors = new Monitors(); deps.SatisfyDependencies(fs, config, migrationIndexProvider, pageCache, logService, monitors, RecoveryCleanupWorkCollector.immediate()); KernelContext kernelContext = new SimpleKernelContext(storeDirectory, DatabaseInfo.UNKNOWN, deps); DatabaseKernelExtensions kernelExtensions = life.Add(new DatabaseKernelExtensions(kernelContext, GraphDatabaseDependencies.newDependencies().kernelExtensions(), deps, ignore())); DatabaseLayout databaseLayout = DatabaseLayout.of(storeDirectory); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.impl.transaction.log.files.LogFiles logFiles = org.neo4j.kernel.impl.transaction.log.files.LogFilesBuilder.activeFilesBuilder(databaseLayout, fs, pageCache).withConfig(config).build(); LogFiles logFiles = LogFilesBuilder.activeFilesBuilder(databaseLayout, fs, pageCache).withConfig(config).build(); LogTailScanner tailScanner = new LogTailScanner(logFiles, new VersionAwareLogEntryReader <Org.Neo4j.Kernel.impl.transaction.log.ReadableClosablePositionAwareChannel>(), monitors); DefaultIndexProviderMap indexProviderMap = life.Add(new DefaultIndexProviderMap(kernelExtensions, config)); // Add the kernel store migrator life.Start(); long startTime = DateTimeHelper.CurrentUnixTimeMillis(); DatabaseMigrator migrator = new DatabaseMigrator(progressMonitor, fs, config, logService, indexProviderMap, migrationIndexProvider, pageCache, RecordFormatSelector.selectForConfig(config, userLogProvider), tailScanner, jobScheduler); migrator.Migrate(databaseLayout); // Append checkpoint so the last log entry will have the latest version AppendCheckpoint(logFiles, tailScanner); long duration = DateTimeHelper.CurrentUnixTimeMillis() - startTime; log.Info(format("Migration completed in %d s%n", duration / 1000)); } } catch (Exception e) { throw new StoreUpgrader.UnableToUpgradeException("Failure during upgrade", e); } finally { life.Shutdown(); jobScheduler.close(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBehaveCorrectlyUnderStress() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldBehaveCorrectlyUnderStress() { long durationInMinutes = parseLong(fromEnv("CHECK_POINT_LOG_ROTATION_STRESS_DURATION", DEFAULT_DURATION_IN_MINUTES)); File storeDir = new File(fromEnv("CHECK_POINT_LOG_ROTATION_STORE_DIRECTORY", _defaultStoreDir)); long nodeCount = parseLong(fromEnv("CHECK_POINT_LOG_ROTATION_NODE_COUNT", DEFAULT_NODE_COUNT)); int threads = parseInt(fromEnv("CHECK_POINT_LOG_ROTATION_WORKER_THREADS", DEFAULT_WORKER_THREADS)); string pageCacheMemory = fromEnv("CHECK_POINT_LOG_ROTATION_PAGE_CACHE_MEMORY", DEFAULT_PAGE_CACHE_MEMORY); Console.WriteLine("1/6\tBuilding initial store..."); using (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction(), JobScheduler jobScheduler = new ThreadPoolJobScheduler()) { Config dbConfig = Config.defaults(); (new ParallelBatchImporter(DatabaseLayout.of(ensureExistsAndEmpty(storeDir)), fileSystem, null, DEFAULT, NullLogService.Instance, ExecutionMonitors.defaultVisible(jobScheduler), EMPTY, dbConfig, RecordFormatSelector.selectForConfig(dbConfig, NullLogProvider.Instance), NO_MONITOR, jobScheduler)).doImport(new NodeCountInputs(nodeCount)); } Console.WriteLine("2/6\tStarting database..."); GraphDatabaseBuilder builder = (new TestGraphDatabaseFactory()).newEmbeddedDatabaseBuilder(storeDir); GraphDatabaseService db = builder.SetConfig(GraphDatabaseSettings.pagecache_memory, pageCacheMemory).setConfig(GraphDatabaseSettings.keep_logical_logs, Settings.FALSE).setConfig(GraphDatabaseSettings.check_point_interval_time, CHECK_POINT_INTERVAL_MINUTES + "m").setConfig(GraphDatabaseSettings.tracer, "timer").newGraphDatabase(); Console.WriteLine("3/6\tWarm up db..."); using (Workload workload = new Workload(db, defaultRandomMutation(nodeCount, db), threads)) { // make sure to run at least one checkpoint during warmup long warmUpTimeMillis = TimeUnit.SECONDS.toMillis(CHECK_POINT_INTERVAL_MINUTES * 2); workload.Run(warmUpTimeMillis, Workload.TransactionThroughput_Fields.NONE); } Console.WriteLine("4/6\tStarting workload..."); TransactionThroughputChecker throughput = new TransactionThroughputChecker(); using (Workload workload = new Workload(db, defaultRandomMutation(nodeCount, db), threads)) { workload.Run(TimeUnit.MINUTES.toMillis(durationInMinutes), throughput); } Console.WriteLine("5/6\tShutting down..."); Db.shutdown(); try { Console.WriteLine("6/6\tPrinting stats and recorded timings..."); TimerTransactionTracer.printStats(System.out); throughput.AssertThroughput(System.out); } finally { Console.WriteLine("Done."); } // let's cleanup disk space when everything went well FileUtils.deleteRecursively(storeDir); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static void main(String[] arguments) throws java.io.IOException public static void Main(string[] arguments) { Args args = Args.parse(arguments); long nodeCount = Settings.parseLongWithUnit(args.Get("nodes", null)); long relationshipCount = Settings.parseLongWithUnit(args.Get("relationships", null)); int labelCount = args.GetNumber("labels", 4).intValue(); int relationshipTypeCount = args.GetNumber("relationship-types", 4).intValue(); File dir = new File(args.Get(ImportTool.Options.StoreDir.key())); long randomSeed = args.GetNumber("random-seed", currentTimeMillis()).longValue(); Configuration config = Configuration.COMMAS; Extractors extractors = new Extractors(config.ArrayDelimiter()); IdType idType = IdType.valueOf(args.Get("id-type", IdType.INTEGER.name())); Groups groups = new Groups(); Header nodeHeader = ParseNodeHeader(args, idType, extractors, groups); Header relationshipHeader = ParseRelationshipHeader(args, idType, extractors, groups); Config dbConfig; string dbConfigFileName = args.Get(ImportTool.Options.DatabaseConfig.key(), null); if (!string.ReferenceEquals(dbConfigFileName, null)) { dbConfig = (new Config.Builder()).withFile(new File(dbConfigFileName)).build(); } else { dbConfig = Config.defaults(); } bool highIo = args.GetBoolean(ImportTool.Options.HighIo.key()); LogProvider logging = NullLogProvider.Instance; long pageCacheMemory = args.GetNumber("pagecache-memory", [email protected]_Fields.MaxPageCacheMemory).longValue(); [email protected] importConfig = new ConfigurationAnonymousInnerClass(args, highIo, pageCacheMemory); float factorBadNodeData = args.GetNumber("factor-bad-node-data", 0).floatValue(); float factorBadRelationshipData = args.GetNumber("factor-bad-relationship-data", 0).floatValue(); Input input = new DataGeneratorInput(nodeCount, relationshipCount, idType, Collector.EMPTY, randomSeed, 0, nodeHeader, relationshipHeader, labelCount, relationshipTypeCount, factorBadNodeData, factorBadRelationshipData); using (FileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction(), Lifespan life = new Lifespan()) { BatchImporter consumer; if (args.GetBoolean("to-csv")) { consumer = new CsvOutput(dir, nodeHeader, relationshipHeader, config); } else { Console.WriteLine("Seed " + randomSeed); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.scheduler.JobScheduler jobScheduler = life.add(createScheduler()); JobScheduler jobScheduler = life.Add(createScheduler()); consumer = BatchImporterFactory.withHighestPriority().instantiate(DatabaseLayout.of(dir), fileSystem, null, importConfig, new SimpleLogService(logging, logging), defaultVisible(jobScheduler), EMPTY, dbConfig, RecordFormatSelector.selectForConfig(dbConfig, logging), NO_MONITOR, jobScheduler); ImportTool.PrintOverview(dir, Collections.emptyList(), Collections.emptyList(), importConfig, System.out); } consumer.DoImport(input); } }