// Token: 0x060004A4 RID: 1188 RVA: 0x0001907C File Offset: 0x0001727C
 internal static void DismountAll(string hint)
 {
     AmTrace.Debug("AmStoreHelper.DismountAll( {0} ): Started dismounting all mounted databases.", new object[]
     {
         hint
     });
     lock (AmStoreHelper.ForceDismountLocker)
     {
         MdbStatus[] array  = null;
         DateTime    utcNow = DateTime.UtcNow;
         if (!AmStoreHelper.GetAllDatabaseStatuses(null, false, out array))
         {
             AmTrace.Error("AmStoreHelper.DismountAll( {0} ): GetAllDatabaseStatuses() failed. Now attempting to kill store to quickly get dismounted databases.", new object[]
             {
                 hint
             });
             AmStoreServiceMonitor.KillStoreIfRunningBefore(utcNow, "DismountAll");
         }
         else if (array != null && array.Length > 0)
         {
             DismountDatabasesInParallel dismountDatabasesInParallel = new DismountDatabasesInParallel(array);
             dismountDatabasesInParallel.Execute(RegistryParameters.AmDismountOrKillTimeoutInSec * 1000, hint);
         }
         else
         {
             AmTrace.Debug("Dismount all skipped since there are no mounted databases", new object[0]);
         }
     }
 }
        // Token: 0x060003C8 RID: 968 RVA: 0x000148E4 File Offset: 0x00012AE4
        private Exception RunServerRpcInternal(AmServerName node, out MdbStatus[] results)
        {
            results = null;
            Exception ex = null;

            MdbStatus[] array = null;
            if (!AmStoreHelper.GetAllDatabaseStatuses(node, this.m_isBasicInformation, out array))
            {
                Thread.Sleep(2000);
                if (!AmStoreHelper.GetAllDatabaseStatuses(node, this.m_isBasicInformation, out array, out ex))
                {
                    AmTrace.Error("Failed to get mounted database information from store on server {0}. Exception: {1}", new object[]
                    {
                        node,
                        ex
                    });
                    ReplayCrimsonEvents.ListMdbStatusFailed.LogPeriodic <string, string>(node.NetbiosName, TimeSpan.FromMinutes(15.0), node.NetbiosName, ex.ToString());
                    return(ex);
                }
            }
            results = array;
            return(ex);
        }
 // Token: 0x060004A2 RID: 1186 RVA: 0x00018F9C File Offset: 0x0001719C
 internal static bool GetAllDatabaseStatuses(AmServerName serverName, bool isBasicInformation, out MdbStatus[] mdbStatuses, out Exception exception)
 {
     return(AmStoreHelper.GetAllDatabaseStatuses(serverName, isBasicInformation, null, null, out mdbStatuses, out exception));
 }
示例#4
0
        protected override void TimerCallbackInternal()
        {
            List <Guid> list = null;

            lock (this.m_cacheLock)
            {
                if (this.m_allDatabasesCached == null || this.m_allDatabasesCached.Count == 0)
                {
                    ExTraceGlobals.AmConfigManagerTracer.TraceDebug(0L, "AmPerfCounterUpdater: No configurations have been discovered, so nothing to do! Exiting.");
                    return;
                }
                list = new List <Guid>(this.m_allDatabasesCached);
            }
            Exception ex = null;

            MdbStatus[] array = null;
            if (AmStoreHelper.GetAllDatabaseStatuses(null, false, out array, out ex))
            {
                Dictionary <Guid, string> dictionary = new Dictionary <Guid, string>(array.Length);
                for (int i = 0; i < array.Length; i++)
                {
                    if (array[i] != null && (array[i].Status & MdbStatusFlags.Online) == MdbStatusFlags.Online)
                    {
                        try
                        {
                            dictionary.Add(array[i].MdbGuid, array[i].MdbName);
                        }
                        catch (ArgumentException)
                        {
                            ExTraceGlobals.AmConfigManagerTracer.TraceDebug <Guid, string>(0L, "AmPerfCounterUpdater: Database {0} ({1}) was returned more than once from GetAllDatabasesStatuses.", array[i].MdbGuid, array[i].MdbName);
                        }
                    }
                }
                AmStoreHelper.UpdateNumberOfDatabasesCounter(list.Count);
                foreach (Guid guid in list)
                {
                    string empty = string.Empty;
                    if (dictionary.TryGetValue(guid, out empty))
                    {
                        AmStoreHelper.UpdateIsMountedCounter(guid, empty, true, false);
                    }
                    else
                    {
                        AmStoreHelper.UpdateIsMountedCounter(guid, null, false, false);
                    }
                    IADDatabase database = Dependencies.ADConfig.GetDatabase(guid);
                    if (database != null)
                    {
                        MountStatus? mountStatus;
                        string       activeServerForDatabase = ReplicaInstance.GetActiveServerForDatabase(guid, database.Name, new AmServerName(database.Server.Name).Fqdn, out mountStatus);
                        AmServerName amServerName            = new AmServerName(activeServerForDatabase);
                        AmStoreHelper.UpdateCopyRoleIsActivePerfCounter(guid, empty, amServerName.IsLocalComputerName);
                    }
                    else
                    {
                        ExTraceGlobals.AmConfigManagerTracer.TraceError <Guid>(0L, "AmPerfCounterUpdater: Failed to get the database for guid {0}", guid);
                    }
                }
                return;
            }
            AmTrace.Error("AmPerfCounterUpdater: Failed to get mounted database information from store. Exception: {0}", new object[]
            {
                ex
            });
        }