//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUp() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SetUp() { LogVersionRepository logVersionRepository = new SimpleLogVersionRepository(); SimpleTransactionIdStore transactionIdStore = new SimpleTransactionIdStore(); LogFiles logFiles = LogFilesBuilder.builder(_directory.databaseLayout(), _fs).withLogVersionRepository(logVersionRepository).withTransactionIdStore(transactionIdStore).build(); _life.add(logFiles); _logFile = logFiles.LogFile; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setUp() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SetUp() { _databaseDirectory = TestDirectory.databaseDir(); SimpleLogVersionRepository logVersionRepository = new SimpleLogVersionRepository(); SimpleTransactionIdStore transactionIdStore = new SimpleTransactionIdStore(); _logFiles = LogFilesBuilder.logFilesBasedOnlyBuilder(_databaseDirectory, FileSystemRule).withRotationThreshold(LogHeader.LOG_HEADER_SIZE + 9L).withLogVersionRepository(logVersionRepository).withTransactionIdStore(transactionIdStore).build(); Life.add(_logFiles); _logPruner = new CorruptedLogsTruncator(_databaseDirectory, _logFiles, FileSystemRule); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldKeepTransactionsIntactWhenConcurrentlyRotationAndAppending() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldKeepTransactionsIntactWhenConcurrentlyRotationAndAppending() { // GIVEN LogVersionRepository logVersionRepository = new SimpleLogVersionRepository(); LogFiles logFiles = LogFilesBuilder.builder(_directory.databaseLayout(), _fileSystemRule.get()).withLogVersionRepository(logVersionRepository).withRotationThreshold(ByteUnit.mebiBytes(1)).withTransactionIdStore(new SimpleTransactionIdStore()).build(); _life.add(logFiles); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.concurrent.atomic.AtomicBoolean end = new java.util.concurrent.atomic.AtomicBoolean(); AtomicBoolean end = new AtomicBoolean(); AllTheMonitoring monitoring = new AllTheMonitoring(end, 100); TransactionIdStore txIdStore = new SimpleTransactionIdStore(); TransactionMetadataCache metadataCache = new TransactionMetadataCache(); monitoring.LogFile = logFiles.LogFile; DatabaseHealth health = new DatabaseHealth(mock(typeof(DatabasePanicEventGenerator)), NullLog.Instance); LogRotation rotation = new LogRotationImpl(monitoring, logFiles, health); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final TransactionAppender appender = life.add(new BatchingTransactionAppender(logFiles, rotation, metadataCache, txIdStore, BYPASS, health)); TransactionAppender appender = _life.add(new BatchingTransactionAppender(logFiles, rotation, metadataCache, txIdStore, BYPASS, health)); // WHEN Race race = new Race(); for (int i = 0; i < 10; i++) { race.AddContestant(() => { while (!end.get()) { try { appender.Append(new TransactionToApply(SillyTransaction(1_000)), NULL); } catch (Exception e) { e.printStackTrace(System.out); end.set(true); fail(e.Message); } } }); } race.AddContestant(EndAfterMax(10, SECONDS, end)); race.Go(); // THEN assertTrue(monitoring.NumberOfRotations() > 0); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void buildDefaultContextWithDependencies() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void BuildDefaultContextWithDependencies() { SimpleLogVersionRepository logVersionRepository = new SimpleLogVersionRepository(2); SimpleTransactionIdStore transactionIdStore = new SimpleTransactionIdStore(); Dependencies dependencies = new Dependencies(); dependencies.SatisfyDependency(logVersionRepository); dependencies.SatisfyDependency(transactionIdStore); TransactionLogFilesContext context = builder(TestDirectory.databaseLayout(), _fileSystem).withDependencies(dependencies).buildContext(); assertEquals(_fileSystem, context.FileSystem); assertNotNull(context.LogEntryReader); assertSame(LogFileCreationMonitor_Fields.NoMonitor, context.LogFileCreationMonitor); assertEquals(ByteUnit.mebiBytes(250), context.RotationThreshold.get()); assertEquals(1, context.LastCommittedTransactionId); assertEquals(2, context.LogVersionRepository.CurrentLogVersion); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private org.neo4j.kernel.impl.transaction.log.files.LogFiles getLogFiles(org.neo4j.kernel.impl.transaction.SimpleLogVersionRepository logVersionRepository, org.neo4j.kernel.impl.transaction.SimpleTransactionIdStore transactionIdStore) throws java.io.IOException private LogFiles GetLogFiles(SimpleLogVersionRepository logVersionRepository, SimpleTransactionIdStore transactionIdStore) { return(LogFilesBuilder.builder(TestDirectory.databaseLayout(), FileSystem.get()).withLogVersionRepository(logVersionRepository).withTransactionIdStore(transactionIdStore).build()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private org.neo4j.kernel.impl.transaction.log.files.LogFiles createLogFiles(org.neo4j.kernel.impl.transaction.log.TransactionIdStore transactionIdStore, org.neo4j.io.fs.FileSystemAbstraction fileSystemAbstraction) throws java.io.IOException private LogFiles CreateLogFiles(TransactionIdStore transactionIdStore, FileSystemAbstraction fileSystemAbstraction) { SimpleLogVersionRepository logVersionRepository = new SimpleLogVersionRepository(); return(LogFilesBuilder.builder(_databaseLayout, fileSystemAbstraction).withTransactionIdStore(transactionIdStore).withLogVersionRepository(logVersionRepository).build()); }
public DefaultRecoveryServiceAnonymousInnerClass3(RecoveryTest outerInstance, StorageEngine storageEngine, LogTailScanner tailScanner, TransactionIdStore transactionIdStore, LogicalTransactionStore txStore, SimpleLogVersionRepository versionRepository, UnknownType noMonitor, AtomicBoolean recoveryRequired) : base(storageEngine, tailScanner, transactionIdStore, txStore, versionRepository, noMonitor) { this.outerInstance = outerInstance; this._recoveryRequired = recoveryRequired; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotSeeEmptyLogFileWhenReadingTransactionStream() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotSeeEmptyLogFileWhenReadingTransactionStream() { // GIVEN LogVersionRepository logVersionRepository = new SimpleLogVersionRepository(); LogFiles logFiles = LogFilesBuilder.builder(_directory.databaseLayout(), _fileSystemRule.get()).withLogVersionRepository(logVersionRepository).withTransactionIdStore(new SimpleTransactionIdStore()).build(); _life.add(logFiles); LogFile logFile = logFiles.LogFile; FlushablePositionAwareChannel writer = logFile.Writer; LogPositionMarker startPosition = new LogPositionMarker(); writer.GetCurrentPosition(startPosition); // WHEN AtomicBoolean end = new AtomicBoolean(); sbyte[] dataChunk = new sbyte[100]; // one thread constantly writing to and rotating the channel AtomicInteger rotations = new AtomicInteger(); System.Threading.CountdownEvent startSignal = new System.Threading.CountdownEvent(1); Future <Void> writeFuture = _t2.execute(ignored => { ThreadLocalRandom random = ThreadLocalRandom.current(); startSignal.Signal(); while (!end.get()) { writer.Put(dataChunk, random.Next(1, dataChunk.Length)); if (logFile.RotationNeeded()) { logFile.Rotate(); // Let's just close the gap to the reader so that it gets closer to the "hot zone" // where the rotation happens. writer.GetCurrentPosition(startPosition); rotations.incrementAndGet(); } } return(null); }); assertTrue(startSignal.await(10, SECONDS)); // one thread reading through the channel long maxEndTime = currentTimeMillis() + _limitTime; int reads = 0; try { for ( ; currentTimeMillis() < maxEndTime && reads < LIMIT_READS && rotations.get() < LIMIT_ROTATIONS; reads++) { using (ReadableLogChannel reader = logFile.GetReader(startPosition.NewPosition())) { Deplete(reader); } } } finally { end.set(true); writeFuture.get(); } // THEN simply getting here means this was successful }