//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSucceedWithUpgradeAfterPreviousAttemptDiedDuringMigration() throws java.io.IOException, org.neo4j.consistency.checking.full.ConsistencyCheckIncompleteException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldSucceedWithUpgradeAfterPreviousAttemptDiedDuringMigration() { MigrationTestUtils.prepareSampleLegacyDatabase(Version, _fs, _workingDatabaseLayout.databaseDirectory(), _prepareDirectory); PageCache pageCache = _pageCacheRule.getPageCache(_fs); StoreVersionCheck check = new StoreVersionCheck(pageCache); UpgradableDatabase upgradableDatabase = GetUpgradableDatabase(check); SilentMigrationProgressMonitor progressMonitor = new SilentMigrationProgressMonitor(); LogService logService = NullLogService.Instance; StoreMigrator failingStoreMigrator = new StoreMigratorAnonymousInnerClass(this, _fs, pageCache, _config, logService, _jobScheduler); try { NewUpgrader(upgradableDatabase, pageCache, progressMonitor, CreateIndexMigrator(), failingStoreMigrator).migrateIfNeeded(_workingDatabaseLayout); fail("Should throw exception"); } catch (Exception e) { assertEquals("This upgrade is failing", e.Message); } progressMonitor = new SilentMigrationProgressMonitor(); StoreMigrator migrator = new StoreMigrator(_fs, pageCache, _config, logService, _jobScheduler); SchemaIndexMigrator indexMigrator = CreateIndexMigrator(); NewUpgrader(upgradableDatabase, pageCache, progressMonitor, indexMigrator, migrator).migrateIfNeeded(_workingDatabaseLayout); assertTrue(checkNeoStoreHasDefaultFormatVersion(check, _workingDatabaseLayout)); // Since consistency checker is in read only mode we need to start/stop db to generate label scan store. StartStopDatabase(_workingDatabaseLayout.databaseDirectory()); assertConsistentStore(_workingDatabaseLayout); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldBeAbleToResumeMigrationOnMoving() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldBeAbleToResumeMigrationOnMoving() { // GIVEN a legacy database 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); CountsMigrator countsMigrator = new CountsMigrator(_fs, pageCache, _config); DatabaseLayout migrationLayout = _directory.databaseLayout(StoreUpgrader.MIGRATION_DIRECTORY); migrator.Migrate(databaseLayout, migrationLayout, progressMonitor.StartSection("section"), versionToMigrateFrom, upgradableDatabase.CurrentVersion()); countsMigrator.Migrate(databaseLayout, migrationLayout, progressMonitor.StartSection("section"), versionToMigrateFrom, upgradableDatabase.CurrentVersion()); // WHEN simulating resuming the migration migrator = new StoreMigrator(_fs, pageCache, _config, logService, _jobScheduler); countsMigrator = new CountsMigrator(_fs, pageCache, _config); migrator.MoveMigratedFiles(migrationLayout, databaseLayout, versionToMigrateFrom, upgradableDatabase.CurrentVersion()); countsMigrator.MoveMigratedFiles(migrationLayout, databaseLayout, versionToMigrateFrom, upgradableDatabase.CurrentVersion()); // THEN starting the new store should be successful StoreFactory storeFactory = new StoreFactory(databaseLayout, _config, new DefaultIdGeneratorFactory(_fs), pageCache, _fs, logService.InternalLogProvider, EmptyVersionContextSupplier.EMPTY); storeFactory.OpenAllNeoStores().close(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void doNotReheatAfterStop() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void DoNotReheatAfterStop() { using (PageCache pageCache = _pageCacheRule.getPageCache(_fs, _cfg), PagedFile ignore = pageCache.Map(_file, pageCache.PageSize(), StandardOpenOption.CREATE)) { PageCacheWarmer warmer = new PageCacheWarmer(_fs, pageCache, _scheduler, _testDirectory.databaseDir()); warmer.Start(); warmer.Stop(); assertSame(long?.empty(), warmer.Reheat()); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldSetAllCoreState() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldSetAllCoreState() { // given int nodeCount = 100; FileSystemAbstraction fileSystem = _fileSystemRule.get(); File classicNeo4jStore = ClassicNeo4jStore.builder(_testDirectory.directory(), fileSystem).amountOfNodes(nodeCount).build().StoreDir; PageCache pageCache = _pageCacheRule.getPageCache(fileSystem); DatabaseLayout databaseLayout = DatabaseLayout.of(classicNeo4jStore); CoreBootstrapper bootstrapper = new CoreBootstrapper(databaseLayout, pageCache, fileSystem, Config.defaults(), NullLogProvider.Instance, new Monitors()); BootstrapAndVerify(nodeCount, fileSystem, databaseLayout, pageCache, Config.defaults(), bootstrapper); }
//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() { this._pageCache = _pageCacheRule.getPageCache(_fileSystem); _config = new Config(); _config.workDurationMinutes(1); }
//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() { _fs = FileSystemRule.get(); _pageCache = PageCacheRule.getPageCache(_fs); _storeFiles = new StoreFiles(_fs, _pageCache); _logFiles = LogFilesBuilder.logFilesBasedOnlyBuilder(TestDirectory.directory(), _fs).build(); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: protected void createStoreFile(java.io.File storeFile) throws java.io.IOException protected internal override void CreateStoreFile( File storeFile ) { IList<long> initialKeys = initialKeys(); PageCache pageCache = _pageCacheRule.getPageCache( GlobalFs.get() ); using ( GBPTree<MutableLong, MutableLong> tree = ( new GBPTreeBuilder<MutableLong, MutableLong>( pageCache, storeFile, Layout ) ).build() ) { using ( Writer<MutableLong, MutableLong> writer = tree.Writer() ) { foreach ( long? key in initialKeys ) { Put( writer, key.Value ); } } tree.Checkpoint( Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited ); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPackTheHighestTxCommittedAsObligation() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldPackTheHighestTxCommittedAsObligation() { // GIVEN LogicalTransactionStore transactionStore = mock(typeof(LogicalTransactionStore)); FileSystemAbstraction fs = _fsRule.get(); PageCache pageCache = _pageCacheRule.getPageCache(fs); using (NeoStores neoStore = CreateNeoStore(fs, pageCache)) { MetaDataStore store = neoStore.MetaDataStore; store.TransactionCommitted(2, 111, BASE_TX_COMMIT_TIMESTAMP); store.TransactionCommitted(3, 222, BASE_TX_COMMIT_TIMESTAMP); store.TransactionCommitted(4, 333, BASE_TX_COMMIT_TIMESTAMP); store.TransactionCommitted(5, 444, BASE_TX_COMMIT_TIMESTAMP); store.TransactionCommitted(6, 555, BASE_TX_COMMIT_TIMESTAMP); // skip 7 to emulate the fact we have an hole in the committed tx ids list const long expectedTxId = 8L; store.TransactionCommitted(expectedTxId, 777, BASE_TX_COMMIT_TIMESTAMP); ResponsePacker packer = new ResponsePacker(transactionStore, store, Suppliers.singleton(newStoreIdForCurrentVersion())); // WHEN Response <object> response = packer.PackTransactionObligationResponse(new RequestContext(0, 0, 0, 0, 0), new object()); // THEN assertTrue(response is TransactionObligationResponse); (( TransactionObligationResponse )response).accept(new HandlerAnonymousInnerClass(this, expectedTxId)); } }
//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() { _fs = _fsRule.get(); _pageCache = _pageCacheRule.getPageCache(_fs); _fakePageCursorOverflow = false; _pageCacheWithFakeOverflow = new DelegatingPageCacheAnonymousInnerClass(this, _pageCache); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private GBPTree<KEY,VALUE> createIndex() throws java.io.IOException private GBPTree <KEY, VALUE> CreateIndex() { // some random padding _layout = GetLayout(Random); PageCache pageCache = _pageCacheRule.getPageCache(_fs.get(), config().withPageSize(512).withAccessChecks(true)); return(_index = (new GBPTreeBuilder <KEY, VALUE>(pageCache, _directory.file("index"), _layout)).build()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void withCursor(java.io.File storeFile, boolean create, System.Action<org.neo4j.io.pagecache.PageCursor> cursorConsumer) throws java.io.IOException private void WithCursor(File storeFile, bool create, System.Action <PageCursor> cursorConsumer) { OpenOption[] openOptions = create ? new OpenOption[] { StandardOpenOption.WRITE, StandardOpenOption.CREATE } : new OpenOption[] { StandardOpenOption.WRITE }; using (PageCache pageCache = PageCacheRule.getPageCache(GlobalFs.get()), PagedFile pagedFile = pageCache.Map(storeFile, pageCache.PageSize(), openOptions), PageCursor cursor = pagedFile.Io(0, Org.Neo4j.Io.pagecache.PagedFile_Fields.PfSharedWriteLock)) { cursor.Next(); cursorConsumer(cursor); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void before() public virtual void Before() { FileSystemAbstraction fs = FileSystemRule.get(); DefaultIdGeneratorFactory idGeneratorFactory = new DefaultIdGeneratorFactory(fs); PageCache pageCache = PageCacheRule.getPageCache(fs); StoreFactory factory = new StoreFactory(TestDirectory.databaseLayout(), Config.defaults(), idGeneratorFactory, pageCache, fs, NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY); _neoStores = factory.OpenAllNeoStores(true); _arrayStore = _neoStores.PropertyStore.ArrayStore; }
//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() { ValueCreatorUtil = CreateValueCreatorUtil(); IndexDescriptor = ValueCreatorUtil.indexDescriptor(); Layout = CreateLayout(); IndexDirectoryStructure = directoriesByProvider(_directory.directory("root")).forProvider(IndexDescriptor.providerDescriptor()); _indexFile = IndexDirectoryStructure.directoryForIndex(IndexDescriptor.Id); Fs.mkdirs(_indexFile.ParentFile); PageCache = _pageCacheRule.getPageCache(Fs); }
//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() { _fileSystem = _fileSystemRule.get(); PageCache pageCache = _pageCacheRule.getPageCache(_fileSystem); _workingStoreDir = _testDir.storeDir("working_" + Version); _workingDatabaseLayout = _testDir.databaseLayout(_workingStoreDir); _check = new StoreVersionCheck(pageCache); File prepareDirectory = _testDir.directory("prepare_" + Version); prepareSampleLegacyDatabase(Version, _fileSystem, _workingDatabaseLayout.databaseDirectory(), prepareDirectory); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void databaseHealthShouldBeHealedOnStart() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void DatabaseHealthShouldBeHealedOnStart() { NeoStoreDataSource theDataSource = null; try { DatabaseHealth databaseHealth = new DatabaseHealth(mock(typeof(DatabasePanicEventGenerator)), NullLogProvider.Instance.getLog(typeof(DatabaseHealth))); Dependencies dependencies = new Dependencies(); dependencies.SatisfyDependency(databaseHealth); theDataSource = DsRule.getDataSource(Dir.databaseLayout(), Fs.get(), PageCacheRule.getPageCache(Fs.get()), dependencies); databaseHealth.Panic(new Exception()); theDataSource.Start(); databaseHealth.AssertHealthy(typeof(Exception)); } finally { if (theDataSource != null) { theDataSource.Stop(); theDataSource.Shutdown(); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHaltUpgradeIfUpgradeConfigurationVetoesTheProcess() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldHaltUpgradeIfUpgradeConfigurationVetoesTheProcess() { PageCache pageCache = _pageCacheRule.getPageCache(_fileSystem); Config deniedMigrationConfig = Config.defaults(GraphDatabaseSettings.allow_upgrade, "false"); deniedMigrationConfig.Augment(GraphDatabaseSettings.record_format, Standard.LATEST_NAME); UpgradableDatabase upgradableDatabase = GetUpgradableDatabase(pageCache); try { NewUpgrader(upgradableDatabase, deniedMigrationConfig, pageCache).migrateIfNeeded(_databaseLayout); fail("Should throw exception"); } catch (UpgradeNotAllowedByConfigurationException) { // expected } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void backedUpDatabaseContainsChecksumOfLastTx() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void BackedUpDatabaseContainsChecksumOfLastTx() { ServerInterface server = null; try { CreateInitialDataSet(_serverStorePath); int backupPort = PortAuthority.allocatePort(); server = StartServer(_serverStorePath, backupPort); OnlineBackup backup = OnlineBackup.From("127.0.0.1", backupPort); backup.Full(_backupDatabasePath.Path); assertTrue("Should be consistent", backup.Consistent); ShutdownServer(server); server = null; PageCache pageCache = _pageCacheRule.getPageCache(_fileSystemRule.get()); long firstChecksum = LastTxChecksumOf(_serverStoreLayout, pageCache); assertEquals(firstChecksum, LastTxChecksumOf(_backupDatabaseLayout, pageCache)); AddMoreData(_serverStorePath); server = StartServer(_serverStorePath, backupPort); backup.incremental(_backupDatabasePath.Path); assertTrue("Should be consistent", backup.Consistent); ShutdownServer(server); server = null; long secondChecksum = LastTxChecksumOf(_serverStoreLayout, pageCache); assertEquals(secondChecksum, LastTxChecksumOf(_backupDatabaseLayout, pageCache)); assertTrue(firstChecksum != secondChecksum); } finally { if (server != null) { ShutdownServer(server); } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setupTwoIndexes() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SetupTwoIndexes() { _pageCache = _pageCacheRule.getPageCache(Fs); // Define two indexes based on different labels and different configuredSettings _layoutUtil1 = CreateLayoutTestUtil(_indexId1, 42); _layoutUtil2 = CreateLayoutTestUtil(_indexId2, 43); _schemaIndexDescriptor1 = _layoutUtil1.indexDescriptor(); _schemaIndexDescriptor2 = _layoutUtil2.indexDescriptor(); // Create the two indexes as empty, based on differently configured configuredSettings above CreateEmptyIndex(_schemaIndexDescriptor1, _configuredSettings1); CreateEmptyIndex(_schemaIndexDescriptor2, _configuredSettings2); }
//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); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void doRace(System.Func<NumberArray,int,Runnable> contestantCreator) throws Throwable private void DoRace(System.Func <NumberArray, int, ThreadStart> contestantCreator) { PageCache pageCache = _pageCacheRule.getPageCache(_fs); PagedFile file = pageCache.Map(_dir.file("file"), pageCache.PageSize(), CREATE, DELETE_ON_CLOSE); Race race = new Race(); using (NumberArray array = GetNumberArray(file)) { for (int i = 0; i < CONTESTANTS; i++) { race.AddContestant(contestantCreator(array, i)); } race.Go(); } }
//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() { FileSystem = FileSystemRule.get(); DatabaseLayout = TestDirectory.databaseLayout(); // doesn't matter which version we pick we are changing it to the wrong one... MigrationTestUtils.FindFormatStoreDirectoryForVersion(StandardV2_3.STORE_VERSION, DatabaseLayout.databaseDirectory()); changeVersionNumber(FileSystem, DatabaseLayout.file(NEOSTORE_FILENAME), Version); File metadataStore = DatabaseLayout.metadataStore(); PageCache pageCache = PageCacheRule.getPageCache(FileSystem); MetaDataStore.setRecord(pageCache, metadataStore, STORE_VERSION, MetaDataStore.versionStringToLong(Version)); VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel>(); LogFiles logFiles = LogFilesBuilder.logFilesBasedOnlyBuilder(DatabaseLayout.databaseDirectory(), FileSystem).build(); TailScanner = new LogTailScanner(logFiles, logEntryReader, new Monitors()); }
//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: @Before public void before() public virtual void Before() { PageCache pageCache = _pageCacheRule.getPageCache(_fileSystem); _store = _life.add(new NativeLabelScanStore(pageCache, _directory.databaseLayout(), _fileSystem, Org.Neo4j.Kernel.Impl.Api.scan.FullStoreChangeStream_Fields.Empty, false, new Monitors(), RecoveryCleanupWorkCollector.immediate(), Math.Min(pageCache.PageSize(), 256 << _random.Next(5)))); }
private LabelScanStore GetLabelScanStore(FileSystemAbstraction fileSystemAbstraction, DatabaseLayout databaseLayout, FullStoreChangeStream fullStoreChangeStream, bool readOnly, Monitors monitors) { PageCache pageCache = PageCacheRule.getPageCache(fileSystemAbstraction); return(new NativeLabelScanStore(pageCache, databaseLayout, fileSystemAbstraction, fullStoreChangeStream, readOnly, monitors, RecoveryCleanupWorkCollector.immediate())); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void fullBackupIsRecoveredAndConsistent() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void FullBackupIsRecoveredAndConsistent() { // given database exists with data Cluster cluster = StartCluster(RecordFormat); CreateSomeData(cluster); string address = cluster.awaitLeader().Config().get(online_backup_server).ToString(); string name = System.Guid.randomUUID().ToString(); File backupLocation = new File(_backupStoreDir, name); DatabaseLayout backupLayout = DatabaseLayout.of(backupLocation); // when assertEquals(0, RunBackupToolFromOtherJvmToGetExitCode("--from", address, "--cc-report-dir=" + _backupStoreDir, "--backup-dir=" + _backupStoreDir, "--name=" + name)); // then assertFalse("Store should not require recovery", (new RecoveryRequiredChecker(_fileSystemRule, _pageCacheRule.getPageCache(_fileSystemRule), Config.defaults(), new Monitors())).isRecoveryRequiredAt(backupLayout)); ConsistencyFlags consistencyFlags = new ConsistencyFlags(true, true, true, true, true); assertTrue("Consistency check failed", new ConsistencyCheckService() .runFullConsistencyCheck(backupLayout, Config.defaults(), ProgressMonitorFactory.NONE, NullLogProvider.Instance, false, consistencyFlags).Successful); }
private PageCache CreatePageCache() { return(_pageCacheRule.getPageCache(_fs.get())); }
//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() { _config = _config(); _storeFactory = new StoreFactory(_testDirectory.databaseLayout(), _config, new DefaultIdGeneratorFactory(_fs.get()), _pageCacheRule.getPageCache(_fs.get()), _fs.get(), NullLogProvider.Instance, EmptyVersionContextSupplier.EMPTY); }
//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() { _databaseLayout = Dir.databaseLayout(); _fs = FsRule.get(); _pageCache = PageCacheRule.getPageCache(_fs); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void setupPageCache() public virtual void SetupPageCache() { _pageCache = _pageCacheRule.getPageCache(_fsRule.get()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void verifyFixedSizeStoresCanRebuildIdGeneratorSlowly() public virtual void VerifyFixedSizeStoresCanRebuildIdGeneratorSlowly() { // Given we have a store ... Config config = Config.defaults(GraphDatabaseSettings.rebuild_idgenerators_fast, "false"); File storeFile = _testDirectory.file("nodes"); File idFile = _testDirectory.file("idNodes"); DynamicArrayStore labelStore = mock(typeof(DynamicArrayStore)); NodeStore store = new NodeStore(storeFile, idFile, config, new DefaultIdGeneratorFactory(_fs), PageCacheRule.getPageCache(_fs), NullLogProvider.Instance, labelStore, RecordFormatSelector.defaultFormat()); store.Initialise(true); store.MakeStoreOk(); // ... that contain a number of records ... NodeRecord record = new NodeRecord(0); record.InUse = true; int highestId = 50; for (int i = 0; i < highestId; i++) { assertThat(store.NextId(), @is((long)i)); record.Id = i; store.UpdateRecord(record); } store.HighestPossibleIdInUse = highestId; // ... and some have been deleted long?[] idsToFree = new long?[] { 2L, 3L, 5L, 7L }; record.InUse = false; foreach (long toDelete in idsToFree) { record.Id = toDelete; store.UpdateRecord(record); } // Then when we rebuild the id generator store.RebuildIdGenerator(); store.CloseIdGenerator(); store.OpenIdGenerator(); // simulate a restart to allow id reuse // We should observe that the ids above got freed IList <long> nextIds = new List <long>(); nextIds.Add(store.NextId()); // 2 nextIds.Add(store.NextId()); // 3 nextIds.Add(store.NextId()); // 5 nextIds.Add(store.NextId()); // 7 nextIds.Add(store.NextId()); // 51 assertThat(nextIds, contains(2L, 3L, 5L, 7L, 50L)); store.Close(); }