예제 #1
0
        protected override void InternalRun()
        {
            if (!ReplicationCheckGlobals.TcpListenerCheckHasRun)
            {
                ReplicationCheckGlobals.TcpListenerCheckHasRun = true;
            }
            else
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug((long)this.GetHashCode(), "TcpListenerCheck skipping because it has already been run once.");
                base.Skip();
            }
            if (!IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(ReplayServiceCheck))))
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayServiceCheck didn't pass! Skipping {0}.", base.Title);
                base.Skip();
            }
            if ((ReplicationCheckGlobals.ServerConfiguration & ServerConfig.Stopped) == ServerConfig.Stopped)
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "Stopped server! Skipping {0}.", base.Title);
                base.Skip();
            }
            string text = null;
            bool   flag = TcpHealthCheck.TestHealth(base.ServerName, (int)this.replicationPort, 5000, out text);

            ExTraceGlobals.HealthChecksTracer.TraceDebug <string, bool, string>((long)this.GetHashCode(), "TcpListenerCheck: TestHealth() for server '{0}' returned: healthy={1}, errMsg='{2}'", base.ServerName, flag, text);
            if (!flag)
            {
                base.Fail(Strings.TcpListenerRequestFailed(base.ServerName, text));
            }
        }
예제 #2
0
        protected override void InternalRun()
        {
            if (!ReplicationCheckGlobals.ThirdPartyReplCheckHasRun)
            {
                ReplicationCheckGlobals.ThirdPartyReplCheckHasRun = true;
            }
            else
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug((long)this.GetHashCode(), "ThirdPartyReplCheck skipping because it has already been run once.");
                base.Skip();
            }
            if (!IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(ReplayServiceCheck))))
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayServiceCheck didn't pass! Skipping {0}.", base.Title);
                base.Skip();
            }
            if ((ReplicationCheckGlobals.ServerConfiguration & ServerConfig.Stopped) == ServerConfig.Stopped)
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "Stopped server! Skipping {0}.", base.Title);
                base.Skip();
            }
            string    error = null;
            bool      flag  = false;
            Exception ex    = null;

            try
            {
                if (AmRpcVersionControl.IsCheckThirdPartyListenerSupported(ReplicationCheckGlobals.Server.AdminDisplayVersion))
                {
                    if (ReplicationCheckGlobals.WriteVerboseDelegate != null)
                    {
                        ReplicationCheckGlobals.WriteVerboseDelegate(Strings.TestRHCheckTPRListener(ReplicationCheckGlobals.Server.AdminDisplayVersion.ToString(), AmRpcVersionControl.ThirdPartyReplListenerSupportedVersion.ToString()));
                    }
                    flag = AmRpcClientHelper.CheckThirdPartyListener(base.ServerName, out error);
                }
                else
                {
                    ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ThirdPartyReplCheck skipping because server {0} doesn't support the CheckThirdPartyListener RPC.", base.ServerName);
                    base.Skip();
                }
            }
            catch (AmServerException ex2)
            {
                ex = ex2;
            }
            catch (AmServerTransientException ex3)
            {
                ex = ex3;
            }
            if (ex != null)
            {
                base.Fail(Strings.ErrorCheckingTPRListener(base.ServerName, ex.Message));
            }
            ExTraceGlobals.HealthChecksTracer.TraceDebug <string, bool>((long)this.GetHashCode(), "TPR is healthy on server {0}: {1}", base.ServerName, flag);
            if (!flag)
            {
                base.Fail(Strings.TPRListenerNotHealthy(base.ServerName, error));
            }
        }
예제 #3
0
 public void Skip()
 {
     this.m_hasSkipped = true;
     if (!IgnoreTransientErrors.HasPassed(this.GetDefaultErrorKey(base.GetType())))
     {
         this.FailInternal();
     }
     throw new ReplicationCheckSkippedException();
 }
예제 #4
0
        protected override bool ShouldCheckConfig(ReplayConfiguration replayconfig)
        {
            bool result = IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(DatabasesSuspendedCheck)));

            if (base.ShouldCheckConfig(replayconfig))
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <string, string>((long)this.GetHashCode(), "ShouldCheckConfig(): Config '{0}': Dependent check SuspendCheck passed: {1}.", replayconfig.DisplayName, result.ToString());
                return(result);
            }
            return(false);
        }
        protected override void InternalRun()
        {
            if (!ReplicationCheckGlobals.ServerLocatorServiceCheckHasRun)
            {
                ReplicationCheckGlobals.ServerLocatorServiceCheckHasRun = true;
            }
            else
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug((long)this.GetHashCode(), "ServerLocatorServiceCheck skipping because it has already been run once.");
                base.Skip();
            }
            if (!IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(ReplayServiceCheck))))
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayServiceCheck didn't pass! Skipping {0}.", base.Title);
                base.Skip();
            }
            if ((ReplicationCheckGlobals.ServerConfiguration & ServerConfig.Stopped) == ServerConfig.Stopped)
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "Stopped server! Skipping {0}.", base.Title);
                base.Skip();
            }
            string text = null;
            bool   flag = false;
            ServerLocatorServiceClient serverLocatorServiceClient = null;
            TimeSpan timeSpan = TimeSpan.FromSeconds(5.0);

            try
            {
                serverLocatorServiceClient = ServerLocatorServiceClient.Create(base.ServerName, timeSpan, timeSpan, timeSpan, timeSpan);
                serverLocatorServiceClient.GetVersion();
                flag = true;
            }
            catch (ServerLocatorClientException ex)
            {
                text = ex.Message;
            }
            catch (ServerLocatorClientTransientException ex2)
            {
                text = ex2.Message;
            }
            finally
            {
                if (serverLocatorServiceClient != null)
                {
                    serverLocatorServiceClient.Dispose();
                    serverLocatorServiceClient = null;
                }
            }
            ExTraceGlobals.HealthChecksTracer.TraceDebug <string, bool, string>((long)this.GetHashCode(), "ServerLocatorServiceCheck: TestHealth() for server '{0}' returned: healthy={1}, errMsg='{2}'", base.ServerName, flag, text);
            if (!flag)
            {
                base.Fail(Strings.ServerLocatorServiceRequestFailed(base.ServerName, text));
            }
        }
예제 #6
0
 protected override void InternalRun()
 {
     if (!ReplicationCheckGlobals.TasksRpcListenerCheckHasRun)
     {
         ReplicationCheckGlobals.TasksRpcListenerCheckHasRun = true;
     }
     else
     {
         ExTraceGlobals.HealthChecksTracer.TraceDebug((long)this.GetHashCode(), "TasksRpcListenerCheck skipping because it has already been run once.");
         base.Skip();
     }
     if (!IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(ReplayServiceCheck))))
     {
         ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayServiceCheck didn't pass! Skipping {0}.", base.Title);
         base.Skip();
     }
     if ((ReplicationCheckGlobals.ServerConfiguration & ServerConfig.Stopped) == ServerConfig.Stopped)
     {
         ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "Stopped server! Skipping {0}.", base.Title);
         base.Skip();
     }
     try
     {
         Dictionary <Guid, RpcDatabaseCopyStatus2> copyStatusRpcResults = this.GetCopyStatusRpcResults();
         if (copyStatusRpcResults != null)
         {
             ReplicationCheckGlobals.CopyStatusResults = copyStatusRpcResults;
         }
     }
     catch (TaskServerTransientException ex)
     {
         ExTraceGlobals.CmdletsTracer.TraceError <string>((long)this.GetHashCode(), "GetCopyStatusRpcResults(): TaskServerTransientException during GetCopyStatus RPC: {0}", ex.ToString());
         base.Fail(Strings.TasksRpcListenerRpcFailed(base.ServerName, ex.Message));
     }
     catch (TaskServerException ex2)
     {
         ExTraceGlobals.CmdletsTracer.TraceError <string>((long)this.GetHashCode(), "GetCopyStatusRpcResults(): TaskServerException during GetCopyStatus RPC: {0}", ex2.ToString());
         if (ex2 is ReplayServiceRpcUnknownInstanceException)
         {
             ExTraceGlobals.CmdletsTracer.TraceDebug((long)this.GetHashCode(), "GetCopyStatus() was not able to find a replica instance.");
         }
         else
         {
             base.Fail(Strings.TasksRpcListenerRpcFailed(base.ServerName, ex2.Message));
         }
     }
 }
예제 #7
0
        protected override void InternalRun()
        {
            AmServerName serverName = new AmServerName(base.ServerName);

            if (DagHelper.IsNodeClustered(serverName))
            {
                if (!IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(ClusterRpcCheck))))
                {
                    ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ClusterRpcCheck didn't pass! Skipping check {0}.", base.Title);
                    base.Skip();
                }
                if (this.m_fClusterLevelCheck)
                {
                    this.RunCheck();
                    return;
                }
                using (IEnumerator <AmServerName> enumerator = this.Cluster.EnumerateNodeNames().GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        AmServerName amServerName = enumerator.Current;
                        try
                        {
                            if (this.IsNodeMemberOfDag(amServerName, this.m_dag))
                            {
                                using (IAmClusterNode amClusterNode = this.Cluster.OpenNode(amServerName))
                                {
                                    if (this.RunIndividualCheck(amClusterNode))
                                    {
                                        base.ReportPassedInstance();
                                    }
                                    continue;
                                }
                            }
                            ExTraceGlobals.HealthChecksTracer.TraceDebug <string, string>((long)this.GetHashCode(), "Cluster node {0} is not a member of DAG {1} so check will not run here.", amServerName.NetbiosName, this.m_dag.Name);
                        }
                        finally
                        {
                            base.InstanceIdentity = null;
                        }
                    }
                    return;
                }
            }
            ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "Local machine is not clustered! Skipping check {0}.", base.Title);
            base.Skip();
        }
예제 #8
0
        protected override bool ShouldCheckConfig(ReplayConfiguration replayconfig)
        {
            bool flag  = IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(DatabasesSuspendedCheck)));
            bool flag2 = IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(DatabasesFailedCheck)));
            bool flag3 = flag && flag2;

            if (this.UseReplayRpc())
            {
                bool flag4 = IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(DatabasesInitializingCheck)));
                flag3 = (flag3 && flag4);
            }
            if (base.ShouldCheckConfig(replayconfig))
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <string, string, string>((long)this.GetHashCode(), "ShouldCheckConfig(): Config '{0}': Dependent checks SuspendCheck  and FailedCheck {2} passed: {1}.", replayconfig.DisplayName, flag3.ToString(), this.UseReplayRpc() ? "and InitializingCheck" : string.Empty);
                return(flag3);
            }
            return(false);
        }
예제 #9
0
 protected void SkipOnSamNodeIfMonitoringContext()
 {
     if (ReplicationCheckGlobals.RunningInMonitoringContext && (ReplicationCheckGlobals.ServerConfiguration & ServerConfig.DagMember) == ServerConfig.DagMember)
     {
         if (!IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(ActiveManagerCheck))))
         {
             ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ActiveManagerCheck didn't pass! Skipping check {0}.", base.Title);
             base.Skip();
         }
         if (ReplicationCheckGlobals.ActiveManagerRole == AmRole.SAM)
         {
             ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "SkipOnSAMNode(): Local machine is the SAM. Skipping check {0}.", base.Title);
             base.Skip();
             return;
         }
         if (ReplicationCheckGlobals.ActiveManagerRole == AmRole.PAM)
         {
             ExTraceGlobals.HealthChecksTracer.TraceDebug((long)this.GetHashCode(), "SkipOnSAMNode(): Local machine is the PAM. Checks will be run here.");
             return;
         }
         AmRole activeManagerRole = ReplicationCheckGlobals.ActiveManagerRole;
     }
 }
예제 #10
0
        protected override void InternalRun()
        {
            if (!ReplicationCheckGlobals.ActiveManagerCheckHasRun)
            {
                ReplicationCheckGlobals.ActiveManagerCheckHasRun = true;
            }
            else
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug((long)this.GetHashCode(), "ActiveManagerCheck skipping because it has already been run once.");
                base.Skip();
            }
            if (!IgnoreTransientErrors.HasPassed(base.GetDefaultErrorKey(typeof(ReplayServiceCheck))))
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ReplayServiceCheck didn't pass! Skipping {0}.", base.Title);
                base.Skip();
            }
            if ((ReplicationCheckGlobals.ServerConfiguration & ServerConfig.Stopped) == ServerConfig.Stopped)
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "Stopped server! Skipping {0}.", base.Title);
                base.Skip();
            }
            string error  = null;
            AmRole amRole = AmRole.Unknown;

            try
            {
                if (AmRpcVersionControl.IsGetAmRoleRpcSupported(ReplicationCheckGlobals.Server.AdminDisplayVersion))
                {
                    if (ReplicationCheckGlobals.WriteVerboseDelegate != null)
                    {
                        ReplicationCheckGlobals.WriteVerboseDelegate(Strings.TestRHGetAmRoleRpc(ReplicationCheckGlobals.Server.AdminDisplayVersion.ToString(), AmRpcVersionControl.GetAMRoleSupportVersion.ToString()));
                    }
                    amRole = AmRpcClientHelper.GetActiveManagerRole(base.ServerName, out error);
                    ReplicationCheckGlobals.ActiveManagerRole = amRole;
                }
                else
                {
                    ExTraceGlobals.HealthChecksTracer.TraceDebug <string>((long)this.GetHashCode(), "ActiveManagerCheck skipping because server {0} doesn't support the GetActiveManagerRole RPC.", base.ServerName);
                    base.Skip();
                }
            }
            catch (AmServerException ex)
            {
                base.Fail(Strings.ErrorReadingAMRole(base.ServerName, ex.Message));
            }
            catch (AmServerTransientException ex2)
            {
                base.Fail(Strings.ErrorReadingAMRole(base.ServerName, ex2.Message));
            }
            ExTraceGlobals.HealthChecksTracer.TraceDebug <AmRole, string>((long)this.GetHashCode(), "AM has role {0} on server {1}.", amRole, base.ServerName);
            if (amRole == AmRole.Unknown)
            {
                base.Fail(Strings.AmUnknownRole(base.ServerName, error));
            }
            if ((ReplicationCheckGlobals.ServerConfiguration & ServerConfig.DagMember) == ServerConfig.DagMember)
            {
                if (amRole == AmRole.Standalone)
                {
                    base.Fail(Strings.AmInvalidRoleDagServer(base.ServerName));
                    return;
                }
            }
            else if (amRole != AmRole.Standalone)
            {
                base.Fail(Strings.AmInvalidRoleStandaloneServer(base.ServerName));
            }
        }