public void Close(bool fast = false) { // Make sure any inflight rotations have occurred before shutting down. if (!_rotationSemaphore.WaitOne(30000)) throw new TimeoutException("Timed out waiting for table rotation to complete."); // Release again in case another thread tries to close it again. _rotationSemaphore.Release(); if (!finalizing && !fast) { TableManager.Default.Close(this); } if (_currentJournaledMemTable != null) { _currentJournaledMemTable.Close(); _currentJournaledMemTable = null; } if (_secondaryIndexes != null) { foreach (var idx in _secondaryIndexes) { idx.Value.Close(fast); } } // Don't finalize since we already closed it. GC.SuppressFinalize(this); }
static void CheckDatabase(string baseDir) { Console.WriteLine("Checking Key Value Store '{0}'", baseDir); RazorCache cache = new RazorCache(); var kv = new KeyValueStore(baseDir, cache); try { kv.ScanCheck(); } finally { kv.Close(); } }