Exemple #1
0
        public void InitializeVolumeInfo()
        {
            ExTraceGlobals.ReplicaInstanceTracer.TraceDebug <string>((long)this.GetHashCode(), "{0}: InitializeVolumeInfo() called.", this.m_displayName);
            DatabaseVolumeInfo instance = DatabaseVolumeInfo.GetInstance(this.m_instance.Configuration);

            lock (this.m_instance)
            {
                this.DatabaseVolumeInfo = instance;
                this.m_replayState.SetVolumeInfoIfValid(instance);
            }
        }
Exemple #2
0
        private void UpdateVolumeForNeverMountedActives(IMonitoringADConfig adConfig)
        {
            IEnumerable <IADDatabase> enumerable = adConfig.DatabaseMap[adConfig.TargetServerName];
            IEnumerable <CopyStatusClientCachedEntry> copyStatusesByServer = this.m_statusLookup.GetCopyStatusesByServer(adConfig.TargetServerName, enumerable, CopyStatusClientLookupFlags.None);
            Exception          ex = null;
            List <IADDatabase> neverMountedActives = this.m_volumeManager.GetNeverMountedActives(enumerable, adConfig, copyStatusesByServer);

            if (neverMountedActives != null && neverMountedActives.Count > 0)
            {
                ICollection <string> source = from db in neverMountedActives
                                              select db.Name;
                DiskReclaimerManager.Tracer.TraceDebug <int, string>((long)this.GetHashCode(), "DiskReclaimer: UpdateVolumeForNeverMountedActives() Number of never mounted active databases missing volume = {0}. Databases: '{1}'", neverMountedActives.Count, string.Join(",", source.ToArray <string>()));
                ReplayCrimsonEvents.DiskReclaimerNeverMountedActives.Log <int, string>(neverMountedActives.Count, string.Join(",", source.ToArray <string>()));
            }
            foreach (IADDatabase iaddatabase in neverMountedActives)
            {
                bool flag = false;
                DatabaseVolumeInfo instance = DatabaseVolumeInfo.GetInstance(iaddatabase.EdbFilePath.PathName, iaddatabase.LogFolderPath.PathName, iaddatabase.Name, adConfig.Dag.AutoDagVolumesRootFolderPath.PathName, adConfig.Dag.AutoDagDatabasesRootFolderPath.PathName, adConfig.Dag.AutoDagDatabaseCopiesPerVolume);
                if (instance.IsValid && MountPointUtil.IsDirectoryAccessibleMountPoint(instance.DatabaseVolumeMountPoint.Path, out ex))
                {
                    flag = true;
                }
                else
                {
                    ReplayCrimsonEvents.DiskReclaimerNeverMountedActiveMissingVolume.Log <string>(iaddatabase.Name);
                    if (this.m_volumeManager.FixActiveDatabaseMountPoint(iaddatabase, enumerable, adConfig, out ex, true))
                    {
                        flag = true;
                        this.m_volumeManager.UpdateVolumeInfoCopyState(iaddatabase.Guid, this.m_replicaInstanceManager);
                    }
                    else
                    {
                        DiskReclaimerManager.Tracer.TraceError <string, string>((long)this.GetHashCode(), "DiskReclaimer: UpdateVolumeForNeverMountedActives() failed to fix up active database: '{0}' mountpoint. Error: {1}", iaddatabase.Name, AmExceptionHelper.GetExceptionMessageOrNoneString(ex));
                        ReplayCrimsonEvents.DiskReclaimerFixActiveMountPointError.Log <string, string>(iaddatabase.Name, ex.Message);
                    }
                }
                if (flag)
                {
                    ex = this.MountDatabaseWrapper(iaddatabase);
                    if (ex != null)
                    {
                        DiskReclaimerManager.Tracer.TraceError <string, string>((long)this.GetHashCode(), "DiskReclaimer: UpdateVolumeForNeverMountedActives() failed to mount active database: '{0}' mountpoint. Error: {1}", iaddatabase.Name, ex.Message);
                        ReplayCrimsonEvents.DiskReclaimerMountActiveDatabaseError.Log <string, string>(iaddatabase.Name, ex.Message);
                    }
                }
            }
            ReplayCrimsonEvents.DiskReclaimerFixActiveMountPointCompleted.Log <string>(adConfig.TargetServerName.NetbiosName);
            this.m_volumeManager.Refresh(adConfig);
        }
Exemple #3
0
        public void UpdateVolumeInfo()
        {
            DatabaseVolumeInfo databaseVolumeInfo = this.DatabaseVolumeInfo;
            MountedFolderPath  mountedFolderPath  = databaseVolumeInfo.DatabaseVolumeName;

            if (MountedFolderPath.IsNullOrEmpty(mountedFolderPath) && this.m_replayState.VolumeInfoIsValid)
            {
                mountedFolderPath = new MountedFolderPath(this.m_replayState.DatabaseVolumeName);
            }
            DatabaseVolumeInfo instance = DatabaseVolumeInfo.GetInstance(this.m_instance.Configuration);

            lock (this.m_instance)
            {
                this.DatabaseVolumeInfo = instance;
                this.m_replayState.SetVolumeInfoIfValid(instance);
                if (!MountedFolderPath.IsNullOrEmpty(instance.DatabaseVolumeName) && !MountedFolderPath.IsEqual(instance.DatabaseVolumeName, mountedFolderPath))
                {
                    this.m_replayState.LastDatabaseVolumeName = mountedFolderPath.Path;
                    this.m_replayState.LastDatabaseVolumeNameTransitionTime = DateTime.UtcNow;
                }
            }
        }