Ejemplo n.º 1
0
        // Token: 0x06001BD5 RID: 7125 RVA: 0x00078268 File Offset: 0x00076468
        private bool SendUpdatesAndCheckIfLocalUpdateRequired(Dictionary <string, string> clusdbUpdates)
        {
            AmConfig  cfg = AmSystemManager.Instance.Config;
            Exception ex  = null;

            if (cfg.IsPamOrSam)
            {
                ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
                {
                    ActiveManagerServerPerfmon.LastLogRemoteUpdateRpcAttempted.Increment();
                    DateTime t = RpcUpdateLastLogImpl.Send(AmServerName.LocalComputerName, cfg.DagConfig.CurrentPAM, clusdbUpdates);
                    if (t > this.mostRecentValidServerUpdateTimeFromPamUtc)
                    {
                        this.mostRecentValidServerUpdateTimeFromPamUtc = t;
                    }
                });
            }
            if (ex != null)
            {
                ActiveManagerServerPerfmon.LastLogRemoteUpdateRpcFailed.Increment();
                ReplayCrimsonEvents.LastLogUpdateRpcFailed.LogPeriodic <AmRole, DateTime, string>(AmServerName.LocalComputerName.NetbiosName, TimeSpan.FromMinutes(5.0), cfg.Role, this.mostRecentValidServerUpdateTimeFromPamUtc, ex.Message);
            }
            ExDateTime lastServerUpdateTimeAsPerClusdbUtc;
            bool       flag = this.IsLocalUpdateRequired(out lastServerUpdateTimeAsPerClusdbUtc);

            this.LogUpdateEvents(flag, lastServerUpdateTimeAsPerClusdbUtc, ex);
            return(flag);
        }
        // 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);
        }
Ejemplo n.º 3
0
        private void CheckFsw(string fswComputerNameFqdn)
        {
            this.m_output.AppendLogMessage("Checking that the file share witness server ({0}) isn't one of the servers in the DAG.", new object[]
            {
                fswComputerNameFqdn
            });
            this.PrepareServersInDagIfRequired();
            AmServerName amServerName = new AmServerName(fswComputerNameFqdn);

            if (this.m_serverNamesInDag.Contains(amServerName))
            {
                this.m_output.WriteErrorSimple(new DagTaskServerMailboxServerAlsoServesAsFswNodeException(fswComputerNameFqdn));
            }
            this.m_output.AppendLogMessage("Checking if the FSW server can be queried with WMI.", new object[0]);
            DateTime bootTime = AmHelper.GetBootTime(amServerName);

            this.m_output.AppendLogMessage("The boot time of the FSW was '{0}' (MaxValue if the call failed).", new object[]
            {
                bootTime
            });
            if (bootTime == DateTime.MaxValue)
            {
                this.m_output.WriteErrorSimple(new DagTaskServerFswServerNotAccessibleWithWmiException(amServerName.NetbiosName));
            }
        }
 // Token: 0x0600088A RID: 2186 RVA: 0x00028CE0 File Offset: 0x00026EE0
 public static void TriggerBugcheckIfRequired(DateTime bugcheckRequestTimeUtc, string bugcheckReason)
 {
     if (RegistryParameters.DisableBugcheckOnHungIo != 0)
     {
         ReplayCrimsonEvents.BugcheckAttemptSkipped.Log <string>(bugcheckReason);
         return;
     }
     if (Interlocked.CompareExchange(ref BugcheckHelper.s_numThreadsInBugcheck, 1, 0) == 1)
     {
         ReplayCrimsonEvents.BugcheckAttemptSkippedInProgress.Log <string>(bugcheckReason);
         return;
     }
     try
     {
         DateTime utcNow        = DateTime.UtcNow;
         DateTime localBootTime = AmHelper.GetLocalBootTime();
         if (bugcheckRequestTimeUtc > localBootTime || localBootTime >= utcNow)
         {
             ReplayCrimsonEvents.BugCheckAttemptTriggered.Log <string, string>(localBootTime.ToString("s"), bugcheckReason);
             bool flag = false;
             ExTraceGlobals.FaultInjectionTracer.TraceTest <bool>(4291177789U, ref flag);
             Exception ex = null;
             if (!flag)
             {
                 ex = BugcheckHelper.KillWinInitProcess();
             }
             else
             {
                 AmTrace.Error("Skipping KillProcess() of 'winint.exe' due to Fault Injection.", new object[0]);
             }
             if (ex != null)
             {
                 ReplayCrimsonEvents.BugcheckAttemptFailed.Log <string, string, string>(ex.Message, localBootTime.ToString("s"), bugcheckReason);
             }
         }
     }
     finally
     {
         if (Interlocked.CompareExchange(ref BugcheckHelper.s_numThreadsInBugcheck, 0, 1) == 0)
         {
             DiagCore.RetailAssert(false, "We should not have more than 1 thread in TriggerBugcheckIfRequired()", new object[0]);
         }
     }
 }
        // Token: 0x0600240C RID: 9228 RVA: 0x000A8464 File Offset: 0x000A6664
        public void ChangeActiveServer(Guid databaseId, string newActiveServerName)
        {
            ExTraceGlobals.ThirdPartyManagerTracer.TraceDebug(0L, "ChangeActiveServer called");
            Exception ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                this.CheckForPam("ChangeActiveServer");
                IADDatabase db = this.LookupDatabase(databaseId);
                this.CheckServerForCopy(db, newActiveServerName);
                AmDbActionCode actionCode   = new AmDbActionCode(AmDbActionInitiator.Admin, AmDbActionReason.FailureItem, AmDbActionCategory.Move);
                AmConfig config             = AmSystemManager.Instance.Config;
                AmDbPamAction amDbPamAction = new AmDbPamAction(config, db, actionCode, this.GenerateUniqueDbActionId());
                amDbPamAction.ChangeActiveServerForThirdParty(newActiveServerName, this.m_openTimeout);
            });

            if (ex != null)
            {
                throw ex;
            }
        }
        private void PreventMoveOfActiveSeedingSource(AmServerName server, Database[] databases)
        {
            if (this.SkipActiveCopyChecks)
            {
                TaskLogger.Trace("PreventMoveOfActiveSeedingSource: Check skipped because -SkipActiveCopyChecks flag is specified.", new object[0]);
                return;
            }
            Exception ex = null;

            RpcDatabaseCopyStatus2[] array = null;
            try
            {
                Guid[] array2 = null;
                if (databases != null && databases.Length > 0)
                {
                    array2 = new Guid[databases.Length];
                    for (int i = 0; i < databases.Length; i++)
                    {
                        array2[i] = databases[i].Guid;
                    }
                }
                array = ReplayRpcClientHelper.GetCopyStatus(server.Fqdn, RpcGetDatabaseCopyStatusFlags2.ReadThrough, array2);
            }
            catch (TaskServerTransientException ex2)
            {
                ex = ex2;
            }
            catch (TaskServerException ex3)
            {
                ex = ex3;
            }
            if (ex != null)
            {
                TaskLogger.Trace("PreventMoveOfActiveSeedingSource: Check failed because of exception: {2}", new object[]
                {
                    ex
                });
                base.WriteError(new ErrorMoveUnableToGetCopyStatusException(server.NetbiosName, ex.Message), ErrorCategory.InvalidOperation, server.Fqdn);
            }
            foreach (RpcDatabaseCopyStatus2 rpcDatabaseCopyStatus in array)
            {
                if (SharedHelper.StringIEquals(rpcDatabaseCopyStatus.ActiveDatabaseCopy, server.NetbiosName) && rpcDatabaseCopyStatus.SeedingSource)
                {
                    if (!rpcDatabaseCopyStatus.SeedingSourceForDB)
                    {
                        if (rpcDatabaseCopyStatus.SeedingSourceForDB || rpcDatabaseCopyStatus.SeedingSourceForCI)
                        {
                            goto IL_1B6;
                        }
                    }
                    try
                    {
                        IADDatabase iaddatabase = AmHelper.FindDatabaseByGuid(rpcDatabaseCopyStatus.DBGuid);
                        TaskLogger.Trace("PreventMoveOfActiveSeedingSource: Check failed for {0}\\{1} because it is seeding source.", new object[]
                        {
                            iaddatabase.Name,
                            rpcDatabaseCopyStatus.MailboxServer
                        });
                        base.WriteError(new ErrorMoveActiveCopyIsSeedingSourceException(iaddatabase.Name, rpcDatabaseCopyStatus.MailboxServer), ErrorCategory.InvalidOperation, iaddatabase.Identity);
                    }
                    catch (AmDatabaseNotFoundException ex4)
                    {
                        TaskLogger.Trace("PreventMoveOfActiveSeedingSource: Check failed for '{0}' because it is not found in AD. Error: {1}", new object[]
                        {
                            rpcDatabaseCopyStatus.DBGuid,
                            ex4.Message
                        });
                        base.WriteError(new ErrorMoveActiveCopyNotFoundException(rpcDatabaseCopyStatus.DBGuid, ex4.Message), ErrorCategory.InvalidOperation, rpcDatabaseCopyStatus.DBGuid);
                    }
                }
                IL_1B6 :;
            }
        }
Ejemplo n.º 7
0
 private void MovePamIfNeeded()
 {
     try
     {
         using (IAmClusterGroup amClusterGroup = this.m_clusDag.FindCoreClusterGroup())
         {
             AmServerName ownerNode = amClusterGroup.OwnerNode;
             this.m_output.AppendLogMessage("The core cluster group '{0}' is currently on machine '{1}'.", new object[]
             {
                 amClusterGroup.Name,
                 ownerNode.NetbiosName
             });
             if (ownerNode.Equals(this.m_mailboxAmServerName))
             {
                 this.m_output.WriteProgressSimple(ReplayStrings.DagTaskMovingPam(this.m_mailboxServerName));
                 string resourceType = (this.m_clusDag.CnoName == string.Empty) ? string.Empty : "Network Name";
                 string newPam;
                 if (!amClusterGroup.MoveGroupToReplayEnabledNode((string targetNode) => AmHelper.IsReplayRunning(targetNode), resourceType, TimeSpan.FromMinutes(3.0), out newPam))
                 {
                     this.m_output.WriteWarning(ReplayStrings.DagTaskPamNotMovedSubsequentOperationsMayBeSlowOrUnreliable);
                 }
                 else
                 {
                     this.m_output.WriteProgressSimple(ReplayStrings.DagTaskMovedPam(newPam));
                 }
             }
         }
     }
     catch (LocalizedException ex)
     {
         this.m_output.AppendLogMessage("MoveGroupToReplayEnabledNode encountered the following exception: {0}", new object[]
         {
             ex
         });
         this.m_output.WriteWarning(ReplayStrings.DagTaskPamNotMovedSubsequentOperationsMayBeSlowOrUnreliable);
     }
 }
Ejemplo n.º 8
0
        public static bool MovePrimaryActiveManagerRole(string CurrentPrimaryName)
        {
            AmServerName serverName = new AmServerName(CurrentPrimaryName);
            bool         result;

            using (IAmCluster amCluster = ClusterFactory.Instance.OpenByName(serverName))
            {
                using (IAmClusterGroup amClusterGroup = amCluster.FindCoreClusterGroup())
                {
                    string text;
                    result = amClusterGroup.MoveGroupToReplayEnabledNode((string targetNode) => AmHelper.IsReplayRunning(targetNode), "Network Name", new TimeSpan(0, 3, 0), out text);
                }
            }
            return(result);
        }