/// <summary> /// Shutdown process: /// - Stop any new transaction /// - Stop operation loops over database (throw in SafePoint) /// - Wait for writer queue /// - Close disks /// </summary> protected virtual void Dispose(bool disposing) { // this method can be called from Ctor, so many // of this members can be null yet (even if are readonly). if (_disposed) { return; } if (disposing) { // stop running all transactions _monitor?.Dispose(); // do a soft checkpoint (only if exclusive lock is possible) if (_settings.Checkpoint > 0) { _walIndex?.Checkpoint(true); } // close all disk streams (and delete log if empty) _disk?.Dispose(); // delete sort temp file _sortDisk?.Dispose(); // dispose lockers _locker?.Dispose(); } _disposed = true; }
/// <summary> /// Shutdown process: /// - Stop any new transaction /// - Stop operation loops over database (throw in SafePoint) /// - Wait for writer queue /// - Close disks /// </summary> protected virtual void Dispose(bool disposing) { // this method can be called from Ctor, so many // of this members can be null yet (even if are readonly). if (_disposed) { return; } if (disposing) { // stop running all transactions _transactions.ForEach((x, i) => i.Value.Abort()); // try checkpoint _walIndex.Checkpoint(true); // close all disk connections _disk?.Dispose(); // delete sort temp file this.SortDisk?.Dispose(); // dispose lockers _locker?.Dispose(); } _disposed = true; }
/// <summary> /// Shutdown process: /// - [[[[DESCRIBE]]]] /// </summary> public async ValueTask DisposeAsync() { // this method can be called from Ctor, so many // of this members can be null yet (even if are readonly). if (_disposed) { return; } _disposed = true; // do a soft checkpoint (only if exclusive lock is possible) if (_header?.Pragmas.Checkpoint > 0) { await _walIndex?.Checkpoint(); } // close all disk streams (and delete log if empty) _disk?.Dispose(); // dispose lockers _locker.Dispose(); LOG("engine disposed", "ENGINE"); }