//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void shouldBeAbleToProgressUnderStressfulProcessorChanges(int orderingGuarantees) throws Exception private void ShouldBeAbleToProgressUnderStressfulProcessorChanges(int orderingGuarantees) { // given int batches = 100; int processors = Runtime.Runtime.availableProcessors() * 10; Configuration config = new Configuration_OverriddenAnonymousInnerClass(this, Configuration.DEFAULT, processors); Stage stage = new StressStage(config, orderingGuarantees, batches); StageExecution execution = stage.Execute(); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.List<Step<?>> steps = asList(execution.steps()); IList <Step <object> > steps = new IList <Step <object> > { execution.Steps() }; steps[1].Processors(processors / 3); // when ThreadLocalRandom random = ThreadLocalRandom.current(); while (execution.StillExecuting()) { steps[2].Processors(random.Next(-2, 5)); Thread.Sleep(1); } execution.AssertHealthy(); // then assertEquals(batches, steps[steps.Count - 1].Stats().stat(Keys.done_batches).asLong()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void migrateWithBatchImporter(org.neo4j.io.layout.DatabaseLayout sourceDirectoryStructure, org.neo4j.io.layout.DatabaseLayout migrationDirectoryStructure, long lastTxId, long lastTxChecksum, long lastTxLogVersion, long lastTxLogByteOffset, org.neo4j.kernel.impl.util.monitoring.ProgressReporter progressReporter, org.neo4j.kernel.impl.store.format.RecordFormats oldFormat, org.neo4j.kernel.impl.store.format.RecordFormats newFormat) throws java.io.IOException private void MigrateWithBatchImporter(DatabaseLayout sourceDirectoryStructure, DatabaseLayout migrationDirectoryStructure, long lastTxId, long lastTxChecksum, long lastTxLogVersion, long lastTxLogByteOffset, ProgressReporter progressReporter, RecordFormats oldFormat, RecordFormats newFormat) { PrepareBatchImportMigration(sourceDirectoryStructure, migrationDirectoryStructure, oldFormat, newFormat); bool requiresDynamicStoreMigration = !newFormat.Dynamic().Equals(oldFormat.Dynamic()); bool requiresPropertyMigration = !newFormat.Property().Equals(oldFormat.Property()) || requiresDynamicStoreMigration; File badFile = sourceDirectoryStructure.File([email protected]_Fields.BAD_FILE_NAME); using (NeoStores legacyStore = InstantiateLegacyStore(oldFormat, sourceDirectoryStructure), Stream badOutput = new BufferedOutputStream(new FileStream(badFile, false))) { Configuration importConfig = new Configuration_OverriddenAnonymousInnerClass(this, _config, sourceDirectoryStructure); AdditionalInitialIds additionalInitialIds = ReadAdditionalIds(lastTxId, lastTxChecksum, lastTxLogVersion, lastTxLogByteOffset); // We have to make sure to keep the token ids if we're migrating properties/labels BatchImporter importer = BatchImporterFactory.withHighestPriority().instantiate(migrationDirectoryStructure, _fileSystem, _pageCache, importConfig, _logService, withDynamicProcessorAssignment(MigrationBatchImporterMonitor(legacyStore, progressReporter, importConfig), importConfig), additionalInitialIds, _config, newFormat, NO_MONITOR, _jobScheduler); InputIterable nodes = () => LegacyNodesAsInput(legacyStore, requiresPropertyMigration); InputIterable relationships = () => LegacyRelationshipsAsInput(legacyStore, requiresPropertyMigration); long propertyStoreSize = StoreSize(legacyStore.PropertyStore) / 2 + StoreSize(legacyStore.PropertyStore.StringStore) / 2 + StoreSize(legacyStore.PropertyStore.ArrayStore) / 2; Input_Estimates estimates = knownEstimates(legacyStore.NodeStore.NumberOfIdsInUse, legacyStore.RelationshipStore.NumberOfIdsInUse, legacyStore.PropertyStore.NumberOfIdsInUse, legacyStore.PropertyStore.NumberOfIdsInUse, propertyStoreSize / 2, propertyStoreSize / 2, 0); importer.DoImport(Inputs.input(nodes, relationships, IdMappers.actual(), Collectors.badCollector(badOutput, 0), estimates)); // During migration the batch importer doesn't necessarily writes all entities, depending on // which stores needs migration. Node, relationship, relationship group stores are always written // anyways and cannot be avoided with the importer, but delete the store files that weren't written // (left empty) so that we don't overwrite those in the real store directory later. ICollection <DatabaseFile> storesToDeleteFromMigratedDirectory = new List <DatabaseFile>(); storesToDeleteFromMigratedDirectory.Add(DatabaseFile.METADATA_STORE); if (!requiresPropertyMigration) { // We didn't migrate properties, so the property stores in the migrated store are just empty/bogus storesToDeleteFromMigratedDirectory.addAll(asList(DatabaseFile.PROPERTY_STORE, DatabaseFile.PROPERTY_STRING_STORE, DatabaseFile.PROPERTY_ARRAY_STORE)); } if (!requiresDynamicStoreMigration) { // We didn't migrate labels (dynamic node labels) or any other dynamic store storesToDeleteFromMigratedDirectory.addAll(asList(DatabaseFile.NODE_LABEL_STORE, DatabaseFile.LABEL_TOKEN_STORE, DatabaseFile.LABEL_TOKEN_NAMES_STORE, DatabaseFile.RELATIONSHIP_TYPE_TOKEN_STORE, DatabaseFile.RELATIONSHIP_TYPE_TOKEN_NAMES_STORE, DatabaseFile.PROPERTY_KEY_TOKEN_STORE, DatabaseFile.PROPERTY_KEY_TOKEN_NAMES_STORE, DatabaseFile.SCHEMA_STORE)); } fileOperation(DELETE, _fileSystem, migrationDirectoryStructure, migrationDirectoryStructure, storesToDeleteFromMigratedDirectory, true, null); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReceiveBatchesInOrder() public virtual void ShouldReceiveBatchesInOrder() { // GIVEN Configuration config = new Configuration_OverriddenAnonymousInnerClass(this, DEFAULT); Stage stage = new Stage("Test stage", null, config, ORDER_SEND_DOWNSTREAM); long batches = 1000; //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final long items = batches * config.batchSize(); long items = batches * config.BatchSize(); stage.Add(new PullingProducerStepAnonymousInnerClass(this, stage.Control(), config, items)); for (int i = 0; i < 3; i++) { stage.Add(new ReceiveOrderAssertingStep(stage.Control(), "Step" + i, config, i, false)); } stage.Add(new ReceiveOrderAssertingStep(stage.Control(), "Final step", config, 0, true)); // WHEN StageExecution execution = stage.Execute(); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: for (Step<?> step : execution.steps()) foreach (Step <object> step in execution.Steps()) { // we start off with two in each step step.Processors(1); } (new ExecutionSupervisor(ExecutionMonitors.Invisible())).supervise(execution); // THEN //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: for (Step<?> step : execution.steps()) foreach (Step <object> step in execution.Steps()) { assertEquals("For " + step, batches, step.Stats().stat(Keys.done_batches).asLong()); } stage.Close(); }