//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Parameterized.Parameters(name = "Migrate: {0}->{1}") public static Iterable<Object[]> data() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public static IEnumerable <object[]> Data() { FileSystemAbstraction fs = _fileSystemRule.get(); PageCache pageCache = _pageCacheRule.getPageCache(fs); TestDirectory testDirectory = TestDirectory.testDirectory(); testDirectory.PrepareDirectory(typeof(StoreMigrationIT), "migration"); DatabaseLayout databaseLayout = testDirectory.DatabaseLayout(); StoreVersionCheck storeVersionCheck = new StoreVersionCheck(pageCache); VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel>(); LogFiles logFiles = LogFilesBuilder.logFilesBasedOnlyBuilder(databaseLayout.DatabaseDirectory(), fs).withLogEntryReader(logEntryReader).build(); LogTailScanner tailScanner = new LogTailScanner(logFiles, logEntryReader, new Monitors()); IList <object[]> data = new List <object[]>(); List <RecordFormats> recordFormats = new List <RecordFormats>(); RecordFormatSelector.allFormats().forEach(f => addIfNotThere(f, recordFormats)); foreach (RecordFormats toFormat in recordFormats) { UpgradableDatabase upgradableDatabase = new UpgradableDatabase(storeVersionCheck, toFormat, tailScanner); foreach (RecordFormats fromFormat in recordFormats) { try { CreateDb(fromFormat, databaseLayout.DatabaseDirectory()); if (!upgradableDatabase.HasCurrentVersion(databaseLayout)) { upgradableDatabase.CheckUpgradable(databaseLayout); data.Add(new object[] { fromFormat, toFormat }); } } catch (Exception) { //This means that the combination is not migratable. } fs.DeleteRecursively(databaseLayout.DatabaseDirectory()); } } return(data); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldComputeTheLastTxInfoCorrectly() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldComputeTheLastTxInfoCorrectly() { // given DatabaseLayout databaseLayout = _directory.databaseLayout(); File prepare = _directory.directory("prepare"); MigrationTestUtils.prepareSampleLegacyDatabase(Version, _fs, databaseLayout.DatabaseDirectory(), prepare); // and a state of the migration saying that it has done the actual migration LogService logService = NullLogService.Instance; PageCache pageCache = _pageCacheRule.getPageCache(_fs); LogTailScanner tailScanner = GetTailScanner(databaseLayout.DatabaseDirectory()); UpgradableDatabase upgradableDatabase = GetUpgradableDatabase(pageCache, tailScanner); string versionToMigrateFrom = upgradableDatabase.CheckUpgradable(databaseLayout).storeVersion(); SilentMigrationProgressMonitor progressMonitor = new SilentMigrationProgressMonitor(); StoreMigrator migrator = new StoreMigrator(_fs, pageCache, _config, logService, _jobScheduler); DatabaseLayout migrationLayout = _directory.databaseLayout(StoreUpgrader.MIGRATION_DIRECTORY); // when migrator.Migrate(databaseLayout, migrationLayout, progressMonitor.StartSection("section"), versionToMigrateFrom, upgradableDatabase.CurrentVersion()); // then assertTrue(TxIdComparator.apply(migrator.ReadLastTxInformation(migrationLayout))); }
private static UpgradableDatabase GetUpgradableDatabase(PageCache pageCache, LogTailScanner tailScanner) { return(new UpgradableDatabase(new StoreVersionCheck(pageCache), SelectFormat(), tailScanner)); }
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 shouldRecoverExistingData() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldRecoverExistingData() { File file = _logFiles.getLogFileForVersion(_logVersion); WriteSomeData(file, pair => { LogEntryWriter writer = pair.first(); Consumer <LogPositionMarker> consumer = pair.other(); LogPositionMarker marker = new LogPositionMarker(); // last committed tx consumer.accept(marker); LogPosition lastCommittedTxPosition = marker.newPosition(); writer.writeStartEntry(0, 1, 2L, 3L, new sbyte[0]); _lastCommittedTxStartEntry = new LogEntryStart(0, 1, 2L, 3L, new sbyte[0], lastCommittedTxPosition); writer.writeCommitEntry(4L, 5L); _lastCommittedTxCommitEntry = new LogEntryCommit(4L, 5L); // check point pointing to the previously committed transaction writer.writeCheckPointEntry(lastCommittedTxPosition); _expectedCheckPointEntry = new CheckPoint(lastCommittedTxPosition); // tx committed after checkpoint consumer.accept(marker); writer.writeStartEntry(0, 1, 6L, 4L, new sbyte[0]); _expectedStartEntry = new LogEntryStart(0, 1, 6L, 4L, new sbyte[0], marker.newPosition()); writer.writeCommitEntry(5L, 7L); _expectedCommitEntry = new LogEntryCommit(5L, 7L); return(true); }); LifeSupport life = new LifeSupport(); RecoveryMonitor monitor = mock(typeof(RecoveryMonitor)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.concurrent.atomic.AtomicBoolean recoveryRequired = new java.util.concurrent.atomic.AtomicBoolean(); AtomicBoolean recoveryRequired = new AtomicBoolean(); try { StorageEngine storageEngine = mock(typeof(StorageEngine)); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.impl.transaction.log.entry.LogEntryReader<org.neo4j.kernel.impl.transaction.log.ReadableClosablePositionAwareChannel> reader = new org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader<>(); LogEntryReader <ReadableClosablePositionAwareChannel> reader = new VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel>(); LogTailScanner tailScanner = GetTailScanner(_logFiles, reader); TransactionMetadataCache metadataCache = new TransactionMetadataCache(); LogicalTransactionStore txStore = new PhysicalLogicalTransactionStore(_logFiles, metadataCache, reader, _monitors, false); CorruptedLogsTruncator logPruner = new CorruptedLogsTruncator(_storeDir, _logFiles, FileSystemRule.get()); life.add(new Recovery(new DefaultRecoveryServiceAnonymousInnerClass(this, storageEngine, tailScanner, _transactionIdStore, txStore, _versionRepository, NO_MONITOR, recoveryRequired) , logPruner, _schemaLife, monitor, SilentProgressReporter.INSTANCE, false)); life.Start(); InOrder order = inOrder(monitor); order.verify(monitor, times(1)).recoveryRequired(any(typeof(LogPosition))); order.verify(monitor, times(1)).recoveryCompleted(2); assertTrue(recoveryRequired.get()); } finally { life.Shutdown(); } }
public UpgradableDatabase(StoreVersionCheck storeVersionCheck, RecordFormats format, LogTailScanner tailScanner) { this._storeVersionCheck = storeVersionCheck; this._format = format; this._tailScanner = tailScanner; }