internal void TransactionCompleted(LowLevelTransaction tx) { if (ActiveTransactions.TryRemove(tx) == false) { return; } try { if (tx.Flags != (TransactionFlags.ReadWrite)) { return; } if (tx.FlushedToJournal) { var totalPages = 0; // ReSharper disable once LoopCanBeConvertedToQuery foreach (var page in tx.GetTransactionPages()) { totalPages += page.NumberOfPages; } Interlocked.Add(ref SizeOfUnflushedTransactionsInJournalFile, totalPages); if (tx.IsLazyTransaction == false) { GlobalFlushingBehavior.GlobalFlusher.Value.MaybeFlushEnvironment(this); } } if (tx.AsyncCommit != null) { return; } _currentTransactionHolder = null; _writeTransactionRunning.Reset(); _transactionWriter.Release(); if (tx.FlushInProgressLockTaken) { FlushInProgressLock.ExitReadLock(); } } finally { if (tx.AlreadyAllowedDisposeWithLazyTransactionRunning == false) { _envDispose.Signal(); } } }
internal void TransactionCompleted(LowLevelTransaction tx) { if (ActiveTransactions.TryRemove(tx) == false) { return; } if (tx.Flags != (TransactionFlags.ReadWrite)) { return; } _writeTransactionRunning.Reset(); if (tx.FlushedToJournal) { var totalPages = 0; // ReSharper disable once LoopCanBeConvertedToQuery foreach (var page in tx.GetTransactionPages()) { totalPages += page.NumberOfPages; } Interlocked.Add(ref SizeOfUnflushedTransactionsInJournalFile, totalPages); if (tx.IsLazyTransaction == false) { GlobalFlushingBehavior.GlobalFlusher.Value.MaybeFlushEnvironment(this); } } Monitor.Exit(_txWriter); if (tx.FlushInProgressLockTaken) { FlushInProgressLock.ExitReadLock(); } }