// Token: 0x06001BA1 RID: 7073 RVA: 0x00075F7C File Offset: 0x0007417C
        public AttemptCopyLastLogs(IPerfmonCounters perfmonCounters, ReplayConfiguration configuration, FileChecker fileChecker, bool performDivergenceCheck, ISetGeneration setGeneration, ISetViable setViable, bool fSkipHealthChecks, DatabaseMountDialOverride mountDialOverride, AcllPerformanceTracker acllPerf, string uniqueOperationId, int subactionAttemptNumber)
        {
            this.m_uniqueOperationId      = uniqueOperationId;
            this.m_subactionAttemptNumber = subactionAttemptNumber;
            this.m_acllPerf = acllPerf;
            this.m_fPerformDivergenceCheck = performDivergenceCheck;
            this.m_fSkipHealthChecks       = fSkipHealthChecks;
            this.m_mountDialOverride       = mountDialOverride;
            this.m_perfmonCounters         = perfmonCounters;
            this.m_configuration           = configuration;
            string displayName = this.m_configuration.DisplayName;

            this.m_setBrokenForCopier    = new SimpleSetBroken(displayName);
            this.m_setBrokenForInspector = new SimpleSetBroken(displayName);
            this.m_setBrokenForReplayer  = new SimpleSetBroken(displayName);
            this.m_setBrokenForOther     = new SimpleSetBroken(displayName);
            this.m_setGeneration         = setGeneration;
            this.m_setViable             = setViable;
            this.m_state          = this.m_configuration.ReplayState;
            this.m_fileChecker    = fileChecker;
            this.m_fileState      = fileChecker.FileState;
            this.m_logCopier      = null;
            this.m_logInspector   = null;
            this.m_remoteConfig   = (this.m_configuration as RemoteReplayConfiguration);
            this.NumberOfLogsLost = -1L;
            DiagCore.RetailAssert(this.m_remoteConfig != null, "ACLL is only supported for HA replicated databases", new object[0]);
        }
Exemplo n.º 2
0
        // Token: 0x06001B1A RID: 6938 RVA: 0x00074B9C File Offset: 0x00072D9C
        private void HandleDbCopyNotTarget(RpcSeederArgs seederArgs, ReplayConfiguration replayConfig)
        {
            ExTraceGlobals.SeederServerTracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "SeedManager: Database '{0}' ({1}) is NOT a replication target on the local machine. It is a source!", replayConfig.Name, seederArgs.InstanceGuid);
            DbCopyNotTargetException ex = new DbCopyNotTargetException(replayConfig.DatabaseName, Environment.MachineName);

            throw ex;
        }
Exemplo n.º 3
0
        public static void TaskConstructAllDatabaseConfigurations(IADDatabaseAvailabilityGroup dag, IADServer server, out List <ReplayConfiguration> activeConfigurations, out List <ReplayConfiguration> passiveConfigurations)
        {
            activeConfigurations  = new List <ReplayConfiguration>(20);
            passiveConfigurations = new List <ReplayConfiguration>(48);
            ActiveManager noncachingActiveManagerInstance = ActiveManager.GetNoncachingActiveManagerInstance();
            IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true);
            IEnumerable <IADDatabase>      allDatabases = iadtoplogyConfigurationSession.GetAllDatabases(server);

            if (allDatabases != null)
            {
                foreach (IADDatabase mdb in allDatabases)
                {
                    bool                flag;
                    Exception           ex;
                    ReplayConfiguration replayConfiguration = ReplayConfiguration.GetReplayConfiguration(dag, mdb, server, noncachingActiveManagerInstance, out flag, out ex);
                    if (replayConfiguration != null)
                    {
                        if (flag)
                        {
                            activeConfigurations.Add(replayConfiguration);
                        }
                        else
                        {
                            passiveConfigurations.Add(replayConfiguration);
                        }
                    }
                }
            }
        }
Exemplo n.º 4
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.º 5
0
        public static List <string> GetServersWithServerRoleInSite(string serverName, ServerRole serverRole)
        {
            IADToplogyConfigurationSession iadtoplogyConfigurationSession = ADSessionFactory.CreateIgnoreInvalidRootOrgSession(true);
            IADServer iadserver = null;

            if (!string.IsNullOrEmpty(serverName))
            {
                if (!SharedHelper.StringIEquals(serverName, "localhost"))
                {
                    goto IL_2F;
                }
            }
            try
            {
                iadserver = iadtoplogyConfigurationSession.FindServerByName(Environment.MachineName);
                goto IL_5A;
            }
            catch (LocalServerNotFoundException)
            {
                goto IL_5A;
            }
IL_2F:
            string nodeNameFromFqdn = MachineName.GetNodeNameFromFqdn(serverName);

            iadserver = iadtoplogyConfigurationSession.FindServerByName(nodeNameFromFqdn);
            string arg = "FindServerByName";

            if (iadserver == null)
            {
                ExTraceGlobals.ReplayConfigurationTracer.TraceDebug <string, string>(0L, "GetServersWithServerRoleInSite: {0} didn't find any server for {1}", arg, serverName);
            }
IL_5A:
            return(ReplayConfiguration.GetServersWithServerRoleInSiteByServer(iadserver, serverRole));
        }
Exemplo n.º 6
0
 // Token: 0x06001D66 RID: 7526 RVA: 0x00084C78 File Offset: 0x00082E78
 public LogRepair(ReplayConfiguration cfg)
 {
     this.Config = cfg;
     LogRepair.Tracer.TraceDebug <string>((long)this.GetHashCode(), "LogRepair({0}): constructing", this.Config.DisplayName);
     this.m_workingPath = Path.Combine(this.Config.DestinationLogPath, "LogRepair");
     FileOperations.RemoveDirectory(this.m_workingPath);
     Directory.CreateDirectory(this.m_workingPath);
     this.EseLogVerifier       = new LogChecksummer(this.Config.LogFilePrefix);
     this.m_verifierLogDataBuf = new byte[1048576];
 }
Exemplo n.º 7
0
 // Token: 0x060020B5 RID: 8373 RVA: 0x00096F94 File Offset: 0x00095194
 public SourceReplicaInstance(ReplayConfiguration replayConfiguration, ReplicaInstance previousReplicaInstance, IPerfmonCounters perfCounters) : base(replayConfiguration, false, previousReplicaInstance, perfCounters)
 {
     ReplicaInstance.DisposeIfActionUnsuccessful(delegate
     {
         this.TraceDebug("object created");
         ExTraceGlobals.PFDTracer.TracePfd <int>((long)this.GetHashCode(), "PFD CRS {0} SourceReplicaInstance is created", 32029);
         base.InitializeSuspendState();
         base.CurrentContext.InitializeForSource();
     }, this);
 }
Exemplo n.º 8
0
        public static List <ReplayConfiguration> GetAllLocalCopyConfigurationsForVss()
        {
            Dependencies.ADConfig.Refresh("GetAllLocalCopyConfigurationsForVss");
            List <ReplayConfiguration> list;
            List <ReplayConfiguration> collection;
            List <KeyValuePair <IADDatabase, Exception> > list2;

            ReplayConfiguration.ConstructAllLocalConfigurations(Dependencies.ADConfig, null, out list, out collection, out list2);
            list.AddRange(collection);
            return(list);
        }
Exemplo n.º 9
0
        public static void ConstructAllLocalConfigurations(IADConfig adConfig, ActiveManager activeManager, out List <ReplayConfiguration> currentSourceConfigurations, out List <ReplayConfiguration> currentRemoteTargetConfigurations, out List <KeyValuePair <IADDatabase, Exception> > failedConfigurations)
        {
            currentSourceConfigurations       = new List <ReplayConfiguration>(20);
            currentRemoteTargetConfigurations = new List <ReplayConfiguration>(48);
            failedConfigurations = new List <KeyValuePair <IADDatabase, Exception> >();
            if (activeManager == null)
            {
                activeManager = ActiveManager.GetNoncachingActiveManagerInstance();
            }
            IADServer localServer = adConfig.GetLocalServer();

            if (localServer == null)
            {
                ReplayConfiguration.Tracer.TraceError(0L, "ConstructAllLocalConfigurations: didn't find local server");
                return;
            }
            IEnumerable <IADDatabase> databasesOnLocalServer = adConfig.GetDatabasesOnLocalServer();

            if (databasesOnLocalServer == null)
            {
                ReplayConfiguration.Tracer.TraceError(0L, "There are no mailbox dbs on this server");
                return;
            }
            IADDatabaseAvailabilityGroup localDag = adConfig.GetLocalDag();

            foreach (IADDatabase iaddatabase in databasesOnLocalServer)
            {
                Exception           ex = null;
                bool                flag;
                ReplayConfiguration replayConfiguration = ReplayConfiguration.GetReplayConfiguration(localDag, iaddatabase, localServer, activeManager, out flag, out ex);
                if (replayConfiguration != null)
                {
                    if (flag)
                    {
                        currentSourceConfigurations.Add(replayConfiguration);
                    }
                    else
                    {
                        currentRemoteTargetConfigurations.Add(replayConfiguration);
                    }
                }
                else if (ex != null)
                {
                    ReplayConfiguration.Tracer.TraceError <Guid, string>(0L, "ReplayConfiguration for database '{0}' was not created due to an Exception. The configuration will not be added to the list of possible instances to run. Exception: {1}", iaddatabase.Guid, ex.ToString());
                    failedConfigurations.Add(new KeyValuePair <IADDatabase, Exception>(iaddatabase, ex));
                }
                else
                {
                    ReplayConfiguration.Tracer.TraceError <string>(0L, "ConstructAllLocalConfigurations() did not find a ReplayConfiguration for database '{0}' and no error occurred.", iaddatabase.Name);
                }
            }
        }
Exemplo n.º 10
0
        // Token: 0x06001B1B RID: 6939 RVA: 0x00074BE0 File Offset: 0x00072DE0
        private bool IsDBCurrentReplicaInstance(Guid guid, out ReplayConfiguration replayConfig, out bool fSource)
        {
            replayConfig = null;
            fSource      = false;
            ReplicaInstance replicaInstance;

            if (this.m_replicaInstanceManager.TryGetReplicaInstance(guid, out replicaInstance))
            {
                replayConfig = replicaInstance.Configuration;
                fSource      = (replayConfig.Type == ReplayConfigType.RemoteCopySource);
                return(true);
            }
            return(false);
        }
Exemplo n.º 11
0
        public static Dictionary <Guid, ReplayConfiguration> GetAllLocalConfigurations(IADConfig adConfig, ActiveManager activeManager, out List <KeyValuePair <IADDatabase, Exception> > failedConfigurations)
        {
            Dictionary <Guid, ReplayConfiguration> dictionary = new Dictionary <Guid, ReplayConfiguration>(48);

            ExTraceGlobals.ReplayManagerTracer.TraceDebug(0L, "GetConfigurations: Looking for possible Configurations.");
            List <ReplayConfiguration> configList;
            List <ReplayConfiguration> configList2;

            ReplayConfiguration.ConstructAllLocalConfigurations(adConfig, activeManager, out configList, out configList2, out failedConfigurations);
            ReplayConfigurationHelper.AddConfigurationsToDictionary(configList, dictionary);
            ReplayConfigurationHelper.AddConfigurationsToDictionary(configList2, dictionary);
            ExTraceGlobals.ReplayManagerTracer.TraceDebug <int>(0L, "Found {0} configurations in total.", dictionary.Count);
            return(dictionary);
        }
Exemplo n.º 12
0
        internal static bool IsDbPendingLcrRcrTarget(Guid guid, out ReplayConfiguration replayConfig, out bool fSource)
        {
            replayConfig = null;
            fSource      = false;
            IADDatabaseAvailabilityGroup dag;
            IADDatabase db;
            IADServer   server;
            bool        flag = SeedHelper.IsDbPendingLcrRcrTarget(guid, out dag, out db, out server);

            if (flag)
            {
                replayConfig = RemoteReplayConfiguration.TaskGetReplayConfig(dag, db, server);
                fSource      = (replayConfig.Type == ReplayConfigType.RemoteCopySource);
            }
            return(flag);
        }
Exemplo n.º 13
0
 // Token: 0x0600239A RID: 9114 RVA: 0x000A71C8 File Offset: 0x000A53C8
 public static void StartMonitoredDatabase(ReplayConfiguration config)
 {
     lock (RemoteDataProvider.s_singletonLock)
     {
         MonitoredDatabase monitoredDatabase = null;
         if (RemoteDataProvider.s_databases.TryGetInstance(config.Identity, out monitoredDatabase))
         {
             throw new MonitoredDatabaseInitException(config.DatabaseName, "MonitoredDatabase should not have existed");
         }
         MonitoredDatabase monitoredDatabase2 = new MonitoredDatabase(config);
         MonitoredDatabaseInitException ex    = monitoredDatabase2.StartMonitoring();
         if (ex != null)
         {
             throw ex;
         }
         RemoteDataProvider.s_databases.AddInstance(monitoredDatabase2);
         RemoteDataProvider.Tracer.TraceDebug <string>((long)monitoredDatabase2.GetHashCode(), "StartMonitoredDatabase has activated {0}", monitoredDatabase2.DatabaseName);
     }
 }
Exemplo n.º 14
0
        public static List <string> GetServersWithServerRoleInSiteByServer(IADServer mailboxServer, ServerRole serverRole)
        {
            List <string> list = new List <string>();
            ITopologyConfigurationSession topologyConfigurationSession = DirectorySessionFactory.Default.CreateTopologyConfigurationSession(ConsistencyMode.IgnoreInvalid, ADSessionSettings.FromRootOrgScopeSet(), 328, "GetServersWithServerRoleInSiteByServer", "f:\\15.00.1497\\sources\\dev\\cluster\\src\\Replay\\Core\\ReplayConfiguration.cs");
            ADObjectId siteId = null;

            if (mailboxServer != null && mailboxServer.ServerSite != null)
            {
                siteId = mailboxServer.ServerSite;
            }
            try
            {
                QueryFilter            filter        = ReplayConfiguration.BuildServerFilterForSiteWithServerRole(siteId, serverRole);
                ADPagedReader <Server> adpagedReader = topologyConfigurationSession.FindPaged <Server>(null, QueryScope.SubTree, filter, null, 0);
                foreach (Server server in adpagedReader)
                {
                    if (mailboxServer != null && server.MajorVersion != mailboxServer.MajorVersion)
                    {
                        ExTraceGlobals.ReplayConfigurationTracer.TraceDebug <string, int, int>(0L, "GetServersWithServerRoleInSiteByServer: Filtering Server {0}, major version {1} doesn't match {2}", server.Name, server.MajorVersion, mailboxServer.MajorVersion);
                    }
                    else
                    {
                        ExTraceGlobals.ReplayConfigurationTracer.TraceDebug <string>(0L, "GetServersWithServerRoleInSiteByServer: Found Server {0}", server.Name);
                        list.Add(server.Name);
                    }
                }
                return(list);
            }
            catch (ADTransientException arg)
            {
                ExTraceGlobals.ReplayConfigurationTracer.TraceDebug <ADTransientException>(0L, "GetServersWithServerRoleInSiteByServer: Exception {0}", arg);
            }
            catch (ADOperationException arg2)
            {
                ExTraceGlobals.ReplayConfigurationTracer.TraceDebug <ADOperationException>(0L, "GetServersWithServerRoleInSiteByServer: Exception {0}", arg2);
            }
            catch (DataValidationException arg3)
            {
                ExTraceGlobals.ReplayConfigurationTracer.TraceDebug <DataValidationException>(0L, "GetServersWithServerRoleInSiteByServer: Exception {0}", arg3);
            }
            return(list);
        }
 // Token: 0x06000942 RID: 2370 RVA: 0x0002B914 File Offset: 0x00029B14
 private void ScheduleDumpsterRedelivery(object obj)
 {
     try
     {
         ReplayConfiguration replayConfiguration = obj as ReplayConfiguration;
         ExTraceGlobals.DumpsterTracer.TraceDebug <string, string>(0L, "DumpsterRedeliveryManager: ScheduleDumpsterRedelivery for {0}({1}).", replayConfiguration.Name, replayConfiguration.Identity);
         DumpsterRedeliveryWrapper.DoRedeliveryIfRequired(replayConfiguration);
     }
     finally
     {
         lock (this)
         {
             this.m_numOutstandingRequests--;
             if (this.m_numOutstandingRequests == 0)
             {
                 this.m_doneEvent.Set();
             }
         }
     }
 }
Exemplo n.º 16
0
        // Token: 0x06002398 RID: 9112 RVA: 0x000A6E5C File Offset: 0x000A505C
        public static void MonitorDatabases(List <string> databasesToStopMonitoring, List <string> databasesToRestartMonitoring, Dictionary <string, ReplayConfiguration> configurationsFound)
        {
            List <MonitoredDatabase> list = new List <MonitoredDatabase>(databasesToStopMonitoring.Count);

            lock (RemoteDataProvider.s_singletonLock)
            {
                if (RemoteDataProvider.s_tprEnabled)
                {
                    return;
                }
                MonitoredDatabase[] allInstances = RemoteDataProvider.s_databases.GetAllInstances();
                foreach (MonitoredDatabase monitoredDatabase in allInstances)
                {
                    if (databasesToStopMonitoring.Contains(monitoredDatabase.Identity))
                    {
                        ExTraceGlobals.MonitoredDatabaseTracer.TraceDebug <string>(0L, "Config for MonitoredDatabase is gone: {0}", monitoredDatabase.Config.DatabaseName);
                        SourceSeedTable.Instance.CancelSeedingIfAppropriate(SourceSeedTable.CancelReason.CopyRemoved, monitoredDatabase.DatabaseGuid);
                        list.Add(monitoredDatabase);
                        RemoteDataProvider.s_databases.RemoveInstance(monitoredDatabase);
                    }
                }
                foreach (KeyValuePair <string, ReplayConfiguration> keyValuePair in configurationsFound)
                {
                    ReplayConfiguration value = keyValuePair.Value;
                    bool flag2 = value.Type == ReplayConfigType.RemoteCopySource;
                    bool flag3 = flag2 || (value.Type == ReplayConfigType.RemoteCopyTarget && !value.ReplayState.Suspended);
                    MonitoredDatabase monitoredDatabase2 = null;
                    if (RemoteDataProvider.s_databases.TryGetInstance(value.Identity, out monitoredDatabase2))
                    {
                        if (flag3 && !databasesToRestartMonitoring.Contains(monitoredDatabase2.Identity))
                        {
                            RemoteDataProvider.Tracer.TraceDebug <string>((long)monitoredDatabase2.GetHashCode(), "Config not changed, or the associated RI was not restarted. Continuing to monitor: {0}", value.DatabaseName);
                            continue;
                        }
                        RemoteDataProvider.Tracer.TraceDebug <string>((long)monitoredDatabase2.GetHashCode(), "Config for MonitoredDatabase is changing or a restart was requested: {0}", value.DatabaseName);
                        SourceSeedTable.Instance.CancelSeedingIfAppropriate(SourceSeedTable.CancelReason.ConfigChanged, monitoredDatabase2.DatabaseGuid);
                        list.Add(monitoredDatabase2);
                    }
                    if (!flag2)
                    {
                        RemoteDataProvider.Tracer.TraceDebug <string>(0L, "Not starting monitor for {0}", value.DatabaseName);
                        if (monitoredDatabase2 != null)
                        {
                            RemoteDataProvider.s_databases.RemoveInstance(monitoredDatabase2);
                        }
                    }
                    else
                    {
                        if (monitoredDatabase2 != null && !monitoredDatabase2.IsPassiveCopy)
                        {
                            monitoredDatabase2.StopMonitoring();
                        }
                        MonitoredDatabase monitoredDatabase3 = new MonitoredDatabase(value);
                        if (monitoredDatabase3.StartMonitoring() == null)
                        {
                            if (monitoredDatabase2 != null)
                            {
                                RemoteDataProvider.s_databases.UpdateInstance(monitoredDatabase2, monitoredDatabase3);
                            }
                            else
                            {
                                RemoteDataProvider.s_databases.AddInstance(monitoredDatabase3);
                            }
                            RemoteDataProvider.Tracer.TraceDebug <string>((long)monitoredDatabase3.GetHashCode(), "Now monitoring: {0}", value.DatabaseName);
                        }
                        else
                        {
                            RemoteDataProvider.Tracer.TraceError <ReplayConfiguration>((long)monitoredDatabase3.GetHashCode(), "Unable to monitor remote requests for configuration {0}", value);
                            if (monitoredDatabase2 != null)
                            {
                                RemoteDataProvider.s_databases.RemoveInstance(monitoredDatabase2);
                            }
                        }
                    }
                }
            }
            foreach (MonitoredDatabase monitoredDatabase4 in list)
            {
                monitoredDatabase4.StopMonitoring();
            }
            list.Clear();
        }
        // Token: 0x06001BB1 RID: 7089 RVA: 0x00076118 File Offset: 0x00074318
        public static AmAcllReturnStatus AttemptCopyLastLogsOnceRcr(IPerfmonCounters perfmonCounters, ReplayConfiguration configuration, FileChecker fileChecker, ISetGeneration setGeneration, ISetViable setViable, LogCopier logCopier, LogInspector logInspector, LogReplayer logReplayer, bool performDivergenceCheck, bool fSkipHealthChecks, DatabaseMountDialOverride mountDialOverride, AcllPerformanceTracker acllPerf, string uniqueOperationId, int subactionAttemptNumber, bool mountPending)
        {
            AttemptCopyLastLogs attemptCopyLastLogs = new AttemptCopyLastLogs(perfmonCounters, configuration, fileChecker, performDivergenceCheck, setGeneration, setViable, fSkipHealthChecks, mountDialOverride, acllPerf, uniqueOperationId, subactionAttemptNumber);

            attemptCopyLastLogs.MakeAttempt(logCopier, logInspector, logReplayer);
            return(attemptCopyLastLogs.GetReturnStatus());
        }
Exemplo n.º 18
0
        // Token: 0x06001B19 RID: 6937 RVA: 0x00074918 File Offset: 0x00072B18
        private void CheckDbValidReplicationTarget(RpcSeederArgs seederArgs, out ReplayConfiguration replayConfig)
        {
            replayConfig = null;
            ADReplicationRetryTimer adreplicationRetryTimer = new ADReplicationRetryTimer();
            bool flag = !seederArgs.SeedDatabase && seederArgs.SeedCiFiles;

            try
            {
                bool flag2;
                while (!this.IsDBCurrentReplicaInstance(seederArgs.InstanceGuid, out replayConfig, out flag2))
                {
                    if (SeedHelper.IsDbPendingLcrRcrTarget(seederArgs.InstanceGuid, out replayConfig, out flag2))
                    {
                        if (flag2)
                        {
                            if (flag)
                            {
                                ExTraceGlobals.SeederServerTracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "SeedManager: Database '{0}' ({1}) is not a valid RCR replica target but the requested seeding is CI only.", replayConfig.Name, seederArgs.InstanceGuid);
                                return;
                            }
                            this.HandleDbCopyNotTarget(seederArgs, replayConfig);
                        }
                        ExTraceGlobals.SeederServerTracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "SeedManager: Database '{0}' ({1}) is a valid RCR replica target.", replayConfig.Name, seederArgs.InstanceGuid);
                        return;
                    }
                    ExTraceGlobals.SeederServerTracer.TraceDebug <Guid>((long)this.GetHashCode(), "SeedManager: Database '{0}' is NOT a valid RCR replica target!", seederArgs.InstanceGuid);
                    if (adreplicationRetryTimer.IsExpired)
                    {
                        throw new InvalidDbForSeedSpecifiedException();
                    }
                    adreplicationRetryTimer.Sleep();
                }
                if (flag2)
                {
                    if (flag)
                    {
                        ExTraceGlobals.SeederServerTracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "SeedManager: Database '{0}' ({1}) is not running as a valid RCR replica target but the requested seeding is CI only.", replayConfig.Name, seederArgs.InstanceGuid);
                        return;
                    }
                    this.HandleDbCopyNotTarget(seederArgs, replayConfig);
                }
                ExTraceGlobals.SeederServerTracer.TraceDebug <string, Guid>((long)this.GetHashCode(), "SeedManager: Database '{0}' ({1}) is currently running as a valid RCR replica target.", replayConfig.Name, seederArgs.InstanceGuid);
            }
            catch (DataSourceOperationException ex)
            {
                ExTraceGlobals.SeederServerTracer.TraceError <DataSourceOperationException>((long)this.GetHashCode(), "SeedManager: CheckDBValidReplicationTarget: Exception encountered: {0}", ex);
                throw new SeedPrepareException(ex.ToString(), ex);
            }
            catch (DataValidationException ex2)
            {
                ExTraceGlobals.SeederServerTracer.TraceError <DataValidationException>((long)this.GetHashCode(), "SeedManager: CheckDBValidReplicationTarget: Exception encountered: {0}", ex2);
                throw new SeedPrepareException(ex2.ToString(), ex2);
            }
            catch (ObjectNotFoundException ex3)
            {
                ExTraceGlobals.SeederServerTracer.TraceError <ObjectNotFoundException>((long)this.GetHashCode(), "SeedManager: CheckDBValidReplicationTarget: Exception encountered: {0}", ex3);
                throw new SeedPrepareException(ex3.ToString(), ex3);
            }
            catch (StoragePermanentException ex4)
            {
                ExTraceGlobals.SeederServerTracer.TraceError <StoragePermanentException>((long)this.GetHashCode(), "SeedManager: CheckDBValidReplicationTarget: Exception encountered: {0}", ex4);
                throw new SeedPrepareException(ex4.ToString(), ex4);
            }
            catch (TransientException ex5)
            {
                ExTraceGlobals.SeederServerTracer.TraceError <TransientException>((long)this.GetHashCode(), "SeedManager: CheckDBValidReplicationTarget: Exception encountered: {0}", ex5);
                throw new SeedPrepareException(ex5.ToString(), ex5);
            }
        }
Exemplo n.º 19
0
 public static List <string> GetBHServersInSite(string serverName)
 {
     return(ReplayConfiguration.GetServersWithServerRoleInSite(serverName, ServerRole.HubTransport));
 }
Exemplo n.º 20
0
        // Token: 0x060020A8 RID: 8360 RVA: 0x00096E58 File Offset: 0x00095058
        internal bool TryGetBackupReplicaInstance(Guid guid, out ReplicaInstance instance)
        {
            string identityFromGuid = ReplayConfiguration.GetIdentityFromGuid(guid);

            return(base.TryGetInstance(identityFromGuid, out instance));
        }
        // Token: 0x06000A21 RID: 2593 RVA: 0x0002F2C0 File Offset: 0x0002D4C0
        public static void MoveLogFiles(ReplayConfiguration config, FileState fileState, ISetBroken setBroken, long corruptLogGen)
        {
            string    text = Path.Combine(config.E00LogBackupPath, "SkippedLogs");
            Exception ex   = DirectoryOperations.TryCreateDirectory(text);

            if (ex != null)
            {
                setBroken.SetBroken(FailureTag.Configuration, ReplayEventLogConstants.Tuple_FailedToCreateDirectory, ex, new string[]
                {
                    text,
                    ex.ToString()
                });
                return;
            }
            string currentDateString = FileOperations.GetCurrentDateString();
            string text2             = Path.Combine(text, currentDateString);

            ex = DirectoryOperations.TryCreateDirectory(text2);
            if (ex != null)
            {
                setBroken.SetBroken(FailureTag.Configuration, ReplayEventLogConstants.Tuple_FailedToCreateDirectory, ex, new string[]
                {
                    text2,
                    ex.ToString()
                });
                return;
            }
            string destinationLogPath = config.DestinationLogPath;
            string text3 = string.Empty;
            string path  = string.Empty;

            try
            {
                ReplayEventLogConstants.Tuple_MovingFilesToRestartLogStream.LogEvent(null, new object[]
                {
                    config.DatabaseName,
                    EseHelper.MakeLogfileName(config.LogFilePrefix, config.LogFileSuffix, corruptLogGen),
                    text2
                });
                foreach (string text4 in Directory.GetFiles(destinationLogPath, "*." + config.LogExtension))
                {
                    text3 = text4;
                    path  = Path.GetFileName(text4);
                    long logfileGenerationFromFilePath = EseHelper.GetLogfileGenerationFromFilePath(text4, config.LogFilePrefix);
                    if (logfileGenerationFromFilePath >= fileState.LowestGenerationRequired)
                    {
                        ExTraceGlobals.ReplicaInstanceTracer.TraceError <string>(0L, "MoveLogFiles(): Cannot move logfile '{0}' because it is required by the database.", text4);
                    }
                    else
                    {
                        File.Move(text4, Path.Combine(text2, path));
                    }
                }
                foreach (string text5 in Directory.GetFiles(destinationLogPath, "*.jsl"))
                {
                    text3 = text5;
                    path  = Path.GetFileName(text5);
                    File.Move(text5, Path.Combine(text2, path));
                }
                ExTraceGlobals.ReplicaInstanceTracer.TraceError <string>(0L, "Moved log files successfully from '{0}'", config.DestinationLogPath);
            }
            catch (IOException ex2)
            {
                ExTraceGlobals.ReplicaInstanceTracer.TraceError <string, string, IOException>(0L, "Moving file '{0}' to '{1}' failed with exception: {2}", text3, text2, ex2);
                setBroken.SetBroken(ReplicaInstance.IOExceptionToFailureTag(ex2), ReplayEventLogConstants.Tuple_CouldNotDeleteLogFile, ex2, new string[]
                {
                    text3,
                    ex2.ToString()
                });
            }
            catch (UnauthorizedAccessException ex3)
            {
                ExTraceGlobals.ReplicaInstanceTracer.TraceError <string, string, UnauthorizedAccessException>(0L, "Moving file '{0}' to '{1}' failed with exception: {2}", text3, text2, ex3);
                setBroken.SetBroken(FailureTag.AlertOnly, ReplayEventLogConstants.Tuple_CouldNotDeleteLogFile, ex3, new string[]
                {
                    text3,
                    ex3.ToString()
                });
            }
        }
Exemplo n.º 22
0
        internal static void TryUpdateLastLogGenerationNumberOnMount(ReplayConfiguration config, LogStreamResetOnMount logReset, MountDirectPerformanceTracker mountPerf, int mountFlags, long highestLogGen)
        {
            bool flag = (mountFlags & 2) == 2;

            mountPerf.IsLossyMountEnabled = flag;
            mountPerf.HighestLogGenBefore = highestLogGen;
            mountPerf.HighestLogGenAfter  = highestLogGen;
            ExTraceGlobals.ReplayManagerTracer.TraceDebug <string, Guid, bool>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): fLossyMountEnabled = '{2}'", config.Name, config.IdentityGuid, flag);
            string logDirectory = config.DestinationLogPath;

            if (!flag)
            {
                long lowestLogGen = 0L;
                mountPerf.RunTimedOperation(MountDatabaseDirectOperation.LowestGenerationInDirectory, delegate
                {
                    lowestLogGen = ShipControl.LowestGenerationInDirectory(new DirectoryInfo(logDirectory), config.LogFilePrefix, "." + config.LogExtension, true);
                });
                if (lowestLogGen == 0L)
                {
                    ExTraceGlobals.ReplayManagerTracer.TraceDebug((long)config.GetHashCode(), "Looks like a log stream reset");
                    logReset.ResetLogStream();
                    return;
                }
            }
            if (config.Type == ReplayConfigType.SingleCopySource)
            {
                ExTraceGlobals.ReplayManagerTracer.TraceDebug <string, Guid, ReplayConfigType>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Skipping updating last log generation since the config is of type '{2}'.", config.DisplayName, config.IdentityGuid, config.Type);
                return;
            }
            try
            {
                if (highestLogGen > 0L)
                {
                    ExTraceGlobals.ReplayManagerTracer.TraceDebug <string, Guid, long>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Known highest log generation is {2}.", config.Name, config.IdentityGuid, highestLogGen);
                    mountPerf.RunTimedOperation(MountDatabaseDirectOperation.GenerationAvailableInDirectory, delegate
                    {
                        if (!ShipControl.GenerationAvailableInDirectory(new DirectoryInfo(logDirectory), config.LogFilePrefix, "." + config.LogExtension, highestLogGen))
                        {
                            ExTraceGlobals.ReplayManagerTracer.TraceDebug <string, Guid>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Log file for known highest generation does not exist, will scan directory to determine the max generation.", config.Name, config.IdentityGuid);
                            highestLogGen = 0L;
                        }
                    });
                }
                if (highestLogGen <= 0L)
                {
                    mountPerf.RunTimedOperation(MountDatabaseDirectOperation.HighestGenerationInDirectory, delegate
                    {
                        highestLogGen = ShipControl.HighestGenerationInDirectory(new DirectoryInfo(logDirectory), config.LogFilePrefix, "." + config.LogExtension);
                    });
                    ExTraceGlobals.ReplayManagerTracer.TraceDebug((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Highest log in directory '{2}' is {3}.", new object[]
                    {
                        config.Name,
                        config.IdentityGuid,
                        logDirectory,
                        highestLogGen
                    });
                }
                mountPerf.HighestLogGenAfter = highestLogGen;
                if (highestLogGen <= 0L)
                {
                    ExTraceGlobals.ReplayManagerTracer.TraceDebug <string, Guid>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Skipping updating last log generation since highest log gen is <= 0.", config.Name, config.IdentityGuid);
                }
                else
                {
                    mountPerf.RunTimedOperation(MountDatabaseDirectOperation.UpdateLastLogGeneratedInClusDB, delegate
                    {
                        config.UpdateLastLogGeneratedAndEndOfLogInfo(highestLogGen);
                    });
                }
            }
            catch (IOException ex)
            {
                ExTraceGlobals.ReplayManagerTracer.TraceError((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Caught IO exception for path '{2}'. {3}", new object[]
                {
                    config.Name,
                    config.IdentityGuid,
                    logDirectory,
                    ex
                });
            }
            catch (SecurityException ex2)
            {
                ExTraceGlobals.ReplayManagerTracer.TraceError((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Caught SecurityException for path '{2}'. {3}", new object[]
                {
                    config.Name,
                    config.IdentityGuid,
                    logDirectory,
                    ex2
                });
            }
            catch (ClusterException arg)
            {
                ExTraceGlobals.ReplayManagerTracer.TraceError <string, Guid, ClusterException>((long)config.GetHashCode(), "TryUpdateLastLogGenerationNumber {0} ({1}): Caught exception at SetLastLogGenerationNumber. {2}", config.Name, config.IdentityGuid, arg);
            }
        }
Exemplo n.º 23
0
        public static ReplayConfiguration GetReplayConfiguration(IADDatabaseAvailabilityGroup dag, IADDatabase mdb, IADServer hostServer, ActiveManager activeManager, out bool fSource, out Exception ex)
        {
            ReplayConfiguration result = null;

            fSource = false;
            ex      = null;
            try
            {
                DatabaseLocationInfo serverForDatabase = activeManager.GetServerForDatabase(mdb.Guid, GetServerForDatabaseFlags.BasicQuery);
                if (string.IsNullOrEmpty(serverForDatabase.ServerFqdn))
                {
                    ReplayConfiguration.Tracer.TraceDebug <string>(0L, "GetReplayConfiguration({0}) Performing a BasicQuery was insufficient. Calling again with AD access.", mdb.Name);
                    serverForDatabase = activeManager.GetServerForDatabase(mdb.Guid);
                }
                else
                {
                    ReplayConfiguration.Tracer.TraceDebug <string>(0L, "GetReplayConfiguration({0}) Performing a BasicQuery was sufficient. AD calls were avoided!", mdb.Name);
                }
                AmServerName amServerName  = new AmServerName(serverForDatabase.ServerFqdn);
                AmServerName amServerName2 = new AmServerName(hostServer.Fqdn);
                ReplayConfiguration.Tracer.TraceDebug <string, string, string>(0L, "GetReplayConfiguration({0}): GSFD returned active server of: {1}, hostServerFqdn is: {2}", mdb.Name, amServerName.Fqdn, amServerName2.Fqdn);
                if (AmServerName.IsEqual(amServerName, amServerName2))
                {
                    fSource = true;
                }
                if (fSource)
                {
                    if (mdb.ReplicationType == ReplicationType.None)
                    {
                        result = new SingleCopyReplayConfiguration(dag, mdb, hostServer, LockType.ReplayService);
                    }
                    else
                    {
                        result = RemoteReplayConfiguration.ServiceGetReplayConfig(dag, mdb, hostServer, serverForDatabase.ServerFqdn, ReplayConfigType.RemoteCopySource);
                    }
                }
                else
                {
                    if (mdb.ReplicationType != ReplicationType.Remote)
                    {
                        throw new ReplayConfigNotFoundException(mdb.Name, hostServer.Name);
                    }
                    result = RemoteReplayConfiguration.ServiceGetReplayConfig(dag, mdb, hostServer, serverForDatabase.ServerFqdn, ReplayConfigType.RemoteCopyTarget);
                }
            }
            catch (DatabaseNotFoundException ex2)
            {
                ex = ex2;
            }
            catch (ServerForDatabaseNotFoundException ex3)
            {
                ex = ex3;
            }
            catch (ObjectNotFoundException ex4)
            {
                ex = ex4;
            }
            catch (TransientException ex5)
            {
                ex = ex5;
            }
            return(result);
        }
Exemplo n.º 24
0
 // Token: 0x060020AA RID: 8362 RVA: 0x00096E7E File Offset: 0x0009507E
 public SingleCopyReplicaInstance(ReplayConfiguration replayConfiguration, IPerfmonCounters perfCounters) : base(replayConfiguration, false, null, perfCounters)
 {
     ReplicaInstance.DisposeIfActionUnsuccessful(delegate
     {
     }, this);
 }
Exemplo n.º 25
0
 public TargetReplicaInstance(ReplayConfiguration replayConfiguration, ReplicaInstance previousReplicaInstance, IPerfmonCounters perfCounters) : base(replayConfiguration, true, previousReplicaInstance, perfCounters)
 {
     TargetReplicaInstance < > 4__this = this;
     ReplicaInstance.DisposeIfActionUnsuccessful(delegate
     {
Exemplo n.º 26
0
 public PerfCounterUpdater(IPerfmonCounters counters, ReplayConfiguration config) : base(TimeSpan.FromMilliseconds((double)RegistryParameters.PerfCounterUpdateIntervalInMSec), TimeSpan.FromMilliseconds((double)RegistryParameters.PerfCounterUpdateIntervalInMSec), "PerfCounterUpdater")
 {
     this.m_counters   = counters;
     this.m_config     = config;
     this.m_amCounters = ActiveManagerPerfmon.GetInstance(config.Name);
 }
 // Token: 0x06001B56 RID: 6998 RVA: 0x00075A91 File Offset: 0x00073C91
 public AcllPerformanceTracker(ReplayConfiguration config, string uniqueOperationId, int subactionAttemptNumber) : base("AcllPerf")
 {
     this.m_uniqueOperationId      = uniqueOperationId;
     this.m_subactionAttemptNumber = subactionAttemptNumber;
     this.m_config = config;
 }
Exemplo n.º 28
0
 public static List <string> GetFrontendTransportServersInLocalSite()
 {
     return(ReplayConfiguration.GetServersWithServerRoleInSite(null, ServerRole.FrontendTransport));
 }