//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void flushAllPages(java.util.List<org.neo4j.io.pagecache.PagedFile> files, org.neo4j.io.pagecache.IOLimiter limiter) throws java.io.IOException private void FlushAllPages(IList <PagedFile> files, IOLimiter limiter) { foreach (PagedFile file in files) { FlushFile(( MuninnPagedFile )file, limiter); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void flushAllPagesParallel(java.util.List<org.neo4j.io.pagecache.PagedFile> files, org.neo4j.io.pagecache.IOLimiter limiter) throws java.io.IOException private void FlushAllPagesParallel(IList <PagedFile> files, IOLimiter limiter) { IList <JobHandle> flushes = new List <JobHandle>(Files.Count); // Submit all flushes to the background thread foreach (PagedFile file in files) { flushes.Add(_scheduler.schedule(Group.PAGE_CACHE, () => { try { FlushFile(( MuninnPagedFile )file, limiter); } catch (IOException e) { throw new UncheckedIOException(e); } })); } // Wait for all to complete foreach (JobHandle flush in flushes) { try { flush.WaitTermination(); } catch (Exception e) when(e is InterruptedException || e is ExecutionException) { throw new IOException(e); } } }
public override void Force(IOLimiter ioLimiter) { foreach (NativeIndexAccessor part in this) { part.force(ioLimiter); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void verifyAsyncActionCausesConcurrentFlushingRush(org.neo4j.function.ThrowingConsumer<CheckPointerImpl,java.io.IOException> asyncAction) throws Exception private void VerifyAsyncActionCausesConcurrentFlushingRush(ThrowingConsumer <CheckPointerImpl, IOException> asyncAction) { AtomicLong limitDisableCounter = new AtomicLong(); AtomicLong observedRushCount = new AtomicLong(); BinaryLatch backgroundCheckPointStartedLatch = new BinaryLatch(); BinaryLatch forceCheckPointStartLatch = new BinaryLatch(); _limiter = new IOLimiterAnonymousInnerClass4(this, limitDisableCounter, forceCheckPointStartLatch); MockTxIdStore(); CheckPointerImpl checkPointer = checkPointer(); doAnswer(invocation => { backgroundCheckPointStartedLatch.Release(); forceCheckPointStartLatch.Await(); long newValue = limitDisableCounter.get(); observedRushCount.set(newValue); return(null); }).when(_storageEngine).flushAndForce(_limiter); Future <object> forceCheckPointer = forkFuture(() => { backgroundCheckPointStartedLatch.Await(); asyncAction.Accept(checkPointer); return(null); }); when(_threshold.isCheckPointingNeeded(anyLong(), eq(_info))).thenReturn(true); checkPointer.CheckPointIfNeeded(_info); forceCheckPointer.get(); assertThat(observedRushCount.get(), @is(1L)); }
private long RepeatedlyCallMaybeLimitIO(IOLimiter ioLimiter, long stamp, int iosPerIteration) { for (int i = 0; i < 100; i++) { stamp = ioLimiter.MaybeLimitIO(stamp, iosPerIteration, _flushable); } return(stamp); }
public CheckPointScheduler(CheckPointer checkPointer, IOLimiter ioLimiter, JobScheduler scheduler, long recurringPeriodMillis, DatabaseHealth health) { this._checkPointer = checkPointer; this._ioLimiter = ioLimiter; this._scheduler = scheduler; this._recurringPeriodMillis = recurringPeriodMillis; this._health = health; }
public override void FlushAndForce(IOLimiter limiter) { _indexingService.forceAll(limiter); _labelScanStore.force(limiter); foreach (IndexImplementation index in _explicitIndexProviderLookup.allIndexProviders()) { index.Force(); } _neoStores.flush(limiter); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void mustFlushAsFastAsPossibleDuringForceCheckPoint() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MustFlushAsFastAsPossibleDuringForceCheckPoint() { AtomicBoolean doneDisablingLimits = new AtomicBoolean(); _limiter = new IOLimiterAnonymousInnerClass2(this, doneDisablingLimits); MockTxIdStore(); CheckPointerImpl checkPointer = checkPointer(); checkPointer.ForceCheckPoint(new SimpleTriggerInfo("test")); assertTrue(doneDisablingLimits.get()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void mustFlushAsFastAsPossibleDuringTryCheckPoint() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MustFlushAsFastAsPossibleDuringTryCheckPoint() { AtomicBoolean doneDisablingLimits = new AtomicBoolean(); _limiter = new IOLimiterAnonymousInnerClass3(this, doneDisablingLimits); MockTxIdStore(); CheckPointerImpl checkPointer = checkPointer(); checkPointer.TryCheckPoint(_info); assertTrue(doneDisablingLimits.get()); }
/// <summary> /// The {@code force()}-method is called during log rotation. At this time we do not want to wait for locks held by /// <seealso cref="LockingIndexUpdater"/>. Waiting on such locks would cause a serious risk of deadlocks, since very likely /// the reader we would be waiting on would be waiting on the log rotation lock held by the thread calling this /// method. The reason we would wait for a read lock while trying to acquire a read lock is if there is a third /// thread waiting on the write lock, probably an index populator wanting to /// <seealso cref="flip(Callable, FailedIndexProxyFactory) flip the index into active state"/>. /// <p/> /// We avoid this deadlock situation by "barging" on the read lock, i.e. acquire it in an <i>unfair</i> way, where /// we don't care about waiting threads, only about whether the exclusive lock is held or not. /// </summary> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void force(org.neo4j.io.pagecache.IOLimiter ioLimiter) throws java.io.IOException public override void Force(IOLimiter ioLimiter) { Barge(@lock.readLock()); // see javadoc of this method (above) for rationale on why we use barge(...) here try { @delegate.Force(ioLimiter); } finally { @lock.readLock().unlock(); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void mustUseIoLimiterFromFlushing() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void MustUseIoLimiterFromFlushing() { _limiter = new IOLimiterAnonymousInnerClass(this); when(_threshold.isCheckPointingNeeded(anyLong(), eq(_info))).thenReturn(true, false); MockTxIdStore(); CheckPointerImpl checkPointing = CheckPointer(); checkPointing.Start(); checkPointing.CheckPointIfNeeded(_info); verify(_storageEngine).flushAndForce(_limiter); }
public override void force(IOLimiter ioLimiter) { try { _actionThreadReference.get().start(); _latch.await(); } catch (Exception e) { throw new Exception(e); } }
public CheckPointerImpl(TransactionIdStore transactionIdStore, CheckPointThreshold threshold, StorageEngine storageEngine, LogPruning logPruning, TransactionAppender appender, DatabaseHealth databaseHealth, LogProvider logProvider, CheckPointTracer tracer, IOLimiter ioLimiter, StoreCopyCheckPointMutex mutex) { this._appender = appender; this._transactionIdStore = transactionIdStore; this._threshold = threshold; this._storageEngine = storageEngine; this._logPruning = logPruning; this._databaseHealth = databaseHealth; this._ioLimiter = ioLimiter; this._msgLog = logProvider.GetLog(typeof(CheckPointerImpl)); this._tracer = tracer; this._mutex = mutex; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void mustFlushStoresWithGivenIOLimiter() public virtual void MustFlushStoresWithGivenIOLimiter() { IOLimiter limiter = Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited; FileSystemAbstraction fs = _fsRule.get(); AtomicReference <IOLimiter> observedLimiter = new AtomicReference <IOLimiter>(); PageCache pageCache = new DelegatingPageCacheAnonymousInnerClass(this, _pageCacheRule.getPageCache(fs), limiter, observedLimiter); RecordStorageEngine engine = _storageEngineRule.getWith(fs, pageCache, _testDirectory.databaseLayout()).build(); engine.FlushAndForce(limiter); assertThat(observedLimiter.get(), sameInstance(limiter)); }
internal ModularDatabaseCreationContext(string databaseName, PlatformModule platformModule, DatabaseEditionContext editionContext, Procedures procedures, GraphDatabaseFacade facade) { this._databaseName = databaseName; this._config = platformModule.Config; DatabaseIdContext idContext = editionContext.IdContext; this._idGeneratorFactory = idContext.IdGeneratorFactory; this._idController = idContext.IdController; this._databaseLayout = platformModule.StoreLayout.databaseLayout(databaseName); this._logService = platformModule.Logging; this._scheduler = platformModule.JobScheduler; this._globalDependencies = platformModule.Dependencies; this._tokenHolders = editionContext.CreateTokenHolders(); this._tokenNameLookup = new NonTransactionalTokenNameLookup(_tokenHolders); this._locks = editionContext.CreateLocks(); this._statementLocksFactory = editionContext.CreateStatementLocksFactory(); this._schemaWriteGuard = editionContext.SchemaWriteGuard; this._transactionEventHandlers = new TransactionEventHandlers(facade); this._monitors = new Monitors(platformModule.Monitors); this._indexingServiceMonitor = _monitors.newMonitor(typeof(IndexingService.Monitor)); this._physicalLogMonitor = _monitors.newMonitor(typeof(LogFileCreationMonitor)); this._fs = platformModule.FileSystem; this._transactionStats = editionContext.CreateTransactionMonitor(); this._databaseHealth = new DatabaseHealth(platformModule.PanicEventGenerator, _logService.getInternalLog(typeof(DatabaseHealth))); this._transactionHeaderInformationFactory = editionContext.HeaderInformationFactory; this._commitProcessFactory = editionContext.CommitProcessFactory; this._autoIndexing = new InternalAutoIndexing(platformModule.Config, _tokenHolders.propertyKeyTokens()); this._indexConfigStore = new IndexConfigStore(_databaseLayout, _fs); this._explicitIndexProvider = new DefaultExplicitIndexProvider(); this._pageCache = platformModule.PageCache; this._constraintSemantics = editionContext.ConstraintSemantics; this._tracers = platformModule.Tracers; this._procedures = procedures; this._ioLimiter = editionContext.IoLimiter; this._clock = platformModule.Clock; this._databaseAvailabilityGuard = editionContext.CreateDatabaseAvailabilityGuard(_clock, _logService, _config); this._databaseAvailability = new DatabaseAvailability(_databaseAvailabilityGuard, _transactionStats, platformModule.Clock, AwaitActiveTransactionDeadlineMillis); this._coreAPIAvailabilityGuard = new CoreAPIAvailabilityGuard(_databaseAvailabilityGuard, editionContext.TransactionStartTimeout); this._accessCapability = editionContext.AccessCapability; this._storeCopyCheckPointMutex = new StoreCopyCheckPointMutex(); this._recoveryCleanupWorkCollector = platformModule.RecoveryCleanupWorkCollector; this._databaseInfo = platformModule.DatabaseInfo; this._versionContextSupplier = platformModule.VersionContextSupplier; this._collectionsFactorySupplier = platformModule.CollectionsFactorySupplier; this._kernelExtensionFactories = platformModule.KernelExtensionFactories; this._watcherServiceFactory = editionContext.WatcherServiceFactory; this._facade = facade; this._engineProviders = platformModule.EngineProviders; }
public virtual void Flush(IOLimiter limiter) { try { CountsTracker counts = ( CountsTracker )_stores[StoreType.Counts.ordinal()]; if (counts != null) { Counts.rotate(MetaDataStore.LastCommittedTransactionId); } _pageCache.flushAndForce(limiter); } catch (IOException e) { throw new UnderlyingStorageException("Failed to flush", e); } }
public override void Force(IOLimiter ioLimiter) { try { // We never change status of read-only indexes. if (!LuceneIndex.ReadOnly) { LuceneIndex.markAsOnline(); } LuceneIndex.maybeRefreshBlocking(); } catch (IOException e) { throw new UncheckedIOException(e); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void unlimitedShouldAlwaysBeUnlimited() public virtual void UnlimitedShouldAlwaysBeUnlimited() { IOLimiter limiter = Org.Neo4j.Io.pagecache.IOLimiter_Fields.Unlimited; assertThat(limiter.Limited, @is(false)); MultipleDisableShouldReportUnlimited(limiter); assertThat(limiter.Limited, @is(false)); limiter.EnableLimit(); try { assertThat(limiter.Limited, @is(false)); } finally { limiter.DisableLimit(); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void flushAndForce(org.neo4j.io.pagecache.IOLimiter limiter) throws java.io.IOException public override void FlushAndForce(IOLimiter limiter) { if (limiter == null) { throw new System.ArgumentException("IOLimiter cannot be null"); } IList <PagedFile> files = ListExistingMappings(); using (MajorFlushEvent ignored = _pageCacheTracer.beginCacheFlush()) { if (limiter.Limited) { FlushAllPages(files, limiter); } else { FlushAllPagesParallel(files, limiter); } SyncDevice(); } ClearEvictorException(); }
private static void MultipleDisableShouldReportUnlimited(IOLimiter limiter) { limiter.DisableLimit(); try { assertThat(limiter.Limited, @is(false)); limiter.DisableLimit(); try { assertThat(limiter.Limited, @is(false)); } finally { limiter.EnableLimit(); } assertThat(limiter.Limited, @is(false)); } finally { limiter.EnableLimit(); } }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private void flushFile(MuninnPagedFile muninnPagedFile, org.neo4j.io.pagecache.IOLimiter limiter) throws java.io.IOException private void FlushFile(MuninnPagedFile muninnPagedFile, IOLimiter limiter) { try { using (MajorFlushEvent fileFlush = _pageCacheTracer.beginFileFlush(muninnPagedFile.Swapper)) { FlushEventOpportunity flushOpportunity = fileFlush.FlushEventOpportunity(); muninnPagedFile.FlushAndForceInternal(flushOpportunity, false, limiter); } } catch (ClosedChannelException e) { if (muninnPagedFile.RefCount > 0) { // The file is not supposed to be closed, since we have a positive ref-count, yet we got a // ClosedChannelException anyway? It's an odd situation, so let's tell the outside world about // this failure. throw e; } // Otherwise: The file was closed while we were trying to flush it. Since unmapping implies a flush // anyway, we can safely assume that this is not a problem. The file was flushed, and it doesn't // really matter how that happened. We'll ignore this exception. } }
public override void Force(IOLimiter ioLimiter) { }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void flushAndForce(org.neo4j.io.pagecache.IOLimiter limiter) throws java.io.IOException public override void flushAndForce(IOLimiter limiter) { base.flushAndForce(limiter); _observedLimiter.set(limiter); }
public DelegatingPageCacheAnonymousInnerClass(RecordStorageEngineTest outerInstance, PageCache getPageCache, IOLimiter limiter, AtomicReference <IOLimiter> observedLimiter) : base(getPageCache) { this.outerInstance = outerInstance; this._limiter = limiter; this._observedLimiter = observedLimiter; }
public override void Force(IOLimiter ioLimiter) { InstanceSelector.forAll(accessor => accessor.force(ioLimiter)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void flushAndForce(org.neo4j.io.pagecache.IOLimiter limiter) throws java.io.IOException public override void FlushAndForce(IOLimiter limiter) { _adversary.injectFailure(typeof(FileNotFoundException), typeof(IOException), typeof(SecurityException)); @delegate.FlushAndForce(limiter); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void flushAndForce(IOLimiter limiter) throws java.io.IOException public override void FlushAndForce(IOLimiter limiter) { @delegate.FlushAndForce(limiter); }
public override void Force(IOLimiter ioLimiter) { tree.checkpoint(ioLimiter); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: public void force(org.neo4j.io.pagecache.IOLimiter ioLimiter) throws java.io.IOException public override void Force(IOLimiter ioLimiter) { Delegate.force(ioLimiter); }
public override void Force(IOLimiter ioLimiter) { Accessor.force(ioLimiter); }