Exemplo n.º 1
0
        private static int GetLogBackupFileHandle(string filename)
        {
            int i;

            if (!LogBackupFilenameLookup.TryGetValue(filename, out i))
            {
                i = Interlocked.Increment(ref _logBackupFilenameLookupCounter);
                LogBackupFilenameLookup[filename] = i;
                LogBackupFileHandleLookup[i]      = filename;
            }
            return(i);
        }
Exemplo n.º 2
0
        protected virtual void ClearStores(bool isRecycleStores)
        {
            CollectionOnDisk.transaction = null;
            if (CollectionOnDisk.Session != null)
            {
                CollectionOnDisk.Session.Transaction = null;
            }

            ModifiedCollections.Clear();

            _addStore                = null;
            _fileGrowthStore         = null;
            _recycledCollectionStore = null;

            RemoveFromLogBackupLookup(DataBackupFilename);
            if (Count > 0 && Interlocked.Decrement(ref Count) == 0)
            {
                if (LogCollection != null)
                {
                    lock (Locker)
                    {
                        if (LogCollection != null)
                        {
                            LogBackupFileHandleLookup.Clear();
                            LogBackupFilenameLookup.Clear();
                            Interlocked.Exchange(ref _logBackupFilenameLookupCounter, 0);
                            ClearBackupStreams();
                            LogCollection = null;
                        }
                    }
                }
            }
            if (_appendLogger != null)
            {
                _appendLogger.Dispose();
                File.Delete(_appendLogger.LogFilename);
                _appendLogger = null;
            }
            if (_updateLogger == null)
            {
                return;
            }
            _updateLogger.Dispose();
            File.Delete(_updateLogger.LogFilename);
            _updateLogger = null;
        }
Exemplo n.º 3
0
        private static void RemoveFromLogBackupLookup(string filename)
        {
            //** remove from backup streams list
            var fs = BackupStreams[filename];

            if (fs != null)
            {
                fs.Dispose();
                BackupStreams.Remove(filename);
            }
            //** remove from backup filename lookup list
            int i;

            if (LogBackupFilenameLookup.TryGetValue(filename, out i))
            {
                LogBackupFileHandleLookup.Remove(i);
                LogBackupFilenameLookup.Remove(filename);
            }
        }