internal GenericNativeIndexAccessor(PageCache pageCache, FileSystemAbstraction fs, File storeFile, IndexLayout <GenericKey, NativeIndexValue> layout, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, IndexProvider.Monitor monitor, StoreIndexDescriptor descriptor, IndexSpecificSpaceFillingCurveSettingsCache spaceFillingCurveSettings, SpaceFillingCurveConfiguration configuration, IndexDropAction dropAction, bool readOnly) : base(pageCache, fs, storeFile, layout, monitor, descriptor, new SpaceFillingCurveSettingsWriter(spaceFillingCurveSettings), readOnly) { this._spaceFillingCurveSettings = spaceFillingCurveSettings; this._configuration = configuration; this._dropAction = dropAction; instantiateTree(recoveryCleanupWorkCollector, HeaderWriter); }
//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)); } }
internal RotationStrategy(FileSystemAbstraction fs, PageCache pages, ProgressiveFormat format, RotationMonitor monitor) { this.Fs = fs; this.Pages = pages; this._format = format; this._monitor = monitor; }
protected internal override IndexStorageFactory buildIndexStorageFactory(FileSystemAbstraction fileSystem, DirectoryFactory directoryFactory) { FaultyIndexStorageFactory storageFactory = new FaultyIndexStorageFactory(_outerInstance, _faultyIndexId, _error, directoryFactory, directoryStructure()); _reference.set(storageFactory); return(storageFactory); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void databaseNotStartInReadOnlyModeWithMissingIndex() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void DatabaseNotStartInReadOnlyModeWithMissingIndex() { File databaseDir = TestDirectory.databaseDir(); FileSystemAbstraction fs = TestDirectory.FileSystem; CreateIndex(databaseDir, fs); DeleteIndexFolder(databaseDir, fs); GraphDatabaseService readGraphDb = null; try { readGraphDb = (new TestGraphDatabaseFactory()).setFileSystem(fs).newImpermanentDatabaseBuilder(databaseDir).setConfig(GraphDatabaseSettings.read_only, Settings.TRUE).newGraphDatabase(); fail("Should have failed"); } catch (Exception e) { Exception rootCause = Exceptions.rootCause(e); assertTrue(rootCause is System.InvalidOperationException); assertTrue(rootCause.Message.contains("Some indexes need to be rebuilt. This is not allowed in read only mode. Please start db in writable mode to rebuild indexes. Indexes " + "needing rebuild:")); } finally { if (readGraphDb != null) { readGraphDb.Shutdown(); } } }
private BackupOutcome FullBackup(FileSystemAbstraction fileSystem, string sourceHostNameOrIp, int sourcePort, DatabaseLayout targetLayout, ConsistencyCheck consistencyCheck, Config tuningConfiguration, long timeout, bool forensics) { try { if (!DirectoryIsEmpty(targetLayout)) { throw new Exception("Can only perform a full backup into an empty directory but " + targetLayout + " is not empty"); } long timestamp = DateTimeHelper.CurrentUnixTimeMillis(); long lastCommittedTx = -1; //JAVA TO C# CONVERTER WARNING: The .NET Type.FullName property will not always yield results identical to the Java Class.getName method: StoreCopyClient storeCopier = new StoreCopyClient(targetLayout, tuningConfiguration, LoadKernelExtensions(), _logProvider, fileSystem, _pageCacheContianer.PageCache, _monitors.newMonitor(typeof(StoreCopyClientMonitor), this.GetType().FullName), forensics); FullBackupStoreCopyRequester storeCopyRequester = new FullBackupStoreCopyRequester(sourceHostNameOrIp, sourcePort, timeout, forensics, _monitors); storeCopier.CopyStore(storeCopyRequester, Org.Neo4j.Helpers.CancellationRequest_Fields.NeverCancelled, MoveAfterCopy.moveReplaceExisting()); tuningConfiguration.augment(logs_directory, targetLayout.databaseDirectory().toPath().toRealPath().ToString()); File debugLogFile = tuningConfiguration.get(store_internal_log_path); BumpDebugDotLogFileVersion(debugLogFile, timestamp); bool consistent = CheckDbConsistency(fileSystem, targetLayout, consistencyCheck, tuningConfiguration, _pageCacheContianer.PageCache); ClearIdFiles(fileSystem, targetLayout); return(new BackupOutcome(lastCommittedTx, consistent)); } catch (Exception e) { throw e; } catch (Exception e) { throw new Exception(e); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void mustDisableStripingIfToldTo() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: internal virtual void MustDisableStripingIfToldTo() { // given int bytesPerPage = 32; PageSwapperFactory factory = CreateSwapperFactory(); FileSystemAbstraction fs = mock(typeof(FileSystemAbstraction)); StoreChannel channel = mock(typeof(StoreChannel)); when(channel.TryLock()).thenReturn(mock(typeof(FileLock))); when(fs.Create(any(typeof(File)))).thenReturn(channel); when(fs.Open(any(typeof(File)), any())).thenReturn(channel); // when factory.Open(fs, Configuration.EMPTY); PageSwapper swapper = CreateSwapper(factory, _file, bytesPerPage, NoCallback, true, true); try { // then verify(fs, times(1)).open(eq(_file), any(typeof(OpenMode))); } finally { swapper.Close(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldAlwaysShutdownLifeEvenWhenCheckPointingFails() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldAlwaysShutdownLifeEvenWhenCheckPointingFails() { // Given FileSystemAbstraction fs = this.Fs.get(); PageCache pageCache = PageCacheRule.getPageCache(fs); DatabaseHealth databaseHealth = mock(typeof(DatabaseHealth)); when(databaseHealth.Healthy).thenReturn(true); IOException ex = new IOException("boom!"); doThrow(ex).when(databaseHealth).assertHealthy(typeof(IOException)); // <- this is a trick to simulate a failure during checkpointing Dependencies dependencies = new Dependencies(); dependencies.SatisfyDependencies(databaseHealth); NeoStoreDataSource dataSource = DsRule.getDataSource(Dir.databaseLayout(), fs, pageCache, dependencies); dataSource.Start(); try { // When dataSource.Stop(); fail("it should have thrown"); } catch (LifecycleException e) { // Then assertEquals(ex, e.InnerException); } }
//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(); File storeDir = TestDirectory.databaseDir(); _builder = (new TestGraphDatabaseFactory()).setFileSystem(new UncloseableDelegatingFileSystemAbstraction(_fs)).newImpermanentDatabaseBuilder(storeDir); }
//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(); }
public override void AfterEach(ExtensionContext context) { Profiler profiler = GetStoredValue(context); try { profiler.Finish(); if (context.ExecutionException.Present) { ExtensionContext.Store testDirStore = GetStore(context, TestDirectoryExtension.TestDirectoryNamespace); TestDirectory testDir = ( TestDirectory )testDirStore.get(TestDirectoryExtension.TEST_DIRECTORY); File profileOutputFile = testDir.CreateFile("profiler-output.txt"); FileSystemAbstraction fs = testDir.FileSystem; using (PrintStream @out = new PrintStream(fs.OpenAsOutputStream(profileOutputFile, false))) { string displayName = context.TestClass.map(Type.getSimpleName).orElse("class") + "." + context.DisplayName; profiler.PrintProfile(@out, displayName); } } } catch (Exception e) { throw new JUnitException("Failed to finish profiling and/or produce profiling output.", e); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private StoreLogService(org.neo4j.logging.LogProvider userLogProvider, org.neo4j.io.fs.FileSystemAbstraction fileSystem, java.io.File internalLog, java.util.Map<String, org.neo4j.logging.Level> logLevels, org.neo4j.logging.Level defaultLevel, java.time.ZoneId logTimeZone, long internalLogRotationThreshold, long internalLogRotationDelay, int maxInternalLogArchives, java.util.concurrent.Executor rotationExecutor, final System.Action<org.neo4j.logging.LogProvider> rotationListener) throws java.io.IOException //JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: private StoreLogService(LogProvider userLogProvider, FileSystemAbstraction fileSystem, File internalLog, IDictionary <string, Level> logLevels, Level defaultLevel, ZoneId logTimeZone, long internalLogRotationThreshold, long internalLogRotationDelay, int maxInternalLogArchives, Executor rotationExecutor, System.Action <LogProvider> rotationListener) { if (!internalLog.ParentFile.exists()) { fileSystem.Mkdirs(internalLog.ParentFile); } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.logging.FormattedLogProvider.Builder internalLogBuilder = org.neo4j.logging.FormattedLogProvider.withZoneId(logTimeZone).withDefaultLogLevel(defaultLevel).withLogLevels(logLevels); FormattedLogProvider.Builder internalLogBuilder = FormattedLogProvider.withZoneId(logTimeZone).withDefaultLogLevel(defaultLevel).withLogLevels(logLevels); FormattedLogProvider internalLogProvider; if (internalLogRotationThreshold == 0) { Stream outputStream = createOrOpenAsOutputStream(fileSystem, internalLog, true); internalLogProvider = internalLogBuilder.ToOutputStream(outputStream); rotationListener(internalLogProvider); this._closeable = outputStream; } else { RotatingFileOutputStreamSupplier rotatingSupplier = new RotatingFileOutputStreamSupplier(fileSystem, internalLog, internalLogRotationThreshold, internalLogRotationDelay, maxInternalLogArchives, rotationExecutor, new RotationListenerAnonymousInnerClass(this, rotationListener, internalLogBuilder)); internalLogProvider = internalLogBuilder.ToOutputStream(rotatingSupplier); this._closeable = rotatingSupplier; } this._logService = new SimpleLogService(userLogProvider, internalLogProvider); }
public IndexConfigStore(DatabaseLayout dbDirectoryStructure, FileSystemAbstraction fileSystem) { this._dbDirectoryStructure = dbDirectoryStructure; this._fileSystem = fileSystem; this._file = dbDirectoryStructure.File(INDEX_DB_FILE_NAME); this._oldFile = dbDirectoryStructure.File(_oldIndexDbFileName); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public static void run(final org.neo4j.io.fs.FileSystemAbstraction fs, final java.io.File storeDirectory, org.neo4j.kernel.configuration.Config config, org.neo4j.logging.LogProvider userLogProvider) throws Exception //JAVA TO C# CONVERTER WARNING: 'final' parameters are ignored unless the option to convert to C# 7.2 'in' parameters is selected: public static void Run(FileSystemAbstraction fs, File storeDirectory, Config config, LogProvider userLogProvider) { StoreLogService logService = StoreLogService.withUserLogProvider(userLogProvider).withInternalLog(config.Get(store_internal_log_path)).build(fs); VisibleMigrationProgressMonitor progressMonitor = new VisibleMigrationProgressMonitor(logService.GetUserLog(typeof(StoreMigration))); LifeSupport life = new LifeSupport(); life.Add(logService); // Add participants from kernel extensions... DefaultExplicitIndexProvider migrationIndexProvider = new DefaultExplicitIndexProvider(); Log log = userLogProvider.GetLog(typeof(StoreMigration)); JobScheduler jobScheduler = JobSchedulerFactory.createInitialisedScheduler(); try { using (PageCache pageCache = createPageCache(fs, config, jobScheduler)) { Dependencies deps = new Dependencies(); Monitors monitors = new Monitors(); deps.SatisfyDependencies(fs, config, migrationIndexProvider, pageCache, logService, monitors, RecoveryCleanupWorkCollector.immediate()); KernelContext kernelContext = new SimpleKernelContext(storeDirectory, DatabaseInfo.UNKNOWN, deps); DatabaseKernelExtensions kernelExtensions = life.Add(new DatabaseKernelExtensions(kernelContext, GraphDatabaseDependencies.newDependencies().kernelExtensions(), deps, ignore())); DatabaseLayout databaseLayout = DatabaseLayout.of(storeDirectory); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.neo4j.kernel.impl.transaction.log.files.LogFiles logFiles = org.neo4j.kernel.impl.transaction.log.files.LogFilesBuilder.activeFilesBuilder(databaseLayout, fs, pageCache).withConfig(config).build(); LogFiles logFiles = LogFilesBuilder.activeFilesBuilder(databaseLayout, fs, pageCache).withConfig(config).build(); LogTailScanner tailScanner = new LogTailScanner(logFiles, new VersionAwareLogEntryReader <Org.Neo4j.Kernel.impl.transaction.log.ReadableClosablePositionAwareChannel>(), monitors); DefaultIndexProviderMap indexProviderMap = life.Add(new DefaultIndexProviderMap(kernelExtensions, config)); // Add the kernel store migrator life.Start(); long startTime = DateTimeHelper.CurrentUnixTimeMillis(); DatabaseMigrator migrator = new DatabaseMigrator(progressMonitor, fs, config, logService, indexProviderMap, migrationIndexProvider, pageCache, RecordFormatSelector.selectForConfig(config, userLogProvider), tailScanner, jobScheduler); migrator.Migrate(databaseLayout); // Append checkpoint so the last log entry will have the latest version AppendCheckpoint(logFiles, tailScanner); long duration = DateTimeHelper.CurrentUnixTimeMillis() - startTime; log.Info(format("Migration completed in %d s%n", duration / 1000)); } } catch (Exception e) { throw new StoreUpgrader.UnableToUpgradeException("Failure during upgrade", e); } finally { life.Shutdown(); jobScheduler.close(); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: StoreFileImpl(ManagementData management) throws javax.management.NotCompliantMBeanException internal StoreFileImpl(ManagementData management) : base(management) { Fs = management.KernelData.FilesystemAbstraction; DataSourceManager dataSourceManager = management.KernelData.DataSourceManager; dataSourceManager.AddListener(new ListenerAnonymousInnerClass(this)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @BeforeEach public void setUp() throws java.io.IOException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void SetUp() { _fixture = CreateFixture(); Thread.interrupted(); // Clear stray interrupts Fs = CreateFileSystemAbstraction(); JobScheduler = new ThreadPoolJobScheduler(); EnsureExists(File("a")); }
public LuceneIndexImplementation(DatabaseLayout databaseLayout, Config config, System.Func <IndexConfigStore> indexStore, FileSystemAbstraction fileSystemAbstraction, OperationalMode operationalMode) { this._databaseLayout = databaseLayout; this._config = config; this._indexStore = indexStore; this._fileSystemAbstraction = fileSystemAbstraction; this._operationalMode = operationalMode; }
public ParameterisedOutsideWorld(Console console, Stream stdout, Stream stderr, Stream stdin, FileSystemAbstraction fileSystemAbstraction) { this._stdout = new PrintStream(stdout); this._stderr = new PrintStream(stderr); this._stdin = stdin; this._fileSystemAbstraction = fileSystemAbstraction; this._console = console; }
internal PageCacheWarmer(FileSystemAbstraction fs, PageCache pageCache, JobScheduler scheduler, File databaseDirectory) { this._fs = fs; this._pageCache = pageCache; this._scheduler = scheduler; this._databaseDirectory = databaseDirectory; this._refCounts = new ProfileRefCounts(); }
internal DiagnosticsReportCommand(Path homeDir, Path configDir, OutsideWorld outsideWorld) { this._homeDir = homeDir; this._configDir = configDir; this._fs = outsideWorld.FileSystem(); this.@out = outsideWorld.OutStream(); _err = outsideWorld.ErrorStream(); }
protected internal NativeIndexProvider(IndexProviderDescriptor descriptor, Factory directoryStructureFactory, PageCache pageCache, FileSystemAbstraction fs, Monitor monitor, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, bool readOnly) : base(descriptor, directoryStructureFactory) { this.PageCache = pageCache; this.Fs = fs; this.Monitor = monitor; this.RecoveryCleanupWorkCollector = recoveryCleanupWorkCollector; this.ReadOnly = readOnly; }
public StoreCopyServer(NeoStoreDataSource dataSource, CheckPointer checkPointer, FileSystemAbstraction fileSystem, File databaseDirectory, Monitor monitor) { this._dataSource = dataSource; this._checkPointer = checkPointer; this._fileSystem = fileSystem; this._databaseDirectory = getCanonicalFile(databaseDirectory); this._monitor = monitor; }
//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 = PageCacheAndDependenciesRule.fileSystem(); GraphDbDir = PageCacheAndDependenciesRule.directory().databaseDir(); PageCache pageCache = PageCacheAndDependenciesRule.pageCache(); IndexProvider = TestSuite.createIndexProvider(pageCache, Fs, GraphDbDir); }
/// <summary> /// Builder for fully functional transactional log files. /// Log files will be able to access store and external components information, perform rotations, etc. </summary> /// <param name="databaseLayout"> database directory </param> /// <param name="fileSystem"> log files filesystem </param> public static LogFilesBuilder Builder(DatabaseLayout databaseLayout, FileSystemAbstraction fileSystem) { LogFilesBuilder filesBuilder = new LogFilesBuilder(); filesBuilder._databaseLayout = databaseLayout; filesBuilder._fileSystem = fileSystem; return(filesBuilder); }
internal CountingDeleter(LogFiles logFiles, FileSystemAbstraction fs, long upToVersion) { this.LogFiles = logFiles; this.Fs = fs; this.UpToVersion = upToVersion; FromVersion = NO_VERSION; ToVersion = NO_VERSION; }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private java.io.OutputStream badOutputFile() throws java.io.IOException private Stream BadOutputFile() { File badDataPath = (new File("/tmp/foo2")).AbsoluteFile; FileSystemAbstraction fileSystem = Fs.get(); File badDataFile = badDataFile(fileSystem, badDataPath); return(fileSystem.OpenAsOutputStream(badDataFile, true)); }
public JMXDumper(Path homeDir, FileSystemAbstraction fs, PrintStream @out, PrintStream err, bool verbose) { this._homeDir = homeDir; this._fs = fs; this._err = err; this._verbose = verbose; this.@out = @out; }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public StoreLogService build(org.neo4j.io.fs.FileSystemAbstraction fileSystem) throws java.io.IOException public virtual StoreLogService Build(FileSystemAbstraction fileSystem) { if (DebugLog == null) { throw new System.ArgumentException("Debug log can't be null; set its value using `withInternalLog`"); } return(new StoreLogService(UserLogProvider, fileSystem, DebugLog, LogLevels, DefaultLevel, TimeZoneId, InternalLogRotationThreshold, InternalLogRotationDelay, MaxInternalLogArchives, RotationExecutor, RotationListener)); }
public TemporalIndexProvider(PageCache pageCache, FileSystemAbstraction fs, IndexDirectoryStructure.Factory directoryStructure, Monitor monitor, RecoveryCleanupWorkCollector recoveryCleanupWorkCollector, bool readOnly) : base(_temporalProviderDescriptor, directoryStructure) { this._pageCache = pageCache; this._fs = fs; this._monitor = monitor; this._recoveryCleanupWorkCollector = recoveryCleanupWorkCollector; this._readOnly = readOnly; }
public StoreMigrator(FileSystemAbstraction fileSystem, PageCache pageCache, Config config, LogService logService, JobScheduler jobScheduler) : base("Store files") { this._fileSystem = fileSystem; this._pageCache = pageCache; this._config = config; this._logService = logService; this._jobScheduler = jobScheduler; }