// Token: 0x060004A6 RID: 1190 RVA: 0x00019164 File Offset: 0x00017364
 internal static bool UpdateIsMountedCounter(Guid mdbGuid, string mdbName, bool isMounted, bool isCheckDbStatus)
 {
     if (string.IsNullOrEmpty(mdbName))
     {
         IADDatabase iaddatabase = Dependencies.ReplayAdObjectLookup.DatabaseLookup.FindAdObjectByGuid(mdbGuid);
         if (iaddatabase != null)
         {
             mdbName = iaddatabase.Name;
         }
     }
     if (!string.IsNullOrEmpty(mdbName))
     {
         bool flag = false;
         try
         {
             flag = AmStoreHelper.sm_perfCounterLock.Lock(mdbGuid, AmDbLockReason.UpdatePerfCounter);
             if (isCheckDbStatus)
             {
                 isMounted = AmStoreHelper.IsMounted(null, mdbGuid);
             }
             AmTrace.Debug("AmStoreHelper.UpdateIsMountedCounter: Database {0} ({1}) IsMounted is {2}", new object[]
             {
                 mdbGuid,
                 mdbName,
                 isMounted
             });
             ActiveManagerPerfmonInstance instance = ActiveManagerPerfmon.GetInstance(mdbName);
             if (instance != null)
             {
                 instance.IsMounted.RawValue = (isMounted ? 1L : 0L);
             }
             return(isMounted);
         }
         finally
         {
             if (flag)
             {
                 AmStoreHelper.sm_perfCounterLock.Release(mdbGuid, AmDbLockReason.UpdatePerfCounter);
             }
         }
     }
     AmTrace.Error("AmStoreHelper.UpdateIsMountedCounter: Perfmon update skipped for {0} since mdbName is null", new object[]
     {
         mdbGuid
     });
     return(isMounted);
 }
Example #2
0
 private void CheckIfMoveApplicableForDatabase(AmServerName activeServer, AmServerName moveFromServer, AmDbActionCode actionCode)
 {
     if (base.Database.ReplicationType != ReplicationType.Remote)
     {
         AmTrace.Debug("Move ignored for database {0} since it is not replicated.", new object[]
         {
             base.DatabaseName
         });
         throw new AmDbMoveOperationNotSupportedException(base.DatabaseName);
     }
     if (!AmServerName.IsNullOrEmpty(moveFromServer))
     {
         if (!AmServerName.IsEqual(activeServer, moveFromServer))
         {
             AmTrace.Diagnostic("Move ignored for database {0} since the master server is different from the server that originally initiated the failover. (master={1}, movedInitiatedFrom={2})", new object[]
             {
                 base.DatabaseName,
                 activeServer,
                 moveFromServer
             });
             throw new AmDbMoveOperationNoLongerApplicableException(base.DatabaseName, moveFromServer.NetbiosName, activeServer.NetbiosName);
         }
         if (actionCode.Reason == AmDbActionReason.TimeoutFailure)
         {
             bool flag = AmStoreHelper.IsMounted(moveFromServer, base.DatabaseGuid);
             if (flag)
             {
                 throw new AmDbMoveOperationOnTimeoutFailureCancelled(base.DatabaseName, moveFromServer.NetbiosName);
             }
         }
     }
     if (base.Config.DagConfig.MemberServers.Length < 2)
     {
         AmTrace.Diagnostic("Move ignored for database {0} since according to active manager there is just one server in the DAG)", new object[]
         {
             base.DatabaseName
         });
         throw new AmDbMoveOperationNotSupportedException(base.DatabaseName);
     }
 }
Example #3
0
        internal static void SyncClusterDatabaseState(IADDatabase db, AmDbActionCode actionCode)
        {
            AmConfig config = AmSystemManager.Instance.Config;

            if (config.IsUnknown)
            {
                AmTrace.Error("SyncClusterDatabaseState: Invalid configuration (db={0})", new object[]
                {
                    db
                });
                throw new AmInvalidConfiguration(config.LastError);
            }
            AmDbStateInfo amDbStateInfo = config.DbState.Read(db.Guid);
            AmServerName  amServerName;

            if (amDbStateInfo.IsActiveServerValid)
            {
                amServerName = amDbStateInfo.ActiveServer;
            }
            else
            {
                amServerName = new AmServerName(db.Server.Name);
            }
            MountStatus mountStatus = MountStatus.Dismounted;

            if ((config.IsStandalone || (config.IsPamOrSam && config.DagConfig.IsNodePubliclyUp(amServerName))) && AmStoreHelper.IsMounted(amServerName, db.Guid))
            {
                mountStatus = MountStatus.Mounted;
                AmSystemManager.Instance.DbNodeAttemptTable.ClearFailedTime(db.Guid);
            }
            MountStatus mountStatus2 = amDbStateInfo.MountStatus;

            if (mountStatus != mountStatus2 || !AmServerName.IsEqual(amDbStateInfo.LastMountedServer, amDbStateInfo.ActiveServer))
            {
                if (mountStatus != mountStatus2)
                {
                    AmTrace.Debug("Mounted state reported by STORE is different from persistent state. (Database:{0}, PersistentState: {1}, StoreIsReporting: {2})", new object[]
                    {
                        db.Name,
                        mountStatus2,
                        mountStatus
                    });
                }
                else
                {
                    AmTrace.Debug("State is in transit. (Database:{0}, LastMountedServer: {1},ActiveServer: {2})", new object[]
                    {
                        db.Name,
                        amDbStateInfo.LastMountedServer,
                        amDbStateInfo.ActiveServer
                    });
                }
                AmDbAction.WriteStateSyncMountStatus(config, amDbStateInfo, db.Guid, amServerName, mountStatus);
                ReplayCrimsonEvents.DatabaseMountStatusSynchronized.Log <string, Guid, MountStatus, MountStatus, AmServerName>(db.Name, db.Guid, mountStatus2, mountStatus, amServerName);
                return;
            }
            AmTrace.Debug("Ignored persistent state sync for {0} since nothing is out of sync", new object[]
            {
                db.Name
            });
        }
 // Token: 0x06000499 RID: 1177 RVA: 0x00018C5C File Offset: 0x00016E5C
 internal static bool IsMountedLocally(Guid mdbGuid)
 {
     return(AmStoreHelper.IsMounted(null, mdbGuid));
 }