Beispiel #1
0
        // Token: 0x0600054F RID: 1359 RVA: 0x0001B024 File Offset: 0x00019224
        private void Run(AmSystemFailoverOnReplayDownTracker failoverTracker)
        {
            AmConfig config = AmSystemManager.Instance.Config;

            if (!config.IsPAM)
            {
                ReplayCrimsonEvents.FailoverOnReplDownSkipped.Log <AmServerName, string, string>(this.serverName, "RoleNotPAM", "TimerCallback");
                return;
            }
            if (AmHelper.IsReplayRunning(this.serverName))
            {
                ReplayCrimsonEvents.FailoverOnReplDownSkipped.Log <AmServerName, string, string>(this.serverName, "ReplRunning", "TimerCallback");
                return;
            }
            AmThrottledActionTracker <FailoverData> .ThrottlingShapshot throttlingSnapshot = failoverTracker.GetThrottlingSnapshot(this.serverName);
            if (throttlingSnapshot.IsActionCalledTooSoonPerNode || throttlingSnapshot.IsActionCalledTooSoonAcrossDag || throttlingSnapshot.IsMaxActionsPerNodeExceeded || throttlingSnapshot.IsMaxActionsAcrossDagExceeded)
            {
                throttlingSnapshot.LogResults(ReplayCrimsonEvents.FailoverOnReplDownThrottlingFailed, TimeSpan.FromMinutes(15.0));
                return;
            }
            failoverTracker.AddFailoverEntry(this.serverName);
            throttlingSnapshot.LogResults(ReplayCrimsonEvents.FailoverOnReplDownThrottlingSucceeded, TimeSpan.Zero);
            AmEvtSystemFailoverOnReplayDown amEvtSystemFailoverOnReplayDown = new AmEvtSystemFailoverOnReplayDown(this.serverName);

            amEvtSystemFailoverOnReplayDown.Notify();
        }
        // Token: 0x060003C7 RID: 967 RVA: 0x0001482C File Offset: 0x00012A2C
        protected override Exception RunServerRpc(AmServerName node, out object result)
        {
            Exception result2        = null;
            Exception storeException = null;

            MdbStatus[] mdbStatuses = null;
            result = null;
            AmMdbStatusServerInfo amMdbStatusServerInfo = this.ServerInfoMap[node];
            bool flag = false;

            try
            {
                InvokeWithTimeout.Invoke(delegate()
                {
                    storeException = this.RunServerRpcInternal(node, out mdbStatuses);
                }, amMdbStatusServerInfo.TimeOut);
            }
            catch (TimeoutException ex)
            {
                result2 = ex;
                flag    = true;
            }
            if (!flag)
            {
                result2 = storeException;
                amMdbStatusServerInfo.IsStoreRunning  = true;
                amMdbStatusServerInfo.IsReplayRunning = AmHelper.IsReplayRunning(node);
                result = mdbStatuses;
            }
            return(result2);
        }
Beispiel #3
0
        // Token: 0x060001A2 RID: 418 RVA: 0x0000A078 File Offset: 0x00008278
        internal static bool AttemptServerSwitchoverOnShutdown()
        {
            AmTrace.Entering("ActiveManagerCore.AttemptServerSwitchoverOnShutdown", new object[0]);
            ExDateTime utcNow = ExDateTime.UtcNow;

            ReplayEventLogConstants.Tuple_PreShutdownStart.LogEvent(null, new object[0]);
            Exception ex     = null;
            bool      result = false;

            try
            {
                AmConfig config = AmSystemManager.Instance.Config;
                if (config.IsPamOrSam)
                {
                    string fqdn = config.DagConfig.CurrentPAM.Fqdn;
                    AmTrace.Debug("{0} Trying to mount all the databases on other servers", new object[]
                    {
                        ExDateTime.Now
                    });
                    AmRpcClientHelper.ServerSwitchOver(fqdn, AmServerName.LocalComputerName.Fqdn);
                    if (config.IsPAM)
                    {
                        AmTrace.Debug("{0} Trying to move PAM off this node", new object[]
                        {
                            ExDateTime.Now
                        });
                        using (IAmCluster amCluster = ClusterFactory.Instance.Open())
                        {
                            using (IAmClusterGroup amClusterGroup = amCluster.FindCoreClusterGroup())
                            {
                                TimeSpan ts       = ExDateTime.UtcNow.Subtract(utcNow);
                                TimeSpan timeSpan = TimeSpan.FromSeconds(115.0).Subtract(ts);
                                if (!(timeSpan <= TimeSpan.Zero))
                                {
                                    if (amClusterGroup.MoveGroupToReplayEnabledNode((string targetNode) => AmHelper.IsReplayRunning(targetNode), "Network Name", timeSpan, out fqdn))
                                    {
                                        ReplayEventLogConstants.Tuple_SuccMovePAM.LogEvent(null, new object[]
                                        {
                                            Environment.MachineName,
                                            fqdn
                                        });
                                        AmTrace.Debug("{0} Moved PAM to another node", new object[]
                                        {
                                            ExDateTime.Now
                                        });
                                        goto IL_197;
                                    }
                                }
                                ReplayEventLogConstants.Tuple_FailedMovePAM.LogEvent(null, new object[]
                                {
                                    Environment.MachineName
                                });
                                IL_197 :;
                            }
                        }
                    }
                    result = true;
                    ReplayEventLogConstants.Tuple_PreShutdownOK.LogEvent(null, new object[0]);
                }
            }
            catch (ClusterException ex2)
            {
                ex = ex2;
            }
            catch (AmRpcException ex3)
            {
                ex = ex3;
            }
            catch (AmServerTransientException ex4)
            {
                ex = ex4;
            }
            catch (AmServerException ex5)
            {
                ex = ex5;
            }
            finally
            {
                if (ex != null)
                {
                    ReplayEventLogConstants.Tuple_PreShutdownFailed.LogEvent(null, new object[]
                    {
                        ex.Message
                    });
                }
                AmTrace.Leaving("ActiveManagerCore.AttemptServerSwitchoverOnShutdown", new object[0]);
            }
            return(result);
        }
Beispiel #4
0
        internal bool AttemptDismount(AmServerName serverName, UnmountFlags flags, bool isIgnoreKnownExceptions, out Exception exception)
        {
            bool result = false;

            exception = null;
            bool isNodeup = true;

            if (this.Config.IsPamOrSam && !this.Config.DagConfig.IsNodePubliclyUp(serverName))
            {
                isNodeup = false;
            }
            TimeSpan bestEffortDismountTimeout = this.DetermineDismountTimeout(this.ActionCode, isNodeup);

            this.DbTrace.Debug("Attempting dismount (server={0}, flags={1}, actionCode={2}, dismountTimeout={3}ms, ignoreException={4})", new object[]
            {
                serverName,
                flags,
                this.ActionCode,
                bestEffortDismountTimeout.TotalMilliseconds,
                isIgnoreKnownExceptions
            });
            AmDbAction.DismountMode modeOfDismount = AmDbAction.DismountMode.None;
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            bool        flag        = true;
            MountStatus mountStatus = this.State.MountStatus;

            try
            {
                ReplayCrimsonEvents.StoreDismountInitiated.LogGeneric(this.PrepareSubactionArgs(new object[]
                {
                    serverName,
                    flags,
                    bestEffortDismountTimeout
                }));
                if (AmServerName.IsEqual(this.State.ActiveServer, serverName))
                {
                    this.WriteStateDismounting(false);
                }
                ExTraceGlobals.FaultInjectionTracer.TraceTest(3152424253U);
                exception = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
                {
                    InvokeWithTimeout.Invoke(delegate()
                    {
                        if (isNodeup && AmHelper.IsReplayRunning(serverName))
                        {
                            this.DbTrace.Debug("Attempting Dismount through active manager", new object[0]);
                            modeOfDismount = AmDbAction.DismountMode.ThroughReplayService;
                            AmDbAction.DismountDatabaseDirect(serverName, this.DatabaseGuid, flags, this.ActionCode);
                            return;
                        }
                        this.DbTrace.Debug("Attempting dismount by directly RPCing to store", new object[0]);
                        modeOfDismount = AmDbAction.DismountMode.DirectlyToStore;
                        AmStoreHelper.RemoteDismount(serverName, this.DatabaseGuid, flags, true);
                    }, bestEffortDismountTimeout);
                    this.DbTrace.Debug("Database is possibly dismounted at server {0}", new object[]
                    {
                        serverName
                    });
                });
                if (exception != null)
                {
                    this.DbTrace.Debug("Dismount failed with error: {0}", new object[]
                    {
                        exception
                    });
                }
                flag = false;
            }
            finally
            {
                stopwatch.Stop();
                string text = null;
                if (flag)
                {
                    text = ReplayStrings.UnknownError;
                }
                else if (exception != null)
                {
                    text = exception.Message;
                }
                if (string.IsNullOrEmpty(text))
                {
                    result = true;
                    ReplayCrimsonEvents.StoreDismountSuccess.LogGeneric(this.PrepareSubactionArgs(new object[]
                    {
                        serverName,
                        modeOfDismount,
                        stopwatch.Elapsed
                    }));
                    if (AmServerName.IsEqual(this.State.ActiveServer, serverName))
                    {
                        this.WriteStateDismountFinished(true, MountStatus.Dismounted, false);
                    }
                }
                else
                {
                    ReplayCrimsonEvents.StoreDismountFailed.LogGeneric(this.PrepareSubactionArgs(new object[]
                    {
                        serverName,
                        modeOfDismount,
                        stopwatch.Elapsed,
                        text
                    }));
                    if (AmServerName.IsEqual(this.State.ActiveServer, serverName))
                    {
                        this.WriteStateDismountFinished(true, mountStatus, false);
                    }
                }
            }
            return(result);
        }
 // Token: 0x06000826 RID: 2086 RVA: 0x000279B4 File Offset: 0x00025BB4
 internal static bool IsReplayRunning(string serverFqdn)
 {
     return(AmHelper.IsReplayRunning(new AmServerName(serverFqdn)));
 }