Exemple #1
0
        // Token: 0x0600239B RID: 9115 RVA: 0x000A7264 File Offset: 0x000A5464
        public static void StopMonitoring()
        {
            ExTraceGlobals.MonitoredDatabaseTracer.TraceDebug(0L, "StopMonitoring:starting");
            TcpListener tcpListener = null;

            lock (RemoteDataProvider.s_singletonLock)
            {
                RemoteDataProvider.s_initialized = false;
                tcpListener = RemoteDataProvider.s_tcpListener;
                RemoteDataProvider.s_tcpListener = null;
                ClusterBatchWriter.Stop();
            }
            if (tcpListener != null)
            {
                tcpListener.Stop();
            }
            if (tcpListener != null)
            {
                MonitoredDatabase[] allInstances = RemoteDataProvider.s_databases.GetAllInstances();
                foreach (MonitoredDatabase monitoredDatabase in allInstances)
                {
                    RemoteDataProvider.s_databases.RemoveInstance(monitoredDatabase);
                    monitoredDatabase.StopMonitoring();
                }
            }
            ExTraceGlobals.MonitoredDatabaseTracer.TraceDebug(0L, "StopMonitoring:complete");
        }
 private void DetectNewEndOfLog(long logFileNumber, DateTime?writeTimeUtc, bool detectedBySelfCheck)
 {
     if (this.Config.Type == ReplayConfigType.RemoteCopySource)
     {
         ClusterBatchWriter.SetLastLog(this.Config.IdentityGuid, logFileNumber);
     }
     if (this.TryUpdateEndOfLog(logFileNumber, writeTimeUtc, false))
     {
         MonitoredDatabase.Tracer.TraceDebug((long)this.GetHashCode(), "DetectNewEndOfLog({0}): 0x{1:X} {2}UTC via SelfCheck={3}", new object[]
         {
             this.DatabaseName,
             logFileNumber,
             writeTimeUtc,
             detectedBySelfCheck
         });
         if (detectedBySelfCheck && writeTimeUtc != null)
         {
             TimeSpan timeSpan = DateTime.UtcNow - writeTimeUtc.Value;
             if (timeSpan.TotalMilliseconds > (double)RegistryParameters.SlowIoThresholdInMs)
             {
                 string text = this.BuildLogFileName(logFileNumber);
                 ReplayEventLogConstants.Tuple_SlowIoDetected.LogEvent(text, new object[]
                 {
                     text,
                     this.DatabaseCopyName,
                     timeSpan.TotalMilliseconds.ToString(),
                     "MissingFileNotification"
                 });
             }
         }
         this.IssueNotifications(MonitoredDatabase.NotifyPurpose.NewLog);
     }
 }
Exemple #3
0
        // Token: 0x06001BD7 RID: 7127 RVA: 0x000783F8 File Offset: 0x000765F8
        private bool IsLocalUpdateRequired(out ExDateTime lastUpdatedTimeInClusdbUtc)
        {
            lastUpdatedTimeInClusdbUtc = ClusterBatchWriter.GetLastServerUpdateTimeFromClusdb();
            if (lastUpdatedTimeInClusdbUtc == SharedHelper.ExDateTimeMinValueUtc)
            {
                return(true);
            }
            TimeSpan t  = ExDateTime.UtcNow - lastUpdatedTimeInClusdbUtc;
            TimeSpan t2 = TimeSpan.FromSeconds((double)RegistryParameters.LastLogUpdateThresholdInSec);

            return(t > t2);
        }
Exemple #4
0
        // Token: 0x06002397 RID: 9111 RVA: 0x000A6BF8 File Offset: 0x000A4DF8
        public static bool StartListening(bool useExchangeSid = true)
        {
            ExTraceGlobals.MonitoredDatabaseTracer.TraceDebug(0L, "Network TCP listener start listening.");
            bool result;

            lock (RemoteDataProvider.s_singletonLock)
            {
                if (RemoteDataProvider.s_initialized)
                {
                    ExTraceGlobals.MonitoredDatabaseTracer.TraceDebug(0L, "StartListening returned because it is already initialized");
                    result = RemoteDataProvider.s_initialized;
                }
                else if (ThirdPartyManager.IsInitialized && ThirdPartyManager.IsThirdPartyReplicationEnabled)
                {
                    RemoteDataProvider.s_tprEnabled = true;
                    ExTraceGlobals.MonitoredDatabaseTracer.TraceDebug(0L, "StartListening does nothing because TPR is enabled");
                    result = true;
                }
                else
                {
                    RemoteDataProvider.s_tprEnabled = false;
                    if (RemoteDataProvider.s_selfCheckTimer == null)
                    {
                        RemoteDataProvider.s_selfCheckTimer = new Timer(new TimerCallback(RemoteDataProvider.SelfCheck), null, RegistryParameters.RemoteDataProviderSelfCheckInterval, RegistryParameters.RemoteDataProviderSelfCheckInterval);
                    }
                    try
                    {
                        if (useExchangeSid)
                        {
                            RemoteDataProvider.s_exchangeGroupSid = ObjectSecurity.ExchangeServersUsgSid;
                        }
                        if (RemoteDataProvider.s_tcpListener == null)
                        {
                            TcpListener.Config config = new TcpListener.Config();
                            config.ListenPort            = (int)NetworkManager.GetReplicationPort();
                            config.LocalNodeName         = Environment.MachineName;
                            config.AuthConnectionHandOff = new TcpListener.AuthenticatedConnectionHandler(NetworkChannel.ServiceRequests);
                            TcpListener tcpListener = new TcpListener();
                            Exception   ex          = tcpListener.StartListening(config);
                            if (ex != null)
                            {
                                ReplayEventLogConstants.Tuple_TcpListenerFailedToStart.LogEvent(null, new object[]
                                {
                                    ex
                                });
                                ExTraceGlobals.MonitoredDatabaseTracer.TraceError <Exception>(0L, "Network TCP listener could not be started: {0}", ex);
                                return(false);
                            }
                            RemoteDataProvider.s_tcpListener = tcpListener;
                        }
                        ClusterBatchWriter.Start();
                        RemoteDataProvider.s_initialized = true;
                        ExTraceGlobals.MonitoredDatabaseTracer.TraceDebug(0L, "Network TCP listener successfully activated");
                    }
                    catch (ADTransientException ex2)
                    {
                        ReplayEventLogConstants.Tuple_TcpListenerFailedToStart.LogEvent(null, new object[]
                        {
                            ex2
                        });
                    }
                    catch (ADExternalException ex3)
                    {
                        ReplayEventLogConstants.Tuple_TcpListenerFailedToStart.LogEvent(null, new object[]
                        {
                            ex3
                        });
                    }
                    catch (ADOperationException ex4)
                    {
                        ReplayEventLogConstants.Tuple_TcpListenerFailedToStart.LogEvent(null, new object[]
                        {
                            ex4
                        });
                    }
                    finally
                    {
                        if (!RemoteDataProvider.s_initialized)
                        {
                            ClusterBatchWriter.Stop();
                        }
                    }
                    result = RemoteDataProvider.s_initialized;
                }
            }
            return(result);
        }