// Token: 0x06000C41 RID: 3137 RVA: 0x00036478 File Offset: 0x00034678
        public static bool IsServerRcrSource(IADDatabase db, IADServer server, out DatabaseLocationInfo activeLocation)
        {
            ActiveManager noncachingActiveManagerInstance = ActiveManager.GetNoncachingActiveManagerInstance();

            activeLocation = noncachingActiveManagerInstance.GetServerForDatabase(db.Guid, GetServerForDatabaseFlags.BasicQuery);
            return(Cluster.StringIEquals(activeLocation.ServerFqdn, server.Fqdn));
        }
Exemplo n.º 2
0
        internal bool IsOkayForAction(IADDatabase db, AmServerName nodeName, AmDbActionCode actionCode, int coolingDuration)
        {
            bool result = true;

            if (actionCode == null)
            {
                return(true);
            }
            if (!actionCode.IsAutomaticFailureItem)
            {
                return(true);
            }
            if (db.ReplicationType == ReplicationType.None)
            {
                return(true);
            }
            lock (this.m_locker)
            {
                Dictionary <AmServerName, AmDbAttemptInfo> dictionary = null;
                if (this.m_dbMap.TryGetValue(db.Guid, out dictionary))
                {
                    AmDbAttemptInfo amDbAttemptInfo = null;
                    if (dictionary.TryGetValue(nodeName, out amDbAttemptInfo))
                    {
                        DateTime lastAttemptTime = amDbAttemptInfo.LastAttemptTime;
                        if ((DateTime)ExDateTime.Now < lastAttemptTime.AddSeconds((double)coolingDuration))
                        {
                            result = false;
                        }
                    }
                }
            }
            return(result);
        }
 public AmActiveThirdPartyMove(IADDatabase db, string activeNodeName, bool mountDesired)
 {
     this.m_db = db;
     this.m_currentActiveNodeName = activeNodeName;
     this.m_mountDesired          = mountDesired;
     this.Response = NotificationResponse.Incomplete;
 }
 // Token: 0x06000C4A RID: 3146 RVA: 0x000367DC File Offset: 0x000349DC
 public bool ConfigurationPathConflict(IADDatabase[] databases, out string field)
 {
     field = string.Empty;
     if (databases != null)
     {
         int i = 0;
         while (i < databases.Length)
         {
             IADDatabase iaddatabase = databases[i];
             bool        result;
             if (Cluster.StringIEquals(this.DestinationLogPath, iaddatabase.LogFolderPath.PathName))
             {
                 field  = "DestinationLogPath:" + this.DestinationLogPath;
                 result = true;
             }
             else if (Cluster.StringIEquals(this.DestinationEdbPath, iaddatabase.EdbFilePath.PathName))
             {
                 field  = "DestinationEdbPath:" + this.DestinationEdbPath;
                 result = true;
             }
             else
             {
                 if (!Cluster.StringIEquals(this.DestinationSystemPath, iaddatabase.SystemFolderPath.PathName))
                 {
                     i++;
                     continue;
                 }
                 field  = "DestinationSystemPath:" + this.DestinationSystemPath;
                 result = true;
             }
             return(result);
         }
     }
     return(false);
 }
        // Token: 0x0600240B RID: 9227 RVA: 0x000A8368 File Offset: 0x000A6568
        public void ImmediateDismountMailboxDatabase(Guid databaseId)
        {
            ExTraceGlobals.ThirdPartyManagerTracer.TraceDebug(0L, "ImmediateDismountMailboxDatabase called");
            this.CheckForPam("ImmediateDismountMailboxDatabase");
            Exception ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                this.CheckForPam("ImmediateDismountMailboxDatabase");
                IADDatabase db            = this.LookupDatabase(databaseId);
                AmDbActionCode actionCode = new AmDbActionCode(AmDbActionInitiator.Admin, AmDbActionReason.FailureItem, AmDbActionCategory.Dismount);
                AmConfig config           = AmSystemManager.Instance.Config;
                new AmDbPamAction(config, db, actionCode, this.GenerateUniqueDbActionId())
                {
                    LockTimeout = new TimeSpan?(this.m_openTimeout)
                }.Dismount(UnmountFlags.SkipCacheFlush);
            });

            if (ex == null)
            {
                return;
            }
            if (ex is ThirdPartyReplicationException)
            {
                throw ex;
            }
            throw new ImmediateDismountMailboxDatabaseException(databaseId, ex.Message);
        }
        // Token: 0x0600241E RID: 9246 RVA: 0x000A8F28 File Offset: 0x000A7128
        private void CheckServerForCopy(IADDatabase db, string serverName)
        {
            AmServerName    amServerName = new AmServerName(serverName);
            IADDatabaseCopy dbCopy       = null;
            Exception       ex           = this.DoADAction(delegate(object param0, EventArgs param1)
            {
                foreach (IADDatabaseCopy iaddatabaseCopy in db.DatabaseCopies)
                {
                    if (MachineName.Comparer.Equals(iaddatabaseCopy.HostServerName, amServerName.NetbiosName))
                    {
                        dbCopy = iaddatabaseCopy;
                        return;
                    }
                }
            });

            if (dbCopy != null)
            {
                return;
            }
            ExTraceGlobals.ThirdPartyManagerTracer.TraceDebug(0L, "CheckServerForCopy:no copy of {0} guid={1} on {2}. Ex={3}", new object[]
            {
                db.Name,
                db.Guid,
                serverName,
                ex
            });
            if (ex == null)
            {
                throw new NoCopyOnServerException(db.Guid, db.Name, serverName);
            }
            throw ex;
        }
 // Token: 0x060011CB RID: 4555 RVA: 0x0004A2BC File Offset: 0x000484BC
 public void UpdateAvailabilityRedundancyStates(IMonitoringADConfig adConfig)
 {
     base.WriterLockedOperation(delegate
     {
         foreach (DbHealthInfo dbHealthInfo in this.m_dbServerInfos.Values)
         {
             dbHealthInfo.UpdateAvailabilityRedundancyStates();
         }
         foreach (ServerHealthInfo serverHealthInfo in this.m_serverInfos.Values)
         {
             AmServerName serverName = serverHealthInfo.ServerName;
             IEnumerable <IADDatabase> dbs;
             if (!adConfig.DatabaseMap.TryGetValue(serverName, out dbs))
             {
                 dbs = new IADDatabase[0];
             }
             bool conditionMet = this.IsAnyDbMatchingCriteria(serverHealthInfo, dbs, (DbHealthInfo dbhi, DbCopyHealthInfo serverCopy) => dbhi.AvailabilityCount <= 1 && serverCopy.IsAvailable());
             this.ReportTransition(serverHealthInfo.CriticalForMaintainingAvailability, conditionMet);
             bool conditionMet2 = this.IsAnyDbMatchingCriteria(serverHealthInfo, dbs, (DbHealthInfo dbhi, DbCopyHealthInfo serverCopy) => dbhi.RedundancyCount <= 2 && serverCopy.IsRedundant());
             this.ReportTransition(serverHealthInfo.CriticalForMaintainingRedundancy, conditionMet2);
             bool conditionMet3 = this.IsAnyDbMatchingCriteria(serverHealthInfo, dbs, (DbHealthInfo dbhi, DbCopyHealthInfo serverCopy) => dbhi.AvailabilityCount <= 1 && !serverCopy.IsAvailable());
             this.ReportTransition(serverHealthInfo.CriticalForRestoringAvailability, conditionMet3);
             bool conditionMet4 = this.IsAnyDbMatchingCriteria(serverHealthInfo, dbs, (DbHealthInfo dbhi, DbCopyHealthInfo serverCopy) => dbhi.RedundancyCount <= 2 && !serverCopy.IsRedundant());
             this.ReportTransition(serverHealthInfo.CriticalForRestoringRedundancy, conditionMet4);
             int num = this.CountOfDbsMatchingCriteria(serverHealthInfo, dbs, (DbHealthInfo dbhi, DbCopyHealthInfo serverCopy) => dbhi.AvailabilityCount == 2 && !serverCopy.IsAvailable());
             this.ReportTransition(serverHealthInfo.HighForRestoringAvailability, num > adConfig.Dag.AutoDagDatabaseCopiesPerVolume);
             DbCopyHealthInfoInternalTable.Tracer.TraceDebug <AmServerName, int>((long)this.GetHashCode(), "UpdateAvailabilityRedundancyStates(): For server '{0}', found {1} copies for HighForRestoringAvailability state.", serverName, num);
             int num2 = this.CountOfDbsMatchingCriteria(serverHealthInfo, dbs, (DbHealthInfo dbhi, DbCopyHealthInfo serverCopy) => dbhi.RedundancyCount == 3 && !serverCopy.IsRedundant());
             this.ReportTransition(serverHealthInfo.HighForRestoringRedundancy, num2 > adConfig.Dag.AutoDagDatabaseCopiesPerVolume);
             DbCopyHealthInfoInternalTable.Tracer.TraceDebug <AmServerName, int>((long)this.GetHashCode(), "UpdateAvailabilityRedundancyStates(): For server '{0}', found {1} copies for HighForRestoringRedundancy state.", serverName, num2);
         }
     });
 }
        // Token: 0x060011D8 RID: 4568 RVA: 0x0004A898 File Offset: 0x00048A98
        private bool DatabaseMatchPredicateWrapper(IADDatabase db, AmServerName serverName, Func <DbHealthInfo, DbCopyHealthInfo, bool> matchPredicate)
        {
            DbHealthInfo     dbHealthInfo = this.m_dbServerInfos[db.Guid];
            DbCopyHealthInfo dbCopy       = dbHealthInfo.GetDbCopy(serverName);

            return(!dbHealthInfo.SkippedFromMonitoring.IsSuccess && matchPredicate(dbHealthInfo, dbCopy));
        }
        // Token: 0x06000061 RID: 97 RVA: 0x00003424 File Offset: 0x00001624
        protected bool AllCopiesAreDisfavored(IADDatabase db)
        {
            IMonitoringADConfig config = Dependencies.MonitoringADConfigProvider.GetConfig(true);
            bool flag = true;

            IADDatabaseCopy[] databaseCopies = db.DatabaseCopies;
            foreach (IADDatabaseCopy iaddatabaseCopy in databaseCopies)
            {
                AmServerName serverName = new AmServerName(iaddatabaseCopy.HostServerName);
                IADServer    iadserver  = config.LookupMiniServerByName(serverName);
                if (!iadserver.DatabaseCopyActivationDisabledAndMoveNow)
                {
                    flag = false;
                    break;
                }
            }
            if (flag)
            {
                AmTrace.Warning("db ({0}) is ActivationDisfavored but no favored server exists. Move is skipped", new object[]
                {
                    db.Name
                });
                ReplayCrimsonEvents.AllServersMarkedDisfavored.LogPeriodic <Guid, string>(db.Name, DiagCore.DefaultEventSuppressionInterval, db.Guid, db.Name);
            }
            return(flag);
        }
        // Token: 0x0600008D RID: 141 RVA: 0x00004904 File Offset: 0x00002B04
        private bool IsActiveOnServer(IADDatabase db, AmServerName movingFromServer, out LocalizedString skipReason)
        {
            bool          result        = false;
            AmDbStateInfo amDbStateInfo = this.m_amConfig.DbState.Read(db.Guid);

            if (amDbStateInfo.IsEntryExist)
            {
                if (AmServerName.IsEqual(movingFromServer, amDbStateInfo.ActiveServer))
                {
                    result     = true;
                    skipReason = LocalizedString.Empty;
                }
                else
                {
                    AmTrace.Info("IsActiveOnServer: Excluding database {0} from moving since it is not active on {1} (active={2})", new object[]
                    {
                        db.Name,
                        movingFromServer,
                        amDbStateInfo.ActiveServer
                    });
                    skipReason = ReplayStrings.DbMoveSkippedBecauseNotActive(db.Name, movingFromServer.NetbiosName, amDbStateInfo.ActiveServer.NetbiosName);
                }
            }
            else
            {
                AmTrace.Error("IsActiveOnServer: Failed to find db state info from clusdb (db={0})", new object[]
                {
                    db.Name
                });
                skipReason = ReplayStrings.DbMoveSkippedBecauseNotFoundInClusDb(db.Name);
            }
            return(result);
        }
Exemplo n.º 11
0
        // Token: 0x060000B4 RID: 180 RVA: 0x00005508 File Offset: 0x00003708
        private HashSet <Guid> GetDatabasesByServer(AmServerName serverName)
        {
            HashSet <Guid> hashSet  = new HashSet <Guid>();
            IADConfig      adconfig = Dependencies.ADConfig;
            IADServer      server   = adconfig.GetServer(serverName);

            if (server != null)
            {
                IEnumerable <IADDatabase> databasesOnServer = adconfig.GetDatabasesOnServer(serverName);
                if (databasesOnServer == null)
                {
                    return(hashSet);
                }
                using (IEnumerator <IADDatabase> enumerator = databasesOnServer.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        IADDatabase iaddatabase = enumerator.Current;
                        hashSet.Add(iaddatabase.Guid);
                    }
                    return(hashSet);
                }
            }
            ExTraceGlobals.ClusterTracer.TraceError <AmServerName>((long)this.GetHashCode(), "MiniSever object is null when querying for server '{0}'", serverName);
            return(hashSet);
        }
Exemplo n.º 12
0
 internal AmDbOperation(IADDatabase db)
 {
     this.Database     = db;
     this.CreationTime = ExDateTime.Now;
     this.Counter      = (long)Interlocked.Increment(ref AmDbOperation.sm_operationCounter);
     this.UniqueId     = AmDbOperation.GenerateUniqueId(this.Database.Guid, this.CreationTime, this.Counter);
 }
Exemplo n.º 13
0
 internal void ReportStatus(IADDatabase db, AmDbActionStatus status)
 {
     lock (this.m_statusInfo)
     {
         this.m_statusInfo[status] = ExDateTime.Now;
     }
     if (AmDbOperation.IsCompletionStatus(status) || status == this.CustomStatus)
     {
         this.IsComplete = true;
     }
     if (this.CompletionCallback != null && this.IsComplete && !this.m_isCompletionCalled)
     {
         this.m_isCompletionCalled = true;
         this.CompletionCallback(db);
     }
     if (status == AmDbActionStatus.UpdateMasterServerInitiated)
     {
         ExTraceGlobals.FaultInjectionTracer.TraceTest(2309369149U);
         return;
     }
     if (status == AmDbActionStatus.StoreMountInitiated)
     {
         ExTraceGlobals.FaultInjectionTracer.TraceTest(3383110973U);
     }
 }
Exemplo n.º 14
0
        public static IADDatabase[] GetAllDatabases(IADToplogyConfigurationSession adSession, IFindAdObject <IADDatabase> databaseLookup, MiniServer miniServer, out Exception exception)
        {
            IADDatabaseCopy[] copies       = null;
            QueryFilter       serverFilter = new ComparisonFilter(ComparisonOperator.Equal, ADObjectSchema.Name, miniServer.Name);

            exception = ADUtils.RunADOperation(delegate()
            {
                copies = adSession.Find <IADDatabaseCopy>(null, QueryScope.SubTree, serverFilter, null, 0);
            }, 2);
            if (exception != null)
            {
                return(null);
            }
            List <IADDatabase> list = new List <IADDatabase>(20);

            foreach (IADDatabaseCopy iaddatabaseCopy in copies)
            {
                ADObjectId  parent      = iaddatabaseCopy.Id.Parent;
                IADDatabase iaddatabase = databaseLookup.ReadAdObjectByObjectIdEx(parent, out exception);
                if (exception != null)
                {
                    return(null);
                }
                if (iaddatabase != null)
                {
                    list.Add(iaddatabase);
                }
            }
            return((list.Count > 0) ? list.ToArray() : null);
        }
Exemplo n.º 15
0
        // Token: 0x06001957 RID: 6487 RVA: 0x00068E38 File Offset: 0x00067038
        private IEnumerable <CopyStatusClientCachedEntry> FindTargetDbSetFromDatabaseGroup(AutoReseedContext context)
        {
            IADDatabase         database = context.Database;
            IMonitoringADConfig adConfig = context.AdConfig;
            string targetGroup           = database.DatabaseGroup;

            if (string.IsNullOrWhiteSpace(targetGroup))
            {
                AutoReseedWorkflow.Tracer.TraceError <string>((long)this.GetHashCode(), "FindTargetDbSetFromDatabaseGroup: DatabaseGroup property for db '{0}' is not set. Returning 'null'.", database.Name);
                return(null);
            }
            IEnumerable <IADDatabase> enumerable = adConfig.DatabaseMap[adConfig.TargetServerName];

            if (enumerable == null)
            {
                AutoReseedWorkflow.Tracer.TraceError <AmServerName>((long)this.GetHashCode(), "FindTargetDbSetFromDatabaseGroup: Server '{0}' had no databases. Returning 'null'.", adConfig.TargetServerName);
                return(null);
            }
            IEnumerable <IADDatabase> source = from db in enumerable
                                               where StringUtil.IsEqualIgnoreCase(db.DatabaseGroup, targetGroup)
                                               select db;
            int num = source.Count <IADDatabase>();

            if (num != context.Dag.AutoDagDatabaseCopiesPerVolume)
            {
                AutoReseedWorkflow.Tracer.TraceError <int, string, int>((long)this.GetHashCode(), "FindTargetDbSetFromDatabaseGroup: There are only '{0}' db copies in the group for database '{1}'. Expected number is: {2}. Returning 'null'.", num, database.Name, context.Dag.AutoDagDatabaseCopiesPerVolume);
                return(null);
            }
            Dictionary <Guid, IADDatabase>            dbGroupMap = source.ToDictionary((IADDatabase db) => db.Guid);
            IEnumerable <CopyStatusClientCachedEntry> source2    = from status in context.CopyStatusesForTargetServer
                                                                   where dbGroupMap.ContainsKey(status.DbGuid)
                                                                   select status;

            return(source2.ToArray <CopyStatusClientCachedEntry>());
        }
 // Token: 0x0600029F RID: 671 RVA: 0x0000F7B4 File Offset: 0x0000D9B4
 internal AmDbMountOperation(IADDatabase db, AmDbActionCode actionCode) : base(db)
 {
     this.ActionCode        = actionCode;
     this.StoreMountFlags   = MountFlags.None;
     this.AmMountFlags      = AmMountFlags.None;
     this.MountDialOverride = DatabaseMountDialOverride.None;
 }
Exemplo n.º 17
0
        public static ReplayConfiguration GetLocalReplayConfiguration(Guid dbGuid, IADConfig adConfig, ActiveManager activeManager, out Exception ex)
        {
            ex = null;
            if (activeManager == null)
            {
                activeManager = ActiveManager.GetNoncachingActiveManagerInstance();
            }
            IADServer localServer = adConfig.GetLocalServer();

            if (localServer == null)
            {
                ex = new FailedToFindServerException("localmachine");
                ExTraceGlobals.ReplayManagerTracer.TraceError <Guid, Exception>(0L, "GetReplayConfiguration ({0}): didn't find any server object for the local machine: {1}", dbGuid, ex);
                return(null);
            }
            IADDatabase database = adConfig.GetDatabase(dbGuid);

            if (database == null)
            {
                ex = new FailedToFindDatabaseException(dbGuid.ToString());
                ExTraceGlobals.ReplayManagerTracer.TraceError <Guid>(0L, "GetReplayConfiguration ({0}): Didn't find any mailbox database object from AD.", dbGuid);
                return(null);
            }
            bool flag;
            ReplayConfiguration replayConfiguration = ReplayConfiguration.GetReplayConfiguration(adConfig.GetLocalDag(), database, localServer, activeManager, out flag, out ex);

            if (ex != null)
            {
                ExTraceGlobals.ReplayManagerTracer.TraceError <Guid, Exception>(0L, "GetReplayConfiguration ({0}): Error occurred constructing the ReplayConfiguration. Error: {1}", dbGuid, ex);
                return(null);
            }
            return(replayConfiguration);
        }
Exemplo n.º 18
0
 internal AmDbRemountOperation(IADDatabase db, AmDbActionCode actionCode) : base(db)
 {
     this.ActionCode        = actionCode;
     this.Flags             = MountFlags.None;
     this.MountDialOverride = DatabaseMountDialOverride.None;
     this.FromServer        = null;
 }
Exemplo n.º 19
0
        private List <AmServerName> DetermineServersToContact()
        {
            Guid        guid = this.Database.Guid;
            IADDatabase db   = this.Database;

            IADDatabaseCopy[] databaseCopies = AmBestCopySelectionHelper.GetDatabaseCopies(guid, ref db);
            if (db != null)
            {
                this.Database = db;
            }
            AmConfig amConfig = AmSystemManager.Instance.Config;

            if (amConfig.IsUnknown)
            {
                AmTrace.Error("AmMultiNodeRpcNotifier: DB {0}: Invalid AM configuration", new object[]
                {
                    db.Name
                });
                throw new AmInvalidConfiguration(amConfig.LastError ?? string.Empty);
            }
            IAmBcsErrorLogger errorLogger = new AmBcsSingleCopyFailureLogger();
            AmBcsServerChecks checksToRun = AmBcsServerChecks.ClusterNodeUp;

            if (this.ActionCode.IsAutomaticOperation)
            {
                checksToRun |= AmBcsServerChecks.DebugOptionDisabled;
            }
            IEnumerable <AmServerName> source = from dbCopy in databaseCopies
                                                where this.ValidateServer(new AmServerName(dbCopy.HostServerName), db, amConfig, checksToRun, errorLogger)
                                                select new AmServerName(dbCopy.HostServerName);

            return(source.ToList <AmServerName>());
        }
Exemplo n.º 20
0
        // Token: 0x060001A7 RID: 423 RVA: 0x0000A4FC File Offset: 0x000086FC
        internal void DismountDatabase(Guid mdbGuid, UnmountFlags flags, AmDbActionCode actionCode)
        {
            AmTrace.Debug("Task: DismountDatabase({0},{1},{2}) called", new object[]
            {
                mdbGuid,
                flags,
                actionCode
            });
            ActiveManagerCore.ValidatePamOrStandalone("DismountDatabase");
            IADDatabase iaddatabase = this.AdLookup.DatabaseLookup.FindAdObjectByGuidEx(mdbGuid, AdObjectLookupFlags.ReadThrough);

            if (iaddatabase == null)
            {
                throw new AmDatabaseNotFoundException(mdbGuid);
            }
            AmDbDismountOperation amDbDismountOperation = new AmDbDismountOperation(iaddatabase, actionCode);

            amDbDismountOperation.Flags = flags;
            amDbDismountOperation.Enqueue();
            AmDbCompletionReason amDbCompletionReason = amDbDismountOperation.Wait();

            AmTrace.Debug("DismountDatabase({0}) completed (reason={1})", new object[]
            {
                mdbGuid,
                amDbCompletionReason
            });
        }
Exemplo n.º 21
0
        // Token: 0x060001AF RID: 431 RVA: 0x0000AA50 File Offset: 0x00008C50
        internal void RemountDatabase(Guid mdbGuid, MountFlags mountFlags, DatabaseMountDialOverride mountDialOverride, AmServerName fromServer, AmDbActionCode actionCode)
        {
            AmTrace.Debug("RemountDatabase ({0},{1},{2},{3},{4}) called", new object[]
            {
                mdbGuid,
                mountFlags,
                mountDialOverride,
                fromServer,
                actionCode
            });
            ActiveManagerCore.ValidatePamOrStandalone("RemountDatabase");
            IADDatabase iaddatabase = this.AdLookup.DatabaseLookup.FindAdObjectByGuidEx(mdbGuid, AdObjectLookupFlags.ReadThrough);

            if (iaddatabase == null)
            {
                throw new AmDatabaseNotFoundException(mdbGuid);
            }
            AmDbRemountOperation amDbRemountOperation = new AmDbRemountOperation(iaddatabase, actionCode);

            amDbRemountOperation.Flags             = mountFlags;
            amDbRemountOperation.MountDialOverride = mountDialOverride;
            amDbRemountOperation.FromServer        = fromServer;
            amDbRemountOperation.Enqueue();
            AmDbCompletionReason amDbCompletionReason = amDbRemountOperation.Wait();

            AmTrace.Debug("RemountDatabase({0}) completed (reason={1})", new object[]
            {
                mdbGuid,
                amDbCompletionReason
            });
        }
Exemplo n.º 22
0
        internal static void WaitUntilDatabaseIsNotMounted(IADDatabase database, int seconds)
        {
            bool flag = true;

            DatabaseTasks.Trace("Waiting for database {0} to reach dismounted/dismounting state for {1} seconds", new object[]
            {
                database.Name,
                seconds
            });
            for (int i = 0; i < seconds; i++)
            {
                if (!AmStoreHelper.IsMounted(null, database.Guid))
                {
                    flag = false;
                    break;
                }
                Thread.Sleep(1000);
            }
            if (flag)
            {
                DatabaseTasks.Trace("Database is still mounted {0} after {1} seconds", new object[]
                {
                    database.Name,
                    seconds
                });
            }
        }
Exemplo n.º 23
0
        internal static Exception ResumeLocalDatabaseCopy(IADDatabase database)
        {
            string    localMachineFqdn = DatabaseTasks.LocalMachineFqdn;
            Exception ex = null;

            try
            {
                DatabaseCopyActionFlags flags = DatabaseCopyActionFlags.Replication | DatabaseCopyActionFlags.Activation;
                Dependencies.ReplayRpcClientWrapper.RequestResume2(localMachineFqdn, database.Guid, (uint)flags);
            }
            catch (TaskServerException ex2)
            {
                ex = ex2;
            }
            catch (TaskServerTransientException ex3)
            {
                ex = ex3;
            }
            if (ex != null)
            {
                DatabaseTasks.Trace("ResumeLocalDatabaseCopy(): Failed with exception: {0}", new object[]
                {
                    ex
                });
                return(ex);
            }
            return(null);
        }
Exemplo n.º 24
0
        internal static void SyncDatabaseOwningServerAndLegacyDn(IADDatabase db, AmDbActionCode actionCode)
        {
            AmConfig      config        = AmSystemManager.Instance.Config;
            AmDbStateInfo amDbStateInfo = config.DbState.Read(db.Guid);
            AmServerName  amServerName  = new AmServerName(db.Server.Name);
            AmServerName  amServerName2;

            if (amDbStateInfo.IsActiveServerValid)
            {
                amServerName2 = amDbStateInfo.ActiveServer;
            }
            else
            {
                amServerName2 = amServerName;
            }
            AmTrace.Debug("Synchronizing AD properties of database {0} (initialOwningServer:{1}, newActiveServer:{2})", new object[]
            {
                db.Name,
                amServerName,
                amServerName2
            });
            bool flag = SharedDependencies.WritableADHelper.SetDatabaseLegacyDnAndOwningServer(db.Guid, amDbStateInfo.LastMountedServer, amServerName2, false);

            if (flag)
            {
                ReplayCrimsonEvents.DatabaseAdPropertiesSynchronized.Log <string, Guid, AmServerName, AmServerName>(db.Name, db.Guid, amServerName, amServerName2);
                return;
            }
            AmTrace.Debug("Ignored ad sync request database {0}", new object[]
            {
                db.Name
            });
        }
Exemplo n.º 25
0
        internal static void Remount(IADDatabase database, string from)
        {
            Exception ex = null;

            DatabaseTasks.Trace("Database '{0}' is attempting to remount on '{1}'", new object[]
            {
                database.Name,
                from
            });
            try
            {
                DatabaseTasks.WaitUntilDatabaseIsNotMounted(database, 5);
                AmRpcClientHelper.RemountDatabase(database, 0, -1, from);
            }
            catch (AmServerException ex2)
            {
                DatabaseTasks.Trace("RemountDatabase() failed with {0}", new object[]
                {
                    ex2
                });
                ex = ex2;
            }
            catch (AmServerTransientException ex3)
            {
                DatabaseTasks.Trace("RemountDatabase() failed with {0}", new object[]
                {
                    ex3
                });
                ex = ex3;
            }
            if (ex != null)
            {
                throw new DatabaseRemountFailedException(database.Name, ex.ToString(), ex);
            }
        }
Exemplo n.º 26
0
 // Token: 0x06000D44 RID: 3396 RVA: 0x0003A540 File Offset: 0x00038740
 public SingleCopyReplayConfiguration(IADDatabaseAvailabilityGroup dag, IADDatabase database, IADServer server, LockType lockType)
 {
     try
     {
         if (database == null)
         {
             throw new NullDatabaseException();
         }
         if (server == null)
         {
             throw new ErrorNullServerFromDb(database.Name);
         }
         this.m_database             = database;
         this.m_type                 = ReplayConfigType.SingleCopySource;
         this.m_server               = server;
         this.m_sourceNodeFqdn       = server.Fqdn;
         this.m_replayState          = ReplayState.GetReplayState(this.m_sourceNodeFqdn, this.m_sourceNodeFqdn, lockType, this.Identity, this.Database.Name);
         this.m_activationPreference = 1;
         base.PopulatePropertiesFromDag(dag);
     }
     finally
     {
         this.BuildDebugString();
     }
 }
Exemplo n.º 27
0
 public void CalculatePreferredHomeServer(Guid databaseGuid, out LegacyDN preferredRpcClientAccessServerLegacyDN, out ADObjectId preferredSiteId)
 {
     using (ActiveManagerPerformanceData.CalculatePreferredHomeServerDataProvider.StartRequestTimer())
     {
         ExTraceGlobals.ActiveManagerClientTracer.TraceFunction <Guid>((long)this.GetHashCode(), "Entering CalculatePreferredHomeServer. databaseGuid = {0}.", databaseGuid);
         this.DisposeCheck();
         this.m_perfCounters.CalculatePreferredHomeServerCalls.Increment();
         this.m_perfCounters.CalculatePreferredHomeServerCallsPerSec.Increment();
         lock (this.m_uniqueDatabasesSeen)
         {
             this.m_uniqueDatabasesSeen.Add(databaseGuid);
             try
             {
                 this.m_perfCounters.GetServerForDatabaseClientUniqueDatabases.RawValue = (long)this.m_uniqueDatabasesSeen.Count;
             }
             catch (InvalidOperationException)
             {
                 ExTraceGlobals.ActiveManagerClientTracer.TraceError((long)this.GetHashCode(), "Perf counters are broken. Please use lodctr to add them back");
             }
         }
         IADDatabase databaseByGuidEx = this.GetDatabaseByGuidEx(databaseGuid, AdObjectLookupFlags.None, NullPerformanceDataLogger.Instance);
         ActiveManagerImplementation.CalculatePreferredHomeServerInternal(this, databaseByGuidEx, this.m_adSession, this.m_dagLookup, this.m_casLookup, this.m_miniCasArrayLookup, out preferredRpcClientAccessServerLegacyDN, out preferredSiteId);
         ExTraceGlobals.ActiveManagerClientTracer.TraceDebug <Guid, LegacyDN, ADObjectId>((long)this.GetHashCode(), "CalculatePreferredHomeServer. databaseGuid = {0}, preferredRpcClientAccessServerLegacyDN = {1}, preferredSite = {2}", databaseGuid, preferredRpcClientAccessServerLegacyDN, preferredSiteId);
         ExTraceGlobals.ActiveManagerClientTracer.TraceFunction <Guid>((long)this.GetHashCode(), "Exiting CalculatePreferredHomeServer. databaseGuid = {0}", databaseGuid);
     }
 }
 // Token: 0x0600143B RID: 5179 RVA: 0x000519C4 File Offset: 0x0004FBC4
 public DatabaseReplicationNotStalledValidator(IADDatabase database, ICopyStatusClientLookup statusLookup, IMonitoringADConfig adConfig, PropertyUpdateTracker propertyUpdateTracker, bool shouldSkipEvents = true) : base(database, 0, 1, statusLookup, adConfig, propertyUpdateTracker, false, true, true, true, shouldSkipEvents)
 {
     if (propertyUpdateTracker == null)
     {
         throw new ArgumentNullException("propertyUpdateTracker shouldn't be null for DatabaseReplicationNotStalledValidator");
     }
 }
 // Token: 0x06001319 RID: 4889 RVA: 0x0004D05A File Offset: 0x0004B25A
 public AvailabilitySensor(IADDatabase database, IMonitoringADConfigProvider adConfigProvider, ICopyStatusClientLookup statusLookup, int minCopies, TimeSpan maxProbeFreq)
 {
     this.Database           = database;
     this.ADConfigProvider   = adConfigProvider;
     this.CopyStatusLookup   = statusLookup;
     this.MinAvailableCopies = minCopies;
     this.MaxProbeFreq       = maxProbeFreq;
 }
Exemplo n.º 30
0
 public LogReplayScanControl(IADDatabase database, bool isLagCopy, IMonitoringADConfigProvider adConfigProvider, ICopyStatusClientLookup statusLookup, IPerfmonCounters keepingUpReader, LogReplayScanControl.ControlParameters parameters)
 {
     this.sensor     = new AvailabilitySensor(database, adConfigProvider, statusLookup, parameters.MinAvailablePassiveCopies + 1, parameters.MaxProbeFreq);
     this.isLagCopy  = isLagCopy;
     this.Database   = database;
     this.Parameters = parameters;
     this.keepingUp  = keepingUpReader;
 }