public RecoveryRequiredChecker(FileSystemAbstraction fs, PageCache pageCache, Config config, Monitors monitors) { this._fs = fs; this._pageCache = pageCache; this._config = config; this._monitors = monitors; }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static void assertRecoveryIsNotRequired(org.neo4j.io.fs.FileSystemAbstraction fs, org.neo4j.io.pagecache.PageCache pageCache, org.neo4j.kernel.configuration.Config config, org.neo4j.io.layout.DatabaseLayout databaseLayout, org.neo4j.kernel.monitoring.Monitors monitors) throws RecoveryRequiredException, java.io.IOException public static void AssertRecoveryIsNotRequired(FileSystemAbstraction fs, PageCache pageCache, Config config, DatabaseLayout databaseLayout, Monitors monitors) { if ((new RecoveryRequiredChecker(fs, pageCache, config, monitors)).IsRecoveryRequiredAt(databaseLayout)) { throw new RecoveryRequiredException(); } }
//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() { FileSystemAbstraction fs = _fsRule.get(); _pageCache = _pageCacheRule.getPageCache(fs); _idGeneratorFactory = new DefaultIdGeneratorFactory(fs); }
public static GenericNativeIndexProvider Create(PageCache pageCache, File storeDir, FileSystemAbstraction fs, IndexProvider.Monitor monitor, Config config, OperationalMode mode, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector) { IndexDirectoryStructure.Factory directoryStructure = directoriesByProvider(storeDir); bool readOnly = config.Get(GraphDatabaseSettings.read_only) && (OperationalMode.single == mode); return(new GenericNativeIndexProvider(directoryStructure, pageCache, fs, monitor, recoveryCleanupWorkCollector, readOnly, config)); }
private StoreAccess CreateStoreWithOneHighDegreeNodeAndSeveralDegreeTwoNodes(int nDegreeTwoNodes) { File storeDirectory = _testDirectory.databaseDir(); GraphDatabaseService database = (new TestGraphDatabaseFactory()).newEmbeddedDatabaseBuilder(storeDirectory).setConfig(GraphDatabaseSettings.record_format, RecordFormatName).setConfig("dbms.backup.enabled", "false").newGraphDatabase(); using (Transaction transaction = database.BeginTx()) { Node denseNode = database.CreateNode(); for (int i = 0; i < nDegreeTwoNodes; i++) { Node degreeTwoNode = database.CreateNode(); Node leafNode = database.CreateNode(); if (i % 2 == 0) { denseNode.CreateRelationshipTo(degreeTwoNode, TestRelationshipType.Connected); } else { degreeTwoNode.CreateRelationshipTo(denseNode, TestRelationshipType.Connected); } degreeTwoNode.CreateRelationshipTo(leafNode, TestRelationshipType.Connected); } transaction.Success(); } database.Shutdown(); PageCache pageCache = PageCacheRule.getPageCache(_fileSystemRule.get()); StoreAccess storeAccess = new StoreAccess(_fileSystemRule.get(), pageCache, _testDirectory.databaseLayout(), Config.defaults()); return(storeAccess.Initialize()); }
public Builder(RecordStorageEngineRule outerInstance, FileSystemAbstraction fs, PageCache pageCache, DatabaseLayout databaseLayout) { this._outerInstance = outerInstance; this.Fs = fs; this.PageCache = pageCache; this.DatabaseLayout = databaseLayout; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldNotWantToRecoverIntactStore() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldNotWantToRecoverIntactStore() { PageCache pageCache = _pageCacheRule.getPageCache(_fileSystem); RecoveryRequiredChecker recoverer = GetRecoveryCheckerWithDefaultConfig(_fileSystem, pageCache); assertThat(recoverer.IsRecoveryRequiredAt(_databaseLayout), @is(false)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void dropShouldDeleteEntireIndexFolder() public virtual void DropShouldDeleteEntireIndexFolder() { // given File root = Storage.directory().directory("root"); IndexDirectoryStructure directoryStructure = IndexDirectoryStructure.directoriesByProvider(root).forProvider(GenericNativeIndexProvider.Descriptor); long indexId = 8; File indexDirectory = directoryStructure.DirectoryForIndex(indexId); StoreIndexDescriptor descriptor = IndexDescriptorFactory.forSchema(SchemaDescriptorFactory.forLabel(1, 1)).withId(indexId); IndexSpecificSpaceFillingCurveSettingsCache spatialSettings = mock(typeof(IndexSpecificSpaceFillingCurveSettingsCache)); PageCache pageCache = Storage.pageCache(); FileSystemAbstraction fs = Storage.fileSystem(); File indexFile = new File(indexDirectory, "my-index"); GenericLayout layout = new GenericLayout(1, spatialSettings); RecoveryCleanupWorkCollector immediate = immediate(); IndexDropAction dropAction = new FileSystemIndexDropAction(fs, directoryStructure); GenericNativeIndexPopulator populator = new GenericNativeIndexPopulator(pageCache, fs, indexFile, layout, EMPTY, descriptor, spatialSettings, directoryStructure, mock(typeof(SpaceFillingCurveConfiguration)), dropAction, false); populator.Create(); // when assertTrue(fs.ListFiles(indexDirectory).Length > 0); populator.Drop(); // then assertFalse(fs.FileExists(indexDirectory)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: static org.neo4j.kernel.impl.transaction.log.files.LogFiles readLogFiles(org.neo4j.io.layout.DatabaseLayout databaseLayout) throws java.io.IOException internal static LogFiles ReadLogFiles(DatabaseLayout databaseLayout) { FileSystemAbstraction fileSystemAbstraction = new DefaultFileSystemAbstraction(); PageCache pageCache = ConfigurableStandalonePageCacheFactory.createPageCache(fileSystemAbstraction, new ThreadPoolJobScheduler()); return(LogFilesBuilder.activeFilesBuilder(databaseLayout, fileSystemAbstraction, pageCache).build()); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private boolean isUnclean(org.neo4j.io.fs.FileSystemAbstraction fileSystem) throws java.io.IOException private bool IsUnclean(FileSystemAbstraction fileSystem) { PageCache pageCache = PageCacheRule.getPageCache(fileSystem); RecoveryRequiredChecker requiredChecker = new RecoveryRequiredChecker(fileSystem, pageCache, Config.defaults(), _monitors); return(requiredChecker.IsRecoveryRequiredAt(TestDirectory.databaseLayout())); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public TemporaryStoreDirectory(org.neo4j.io.fs.FileSystemAbstraction fs, org.neo4j.io.pagecache.PageCache pageCache, java.io.File parent) throws java.io.IOException public TemporaryStoreDirectory(FileSystemAbstraction fs, PageCache pageCache, File parent) { this._tempStoreDir = new File(parent, TEMP_COPY_DIRECTORY_NAME); this._tempDatabaseLayout = DatabaseLayout.of(_tempStoreDir, GraphDatabaseSettings.DEFAULT_DATABASE_NAME); _storeFiles = new StoreFiles(fs, pageCache, (directory, name) => true); _tempLogFiles = LogFilesBuilder.logFilesBasedOnlyBuilder(_tempDatabaseLayout.databaseDirectory(), fs).build(); _storeFiles.delete(_tempStoreDir, _tempLogFiles); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public ReadOnlyTransactionStore(org.neo4j.io.pagecache.PageCache pageCache, org.neo4j.io.fs.FileSystemAbstraction fs, org.neo4j.io.layout.DatabaseLayout fromDatabaseLayout, org.neo4j.kernel.configuration.Config config, org.neo4j.kernel.monitoring.Monitors monitors) throws java.io.IOException public ReadOnlyTransactionStore(PageCache pageCache, FileSystemAbstraction fs, DatabaseLayout fromDatabaseLayout, Config config, Monitors monitors) { TransactionMetadataCache transactionMetadataCache = new TransactionMetadataCache(); LogEntryReader <ReadableClosablePositionAwareChannel> logEntryReader = new VersionAwareLogEntryReader <ReadableClosablePositionAwareChannel>(); LogFiles logFiles = LogFilesBuilder.activeFilesBuilder(fromDatabaseLayout, fs, pageCache).withLogEntryReader(logEntryReader).withConfig(config).build(); _physicalStore = new PhysicalLogicalTransactionStore(logFiles, transactionMetadataCache, logEntryReader, monitors, true); }
public static BackupProtocolService BackupProtocolService(Stream logDestination) { JobScheduler scheduler = createInitialisedScheduler(); PageCache pageCache = createPageCache(new DefaultFileSystemAbstraction(), scheduler); BackupPageCacheContainer pageCacheContainer = of(pageCache, scheduler); //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: return(BackupProtocolService(DefaultFileSystemAbstraction::new, toOutputStream(logDestination), logDestination, new Monitors(), pageCacheContainer)); }
protected internal override IndexProvider CreateIndexProvider(PageCache pageCache, FileSystemAbstraction fs, File graphDbDir) { IndexProvider.Monitor monitor = IndexProvider.Monitor_Fields.EMPTY; Config config = Config.defaults(stringMap(default_schema_provider.name(), NATIVE10.providerName())); OperationalMode mode = OperationalMode.single; RecoveryCleanupWorkCollector recoveryCleanupWorkCollector = RecoveryCleanupWorkCollector.immediate(); return(NativeLuceneFusionIndexProviderFactory10.Create(pageCache, graphDbDir, fs, monitor, config, mode, recoveryCleanupWorkCollector)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(expected = RecoveryRequiredException.class) public void shouldThrowIfBrokenStore() throws java.io.IOException, RecoveryRequiredException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldThrowIfBrokenStore() { using (FileSystemAbstraction fileSystemAbstraction = CreateAndCrashWithDefaultConfig()) { PageCache pageCache = _pageCacheRule.getPageCache(fileSystemAbstraction); RecoveryRequiredChecker.AssertRecoveryIsNotRequired(fileSystemAbstraction, pageCache, Config.defaults(), _databaseLayout, new Monitors()); fail(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void createBackupProtocolServiceWithAllPossibleParameters() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void CreateBackupProtocolServiceWithAllPossibleParameters() { PageCache pageCache = mock(typeof(PageCache)); //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: BackupProtocolService protocolService = backupProtocolService(EphemeralFileSystemRule::new, NullLogProvider.Instance, NULL_OUTPUT_STREAM, new Monitors(), pageCache); assertNotNull(protocolService); protocolService.Close(); }
//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() { PageCache pageCache = mock(typeof(PageCache)); _fileMoveProvider = mock(typeof(FileMoveProvider)); FileSystemAbstraction fs = mock(typeof(FileSystemAbstraction)); Subject = new BackupCopyService(fs, _fileMoveProvider); }
public static void RecomputeCounts(NeoStores stores, PageCache pageCache, DatabaseLayout databaseLayout) { MetaDataStore metaDataStore = stores.MetaDataStore; CountsTracker counts = stores.Counts; using (Org.Neo4j.Kernel.Impl.Api.CountsAccessor_Updater updater = Counts.reset(metaDataStore.LastCommittedTransactionId)) { (new CountsComputer(stores, pageCache, databaseLayout)).Initialize(updater); } }
//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() { _backupLayout = TestDirectory.databaseLayout("backups"); _backupDir = _backupLayout.databaseDirectory().toPath(); _fs = new DefaultFileSystemAbstraction(); _jobScheduler = new ThreadPoolJobScheduler(); _pageCache = StandalonePageCacheFactory.createPageCache(_fs, _jobScheduler); _backupProtocolService = _backupProtocolService(); _backupTool = new BackupTool(_backupProtocolService, mock(typeof(PrintStream))); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldWantToRecoverBrokenStore() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldWantToRecoverBrokenStore() { using (FileSystemAbstraction fileSystemAbstraction = CreateAndCrashWithDefaultConfig()) { PageCache pageCache = _pageCacheRule.getPageCache(fileSystemAbstraction); RecoveryRequiredChecker recoverer = GetRecoveryCheckerWithDefaultConfig(fileSystemAbstraction, pageCache); assertThat(recoverer.IsRecoveryRequiredAt(_databaseLayout), @is(true)); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void verifyPageCacheLongArray() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void VerifyPageCacheLongArray() { PageCache pageCache = _pageCacheRule.getPageCache(_fs); PagedFile file = pageCache.Map(_dir.file("file"), pageCache.PageSize(), CREATE, DELETE_ON_CLOSE); using (LongArray array = new PageCacheLongArray(file, COUNT, 0, 0)) { VerifyBehaviour(array); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static SpaceFillingCurveSettings fromGBPTree(java.io.File indexFile, org.neo4j.io.pagecache.PageCache pageCache, System.Func<ByteBuffer,String> onError) throws java.io.IOException public static SpaceFillingCurveSettings FromGBPTree(File indexFile, PageCache pageCache, System.Func <ByteBuffer, string> onError) { SpaceFillingCurveSettings.SettingsFromIndexHeader settings = new SpaceFillingCurveSettings.SettingsFromIndexHeader(); GBPTree.readHeader(pageCache, indexFile, settings.HeaderReader(onError)); if (settings.Failed) { throw new IOException(settings.FailureMessage); } return(settings); }
//JAVA TO C# CONVERTER NOTE: Members cannot have the same name as their enclosing type: public static BatchingNeoStores BatchingNeoStoresConflict(FileSystemAbstraction fileSystem, File storeDir, RecordFormats recordFormats, Configuration config, LogService logService, AdditionalInitialIds initialIds, Config dbConfig, JobScheduler jobScheduler) { Config neo4jConfig = GetNeo4jConfig(config, dbConfig); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.io.pagecache.tracing.PageCacheTracer tracer = new org.neo4j.io.pagecache.tracing.DefaultPageCacheTracer(); PageCacheTracer tracer = new DefaultPageCacheTracer(); PageCache pageCache = CreatePageCache(fileSystem, neo4jConfig, logService.InternalLogProvider, tracer, DefaultPageCursorTracerSupplier.INSTANCE, EmptyVersionContextSupplier.EMPTY, jobScheduler); return(new BatchingNeoStores(fileSystem, pageCache, storeDir, recordFormats, neo4jConfig, config, logService, initialIds, false, tracer.bytesWritten)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void closePageCacheContainerOnClose() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void ClosePageCacheContainerOnClose() { PageCache pageCache = mock(typeof(PageCache)); BackupPageCacheContainer container = BackupPageCacheContainer.Of(pageCache); //JAVA TO C# CONVERTER TODO TASK: Method reference constructor syntax is not converted by Java to C# Converter: BackupProtocolService protocolService = new BackupProtocolService(EphemeralFileSystemAbstraction::new, NullLogProvider.Instance, NULL_OUTPUT_STREAM, new Monitors(), container); protocolService.Close(); verify(pageCache).close(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void openingThroughStoreAccessShouldNotTriggerRecovery() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void OpeningThroughStoreAccessShouldNotTriggerRecovery() { using (EphemeralFileSystemAbstraction snapshot = ProduceUncleanStore()) { assertTrue("Store should be unclean", IsUnclean(snapshot)); PageCache pageCache = PageCacheRule.getPageCache(snapshot); (new StoreAccess(snapshot, pageCache, TestDirectory.databaseLayout(), Config.defaults())).initialize().close(); assertTrue("Store should be unclean", IsUnclean(snapshot)); } }
/// <summary> /// Visit the header, that is tree state and meta information, about the tree present in the given {@code file}. /// </summary> /// <param name="pageCache"> <seealso cref="PageCache"/> able to map tree contained in {@code file}. </param> /// <param name="file"> <seealso cref="File"/> containing the tree to print header for. </param> /// <param name="visitor"> <seealso cref="GBPTreeVisitor"/> that shall visit header. </param> /// <exception cref="IOException"> on I/O error. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static void visitHeader(org.neo4j.io.pagecache.PageCache pageCache, java.io.File file, GBPTreeVisitor visitor) throws java.io.IOException public static void VisitHeader(PageCache pageCache, File file, GBPTreeVisitor visitor) { using (PagedFile pagedFile = pageCache.Map(file, pageCache.PageSize(), StandardOpenOption.READ)) { using (PageCursor cursor = pagedFile.Io(IdSpace.STATE_PAGE_A, Org.Neo4j.Io.pagecache.PagedFile_Fields.PF_SHARED_READ_LOCK)) { VisitMeta(cursor, visitor); VisitTreeState(cursor, visitor); } } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private static long readLogVersion(org.neo4j.io.pagecache.PageCache pageCache, java.io.File neoStore) throws java.io.IOException private static long ReadLogVersion(PageCache pageCache, File neoStore) { try { return(MetaDataStore.getRecord(pageCache, neoStore, MetaDataStore.Position.LOG_VERSION)); } catch (NoSuchFileException) { return(0); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void verifyChunkingArrayWithPageCacheLongArray() public virtual void VerifyChunkingArrayWithPageCacheLongArray() { PageCache pageCache = _pageCacheRule.getPageCache(_fs); File directory = _dir.directory(); NumberArrayFactory numberArrayFactory = NumberArrayFactory.auto(pageCache, directory, false, NumberArrayFactory_Fields.NoMonitor); using (LongArray array = numberArrayFactory.NewDynamicLongArray(COUNT / 1_000, 0)) { VerifyBehaviour(array); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void testHonorsPassedInParams() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TestHonorsPassedInParams() { BatchInserter inserter = BatchInserters.inserter(_testDirectory.databaseDir(), _fileSystemRule.get(), stringMap(GraphDatabaseSettings.pagecache_memory.name(), "280K")); NeoStores neoStores = ReflectionUtil.getPrivateField(inserter, "neoStores", typeof(NeoStores)); PageCache pageCache = ReflectionUtil.getPrivateField(neoStores, "pageCache", typeof(PageCache)); inserter.Shutdown(); long mappedMemoryTotalSize = MuninnPageCache.memoryRequiredForPages(pageCache.MaxCachedPages()); assertThat("memory mapped config is active", mappedMemoryTotalSize, @is(allOf(greaterThan(kibiBytes(270)), lessThan(kibiBytes(290))))); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void writePartialTx(java.io.File storeDir) throws java.io.IOException private void WritePartialTx(File storeDir) { using (PageCache pageCache = this.PageCache.getPageCache(_fs)) { LogFiles logFiles = LogFilesBuilder.activeFilesBuilder(DatabaseLayout.of(storeDir), _fs, pageCache).build(); using (Lifespan ignored = new Lifespan(logFiles)) { LogEntryWriter writer = new LogEntryWriter(logFiles.LogFile.Writer); writer.WriteStartEntry(0, 0, 0x123456789ABCDEFL, logFiles.LogFileInformation.LastEntryId + 1, new sbyte[] { 0 }); } } }