Пример #1
0
        // Token: 0x06001951 RID: 6481 RVA: 0x00068A08 File Offset: 0x00066C08
        internal static LocalizedString CheckExchangeVolumesPresent(AutoReseedContext context)
        {
            IVolumeManager volumeManager = context.VolumeManager;
            int            num           = (from vol in volumeManager.Volumes
                                            where vol.IsExchangeVolume
                                            select vol).Count <ExchangeVolume>();

            if (num < 1)
            {
                return(ReplayStrings.AutoReseedNoExchangeVolumesConfigured(context.Dag.AutoDagVolumesRootFolderPath.PathName));
            }
            return(LocalizedString.Empty);
        }
Пример #2
0
        private void ProcessDatabaseInternal(IADDatabase db, IEnumerable <IADDatabase> databases, IMonitoringADConfig adConfig)
        {
            AutoReseedManager.Tracer.TraceDebug <string>((long)this.GetHashCode(), "AutoReseedManager.ProcessDatabase: Processing Database '{0}'...", db.Name);
            if (db.ReplicationType != ReplicationType.Remote)
            {
                AutoReseedManager.Tracer.TraceDebug <string>((long)this.GetHashCode(), "AutoReseedManager.ProcessDatabase: Database '{0}' is not a replicated database.", db.Name);
            }
            IEnumerable <CopyStatusClientCachedEntry> enumerable = this.LookupCachedCopyStatuses(db);
            IEnumerable <IADDatabase>   databases2       = adConfig.DatabaseMap[adConfig.TargetServerName];
            CopyStatusClientCachedEntry targetCopyStatus = enumerable.FirstOrDefault((CopyStatusClientCachedEntry status) => status.ServerContacted.Equals(adConfig.TargetServerName));

            this.LookupCachedCopyStatusesAcrossDag(adConfig);
            AutoReseedContext context = new AutoReseedContext(this.m_volumeManager, this.m_replicaInstanceManager, adConfig.Dag, db, databases2, adConfig.TargetServerName, adConfig.TargetMiniServer, targetCopyStatus, enumerable, this.m_serverStatusResults, this.m_dagStatusResults, this.m_seedLimiter, adConfig);

            this.m_launcher.BeginAutoReseedIfNecessary(context);
        }
        // Token: 0x060018FB RID: 6395 RVA: 0x00067124 File Offset: 0x00065324
        private void RunNeverMountedActiveWorkflow(AutoReseedContext context)
        {
            string name = context.Database.Name;

            if (context.TargetCopyStatus.CopyStatus.CopyStatus != CopyStatusEnum.Dismounted)
            {
                AutoReseedWorkflowLauncher.Tracer.TraceDebug <string, AmServerName>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.RunNeverMountedActiveWorkflow: Database copy '{0}\\{1}' is NOT 'Dismounted'. Skip RunNeverMountedActiveWorkflow.", name, context.TargetServerName);
                return;
            }
            if (context.Database.DatabaseCreated)
            {
                AutoReseedWorkflowLauncher.Tracer.TraceDebug <string, AmServerName>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: Database copy '{0}\\{1}' is 'Dismounted' but database has previously been mounted. Skipping.", name, context.TargetServerName);
                return;
            }
            AutoReseedWorkflowLauncher.Tracer.TraceDebug <string>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: Database '{0}' has never been mounted before. Launching the recovery workflow.", name);
            NeverMountedActiveWorkflow neverMountedActiveWorkflow = new NeverMountedActiveWorkflow(context, ReplayStrings.AutoReseedNeverMountedWorkflowReason);

            neverMountedActiveWorkflow.Execute();
        }
Пример #4
0
        // Token: 0x06001952 RID: 6482 RVA: 0x00068A6C File Offset: 0x00066C6C
        internal static LocalizedString CheckDatabaseLogPaths(AutoReseedContext context)
        {
            string path = Path.Combine(context.Dag.AutoDagDatabasesRootFolderPath.PathName, context.TargetCopyStatus.CopyStatus.DBName);
            string path2;
            string path3;

            VolumeManager.GetDatabaseLogEdbFolderNames(context.Database.Name, out path2, out path3);
            MountedFolderPath mountedFolderPath  = new MountedFolderPath(Path.Combine(path, path2));
            MountedFolderPath mountedFolderPath2 = new MountedFolderPath(Path.Combine(path, path3));
            MountedFolderPath mountedFolderPath3 = new MountedFolderPath(context.Database.LogFolderPath.PathName);
            MountedFolderPath mountedFolderPath4 = new MountedFolderPath(Path.GetDirectoryName(context.Database.EdbFilePath.PathName));

            if (!mountedFolderPath3.Equals(mountedFolderPath))
            {
                return(ReplayStrings.AutoReseedInvalidLogFolderPath(mountedFolderPath3.RawString, mountedFolderPath.RawString));
            }
            if (!mountedFolderPath4.Equals(mountedFolderPath2))
            {
                return(ReplayStrings.AutoReseedInvalidEdbFolderPath(mountedFolderPath4.RawString, mountedFolderPath2.RawString));
            }
            return(LocalizedString.Empty);
        }
        // Token: 0x060018FA RID: 6394 RVA: 0x0006700C File Offset: 0x0006520C
        private void RunHealthyCopyWorkflowIfNecessary(AutoReseedContext context)
        {
            Guid   guid = context.Database.Guid;
            string name = context.Database.Name;
            bool   flag = false;

            if (context.TargetCopyStatus.CopyStatus.CopyStatus == CopyStatusEnum.Healthy)
            {
                try
                {
                    AutoReseedWorkflowState autoReseedWorkflowState  = new AutoReseedWorkflowState(guid, AutoReseedWorkflowType.FailedSuspendedCopyAutoReseed);
                    AutoReseedWorkflowState autoReseedWorkflowState2 = new AutoReseedWorkflowState(guid, AutoReseedWorkflowType.ManualReseed);
                    AutoReseedWorkflowState autoReseedWorkflowState3 = new AutoReseedWorkflowState(guid, AutoReseedWorkflowType.ManualResume);
                    if (autoReseedWorkflowState2.IsLastReseedRecoveryActionPending() || autoReseedWorkflowState3.IsLastReseedRecoveryActionPending() || autoReseedWorkflowState.IsLastReseedRecoveryActionPending())
                    {
                        flag = true;
                        if (this.m_suppression.ReportHealthyWorkflowLaunchConditionMet(guid))
                        {
                            AutoReseedWorkflowLauncher.Tracer.TraceDebug <string, AmServerName>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: Database copy '{0}\\{1}' is Healthy with some prior recovery action having been completed. Launching the HealthyCopyCompletedSeedWorkflow workflow.", name, context.TargetServerName);
                            HealthyCopyCompletedSeedWorkflow healthyCopyCompletedSeedWorkflow = new HealthyCopyCompletedSeedWorkflow(context);
                            healthyCopyCompletedSeedWorkflow.Execute();
                        }
                        else
                        {
                            AutoReseedWorkflowLauncher.Tracer.TraceDebug <string, AmServerName, TimeSpan>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: Database copy '{0}\\{1}' is Healthy with some prior recovery action having been completed but launching the workflow is being skipped due suppression of {2}.", name, context.TargetServerName, AutoReseedWorkflowSuppression.s_dbHealthySuppressionInterval);
                        }
                    }
                }
                catch (RegistryParameterException arg)
                {
                    AutoReseedWorkflowLauncher.Tracer.TraceError <string, AmServerName, RegistryParameterException>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: Couldn't launch/execute HealthyCopyCompletedSeedWorkflow for database copy '{0}\\{1}' to potentially reset the AutoReseed state. Error: {2}", name, context.TargetServerName, arg);
                }
            }
            if (!flag)
            {
                this.m_suppression.ReportHealthyWorkflowNotNeeded(guid);
            }
        }
 public CatalogAutoReseedWorkflow(AutoReseedContext context, CatalogAutoReseedWorkflow.CatalogAutoReseedReason catalogReseedReason, string workflowLaunchReason) : base(AutoReseedWorkflowType.CatalogAutoReseed, workflowLaunchReason, context)
 {
     this.catalogReseedReason = catalogReseedReason;
 }
 public NeverMountedActiveWorkflow(AutoReseedContext context, string workflowLaunchReason) : base(AutoReseedWorkflowType.MountNeverMountedActive, workflowLaunchReason, context)
 {
 }
Пример #8
0
 public FailedCopyWorkflow(AutoReseedContext context, string workflowLaunchReason) : base(AutoReseedWorkflowType.FailedCopy, workflowLaunchReason, context)
 {
 }
        // Token: 0x060018F8 RID: 6392 RVA: 0x00066668 File Offset: 0x00064868
        public void BeginAutoReseedIfNecessary(AutoReseedContext context)
        {
            Guid   guid = context.Database.Guid;
            string name = context.Database.Name;

            if (context.TargetCopyStatus == null)
            {
                AutoReseedWorkflowLauncher.Tracer.TraceError <string, AmServerName>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: Database copy '{0}\\{1}' has null TargetCopyStatus. Skipping.", name, context.TargetServerName);
                return;
            }
            if (context.TargetCopyStatus.Result != CopyStatusRpcResult.Success)
            {
                AutoReseedWorkflowLauncher.Tracer.TraceError((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: Skipping since GetCopyStatus RPC to database copy '{0}\\{1}' failed. Result: {2}. Error: {3}.", new object[]
                {
                    name,
                    context.TargetServerName,
                    context.TargetCopyStatus.Result,
                    context.TargetCopyStatus.LastException
                });
                return;
            }
            this.RunNeverMountedActiveWorkflow(context);
            this.RunHealthyCopyWorkflowIfNecessary(context);
            ExtendedErrorInfo extendedErrorInfo = context.TargetCopyStatus.CopyStatus.ExtendedErrorInfo;

            if (context.TargetCopyStatus.CopyStatus.CopyStatus == CopyStatusEnum.Failed && (extendedErrorInfo == null || extendedErrorInfo.FailureException == null || !(extendedErrorInfo.FailureException is ReplayServiceRpcCopyStatusTimeoutException)))
            {
                if (context.TargetCopyStatus.IsActive)
                {
                    AutoReseedWorkflowLauncher.Tracer.TraceDebug <string, AmServerName>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: Database copy '{0}\\{1}' is 'Failed' but active. Skipping.", name, context.TargetServerName);
                    return;
                }
                if (this.m_suppression.ReportWorkflowLaunchConditionMet(AutoReseedWorkflowType.FailedCopy, guid, CatalogAutoReseedWorkflow.CatalogAutoReseedReason.None, 1))
                {
                    AutoReseedWorkflowLauncher.Tracer.TraceDebug <string, AmServerName, TimeSpan>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: Database copy '{0}\\{1}' has been 'Failed' for at least {2}. Launching the FailedCopyWorkflow workflow.", name, context.TargetServerName, AutoReseedWorkflowSuppression.s_dbFailedSuppresionInterval);
                    FailedCopyWorkflow failedCopyWorkflow = new FailedCopyWorkflow(context, context.TargetCopyStatus.CopyStatus.ErrorMessage);
                    failedCopyWorkflow.Execute();
                    return;
                }
                AutoReseedWorkflowLauncher.Tracer.TraceDebug((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: Database copy '{0}\\{1}' is 'Failed' but launching the recovery workflow is being skipped due to either initial suppression of {2}, or periodic suppression of {3}.", new object[]
                {
                    name,
                    context.TargetServerName,
                    AutoReseedWorkflowSuppression.s_dbFailedSuppresionInterval,
                    AutoReseedWorkflowSuppression.s_dbFailedSuppresionInterval
                });
                return;
            }
            else
            {
                if (context.TargetCopyStatus.CopyStatus.CopyStatus != CopyStatusEnum.FailedAndSuspended)
                {
                    if (context.TargetCopyStatus.CopyStatus.ContentIndexStatus == ContentIndexStatusType.FailedAndSuspended)
                    {
                        if (context.CopyStatusesForTargetDatabase.All((CopyStatusClientCachedEntry status) => status.Result == CopyStatusRpcResult.Success && (status.CopyStatus.ContentIndexStatus == ContentIndexStatusType.Disabled || status.CopyStatus.ContentIndexStatus == ContentIndexStatusType.Suspended || status.CopyStatus.ContentIndexStatus == ContentIndexStatusType.FailedAndSuspended)))
                        {
                            AutoReseedWorkflowLauncher.Tracer.TraceDebug <string, Guid, string>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: AutoReseed workflow launcher detected all catalogs failed for database '{0}' [{1}]: {2}.", context.Database.Name, context.Database.Guid, context.TargetCopyStatus.CopyStatus.ErrorMessage);
                            ReplayCrimsonEvents.AutoReseedWorkflowAllCatalogFailed.Log <string, Guid, string, string>(context.Database.Name, context.Database.Guid, "FailedSuspendedCatalogRebuildWorkflow", context.TargetCopyStatus.CopyStatus.ContentIndexErrorMessage);
                            if (this.m_suppression.ReportWorkflowLaunchConditionMet(AutoReseedWorkflowType.FailedSuspendedCatalogRebuild, guid, CatalogAutoReseedWorkflow.CatalogAutoReseedReason.None, 1))
                            {
                                AutoReseedWorkflowLauncher.Tracer.TraceDebug <string, TimeSpan>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: Database '{0}' has no catalogs in healthy state for at least {1}. Launching the recovery workflow.", name, AutoReseedWorkflowSuppression.s_ciRebuildSuppresionInterval);
                                FailedSuspendedCatalogRebuildWorkflow failedSuspendedCatalogRebuildWorkflow = new FailedSuspendedCatalogRebuildWorkflow(context, context.TargetCopyStatus.CopyStatus.ContentIndexErrorMessage);
                                failedSuspendedCatalogRebuildWorkflow.Execute();
                                return;
                            }
                            AutoReseedWorkflowLauncher.Tracer.TraceDebug <string, TimeSpan, TimeSpan>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: Database '{0}' has no catalogs in healthy state but launching the recovery workflow is being skipped due to either initial suppression of {1}, or periodic suppression of {2}.", name, AutoReseedWorkflowSuppression.s_ciRebuildSuppresionInterval, AutoReseedWorkflowSuppression.s_ciRebuildRetryInterval);
                            return;
                        }
                    }
                    if (!this.TryLaunchCatalogAutoReseedWorkflow(context, name))
                    {
                        this.m_suppression.ReportNoWorkflowsNeedToLaunch(guid);
                    }
                    return;
                }
                if (context.TargetCopyStatus.IsActive)
                {
                    AutoReseedWorkflowLauncher.Tracer.TraceDebug <string, AmServerName>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: Database copy '{0}\\{1}' is 'FailedAndSuspended' but active. Skipping.", name, context.TargetServerName);
                    return;
                }
                if (this.m_suppression.ReportWorkflowLaunchConditionMet(AutoReseedWorkflowType.FailedSuspendedCopyAutoReseed, guid, CatalogAutoReseedWorkflow.CatalogAutoReseedReason.None, 1))
                {
                    AutoReseedWorkflowLauncher.Tracer.TraceDebug <string, AmServerName, TimeSpan>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: Database copy '{0}\\{1}' has been FailedAndSuspended for at least {2}. Launching the recovery workflow.", name, context.TargetServerName, AutoReseedWorkflowSuppression.s_dbReseedSuppresionInterval);
                    FailedSuspendedCopyAutoReseedWorkflow failedSuspendedCopyAutoReseedWorkflow = new FailedSuspendedCopyAutoReseedWorkflow(context, context.TargetCopyStatus.CopyStatus.ErrorMessage);
                    failedSuspendedCopyAutoReseedWorkflow.Execute();
                    return;
                }
                AutoReseedWorkflowLauncher.Tracer.TraceDebug((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: Database copy '{0}\\{1}' is FailedAndSuspended but launching the recovery workflow is being skipped due to either initial suppression of {2}, or periodic suppression of {3}.", new object[]
                {
                    name,
                    context.TargetServerName,
                    AutoReseedWorkflowSuppression.s_dbReseedSuppresionInterval,
                    AutoReseedWorkflowSuppression.s_dbReseedRetryInterval
                });
                return;
            }
        }
        // Token: 0x060018F9 RID: 6393 RVA: 0x00066AF0 File Offset: 0x00064CF0
        private bool TryLaunchCatalogAutoReseedWorkflow(AutoReseedContext context, string dbName)
        {
            string text         = string.Empty;
            Trace  tracer       = AutoReseedWorkflowLauncher.Tracer;
            long   id           = (long)this.GetHashCode();
            string formatString = "AutoReseedWorkflowLauncher.TryLaunchCatalogAutoReseedWorkflow: Database '{0}' ContentIndexStatus is {1}, ContentIndexBacklog is {2}, ContentIndexRetryQueueSize is {3}, ContentIndexVersion is {4}, LatestQueryVersion is {5}, any target DB with version==LastQueryVersion is {6}.";

            object[] array = new object[7];
            array[0] = dbName;
            array[1] = context.TargetCopyStatus.CopyStatus.ContentIndexStatus;
            array[2] = context.TargetCopyStatus.CopyStatus.ContentIndexBacklog;
            array[3] = context.TargetCopyStatus.CopyStatus.ContentIndexRetryQueueSize;
            array[4] = context.TargetCopyStatus.CopyStatus.ContentIndexVersion;
            object[]    array2 = array;
            int         num    = 5;
            VersionInfo latest = VersionInfo.Latest;

            array2[num] = latest.QueryVersion;
            array[6]    = context.CopyStatusesForTargetDatabase.Any(delegate(CopyStatusClientCachedEntry status)
            {
                if (status.Result == CopyStatusRpcResult.Success && status.CopyStatus.ContentIndexVersion != null)
                {
                    int value3          = status.CopyStatus.ContentIndexVersion.Value;
                    VersionInfo latest4 = VersionInfo.Latest;
                    return(value3 == latest4.QueryVersion);
                }
                return(false);
            });
            tracer.TraceDebug(id, formatString, array);
            CatalogAutoReseedWorkflow.CatalogAutoReseedReason catalogAutoReseedReason;
            if (context.TargetCopyStatus.CopyStatus.ContentIndexStatus == ContentIndexStatusType.FailedAndSuspended)
            {
                if (context.TargetCopyStatus.CopyStatus.ContentIndexErrorCode != null)
                {
                    catalogAutoReseedReason = this.MapErrorCodeToReseedReason(context.TargetCopyStatus.CopyStatus.ContentIndexErrorCode.Value);
                }
                else
                {
                    catalogAutoReseedReason = CatalogAutoReseedWorkflow.CatalogAutoReseedReason.Unknown;
                }
                text = context.TargetCopyStatus.CopyStatus.ContentIndexErrorMessage;
                AutoReseedWorkflowLauncher.Tracer.TraceDebug <string, CatalogAutoReseedWorkflow.CatalogAutoReseedReason, string>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.TryLaunchCatalogAutoReseedWorkflow: Database '{0}' has Failed and suspended catalog, will reseed with reason {1}, errorMessage is {2}.", dbName, catalogAutoReseedReason, text);
            }
            else if (context.TargetCopyStatus.CopyStatus.ContentIndexBacklog != null && context.TargetCopyStatus.CopyStatus.ContentIndexBacklog.Value > RegistryParameters.AutoReseedCiBehindBacklog)
            {
                catalogAutoReseedReason = CatalogAutoReseedWorkflow.CatalogAutoReseedReason.BehindBacklog;
                text = ReplayStrings.AutoReseedCatalogIsBehindBacklog(context.TargetCopyStatus.CopyStatus.ContentIndexBacklog.GetValueOrDefault());
                AutoReseedWorkflowLauncher.Tracer.TraceDebug <string, int, string>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.TryLaunchCatalogAutoReseedWorkflow: Database '{0}' will reseed. Reason is BehindBacklog, AutoReseedCiBehindBacklog is {1}, errorMessage is {2}.", dbName, RegistryParameters.AutoReseedCiBehindBacklog, text);
            }
            else
            {
                if (context.TargetCopyStatus.CopyStatus.ContentIndexRetryQueueSize == null || context.TargetCopyStatus.CopyStatus.ContentIndexRetryQueueSize.Value <= RegistryParameters.AutoReseedCiBehindRetryCount)
                {
                    if (context.TargetCopyStatus.CopyStatus.ContentIndexVersion != null)
                    {
                        int         value   = context.TargetCopyStatus.CopyStatus.ContentIndexVersion.Value;
                        VersionInfo latest2 = VersionInfo.Latest;
                        if (value < latest2.QueryVersion)
                        {
                            if (context.CopyStatusesForTargetDatabase.Any(delegate(CopyStatusClientCachedEntry status)
                            {
                                if (status.Result == CopyStatusRpcResult.Success && status.CopyStatus.ContentIndexVersion != null)
                                {
                                    int value3 = status.CopyStatus.ContentIndexVersion.Value;
                                    VersionInfo latest4 = VersionInfo.Latest;
                                    return(value3 == latest4.QueryVersion);
                                }
                                return(false);
                            }))
                            {
                                catalogAutoReseedReason = CatalogAutoReseedWorkflow.CatalogAutoReseedReason.Upgrade;
                                int         value2  = context.TargetCopyStatus.CopyStatus.ContentIndexVersion.Value;
                                VersionInfo latest3 = VersionInfo.Latest;
                                text = ReplayStrings.AutoReseedCatalogToUpgrade(value2, latest3.QueryVersion);
                                AutoReseedWorkflowLauncher.Tracer.TraceDebug <string, string>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.TryLaunchCatalogAutoReseedWorkflow: Database '{0}' will reseed with reason Upgrade, errorMessage is {1}", dbName, text);
                                goto IL_330;
                            }
                        }
                    }
                    AutoReseedWorkflowLauncher.Tracer.TraceDebug <string>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.TryLaunchCatalogAutoReseedWorkflow: Database '{0}' has no reason to reseed.", dbName);
                    return(false);
                }
                catalogAutoReseedReason = CatalogAutoReseedWorkflow.CatalogAutoReseedReason.BehindRetry;
                text = ReplayStrings.AutoReseedCatalogIsBehindRetry(context.TargetCopyStatus.CopyStatus.ContentIndexRetryQueueSize.GetValueOrDefault());
                AutoReseedWorkflowLauncher.Tracer.TraceDebug <string, int, string>((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.TryLaunchCatalogAutoReseedWorkflow: Database '{0}' will reseed. Reason is BehindBacklog, AutoReseedCiBehindBacklog is {1}, errorMessage is {2}.", dbName, RegistryParameters.AutoReseedCiBehindBacklog, text);
            }
IL_330:
            AutoReseedWorkflowLauncher.Tracer.TraceDebug((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: AutoReseed workflow launcher detected a {0} catalog for database '{1}' [{2}]: {3}.", new object[]
            {
                context.TargetCopyStatus.CopyStatus.CopyStatus,
                context.Database.Name,
                context.Database.Guid,
                text
            });
            ReplayCrimsonEvents.AutoReseedWorkflowDetectedFailedCatalog.Log <string, Guid, string, string>(context.Database.Name, context.Database.Guid, "CatalogAutoReseedWorkflow", text);
            if (this.m_suppression.ReportWorkflowLaunchConditionMet(AutoReseedWorkflowType.CatalogAutoReseed, context.Database.Guid, catalogAutoReseedReason, context.TargetCopyStatus.CopyStatus.ActivationPreference))
            {
                AutoReseedWorkflowLauncher.Tracer.TraceDebug((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: Database copy '{0}\\{1}' has catalog in {2} state for at least {3}. Launching the recovery workflow. Reason is {4}, ActivationPreference is {5}.", new object[]
                {
                    context.Database.Name,
                    context.TargetServerName,
                    context.TargetCopyStatus.CopyStatus.CopyStatus,
                    AutoReseedWorkflowSuppression.s_ciReseedSuppresionInterval,
                    catalogAutoReseedReason,
                    context.TargetCopyStatus.CopyStatus.ActivationPreference
                });
                CatalogAutoReseedWorkflow catalogAutoReseedWorkflow = new CatalogAutoReseedWorkflow(context, catalogAutoReseedReason, text);
                catalogAutoReseedWorkflow.Execute();
            }
            else
            {
                AutoReseedWorkflowLauncher.Tracer.TraceDebug((long)this.GetHashCode(), "AutoReseedWorkflowLauncher.BeginAutoReseedIfNecessary: Database copy '{0}\\{1}' has catalog in {2} state but launching the recovery workflow is being skipped due to either initial suppression of {3}, or periodic suppression of {4}. Reason is {5}, ActivationPreference is {6}", new object[]
                {
                    context.Database.Name,
                    context.TargetServerName,
                    context.TargetCopyStatus.CopyStatus.CopyStatus,
                    AutoReseedWorkflowSuppression.s_ciReseedSuppresionInterval,
                    AutoReseedWorkflowSuppression.s_ciReseedRetryInterval,
                    catalogAutoReseedReason,
                    context.TargetCopyStatus.CopyStatus.ActivationPreference
                });
            }
            return(true);
        }
Пример #11
0
 // Token: 0x06001959 RID: 6489 RVA: 0x00069448 File Offset: 0x00067648
 private static IGrouping <string, CopyStatusClientCachedEntry> FindDatabaseGrouping(AutoReseedContext context, IEnumerable <IGrouping <string, CopyStatusClientCachedEntry> > databaseSets)
 {
     foreach (IGrouping <string, CopyStatusClientCachedEntry> grouping in databaseSets)
     {
         foreach (CopyStatusClientCachedEntry copyStatusClientCachedEntry in grouping)
         {
             if (copyStatusClientCachedEntry.DbGuid.Equals(context.Database.Guid))
             {
                 return(grouping);
             }
         }
     }
     return(null);
 }
Пример #12
0
        // Token: 0x06001958 RID: 6488 RVA: 0x00069248 File Offset: 0x00067448
        private IEnumerable <CopyStatusClientCachedEntry> FindTargetDbSetFromNeighbors(AutoReseedContext context)
        {
            IEnumerable <CopyStatusClientCachedEntry> enumerable  = null;
            IEnumerable <CopyStatusClientCachedEntry> enumerable2 = null;
            Dictionary <AmServerName, IEnumerable <CopyStatusClientCachedEntry> > copyStatusesForDag           = context.CopyStatusesForDag;
            IEnumerable <KeyValuePair <AmServerName, IEnumerable <CopyStatusClientCachedEntry> > > enumerable3 = from kvp in copyStatusesForDag
                                                                                                                 let server = kvp.Key
                                                                                                                              let isTargetServer = this.IsTargetServer(server, context.TargetServerName)
                                                                                                                                                   where this.ShouldSelectServer(isTargetServer)
                                                                                                                                                   orderby isTargetServer descending
                                                                                                                                                   select kvp;

            foreach (KeyValuePair <AmServerName, IEnumerable <CopyStatusClientCachedEntry> > keyValuePair in enumerable3)
            {
                AmServerName key = keyValuePair.Key;
                IEnumerable <CopyStatusClientCachedEntry> value  = keyValuePair.Value;
                IEnumerable <CopyStatusClientCachedEntry> source = from status in value
                                                                   where status.Result == CopyStatusRpcResult.Success && FailedSuspendedCopyAutoReseedWorkflow.DoesCopyHaveMountPointConfigured(status.CopyStatus)
                                                                   select status;
                IEnumerable <IGrouping <string, CopyStatusClientCachedEntry> > databaseSets = source.GroupBy((CopyStatusClientCachedEntry status) => status.CopyStatus.DatabaseVolumeName, StringComparer.OrdinalIgnoreCase);
                IGrouping <string, CopyStatusClientCachedEntry> grouping = FailedSuspendedCopyAutoReseedWorkflow.FindDatabaseGrouping(context, databaseSets);
                if (grouping != null)
                {
                    int num = grouping.Count <CopyStatusClientCachedEntry>();
                    if (num == context.Dag.AutoDagDatabaseCopiesPerVolume)
                    {
                        enumerable2 = grouping;
                        break;
                    }
                }
            }
            if (enumerable2 != null)
            {
                Dictionary <Guid, CopyStatusClientCachedEntry> remoteDbMap = enumerable2.ToDictionary((CopyStatusClientCachedEntry status) => status.DbGuid);
                enumerable = from status in context.CopyStatusesForTargetServer
                             where remoteDbMap.ContainsKey(status.DbGuid)
                             select status;
                enumerable = enumerable.ToArray <CopyStatusClientCachedEntry>();
            }
            return(enumerable);
        }
Пример #13
0
        // Token: 0x06001957 RID: 6487 RVA: 0x00068E38 File Offset: 0x00067038
        private IEnumerable <CopyStatusClientCachedEntry> FindTargetDbSetFromDatabaseGroup(AutoReseedContext context)
        {
            IADDatabase         database = context.Database;
            IMonitoringADConfig adConfig = context.AdConfig;
            string targetGroup           = database.DatabaseGroup;

            if (string.IsNullOrWhiteSpace(targetGroup))
            {
                AutoReseedWorkflow.Tracer.TraceError <string>((long)this.GetHashCode(), "FindTargetDbSetFromDatabaseGroup: DatabaseGroup property for db '{0}' is not set. Returning 'null'.", database.Name);
                return(null);
            }
            IEnumerable <IADDatabase> enumerable = adConfig.DatabaseMap[adConfig.TargetServerName];

            if (enumerable == null)
            {
                AutoReseedWorkflow.Tracer.TraceError <AmServerName>((long)this.GetHashCode(), "FindTargetDbSetFromDatabaseGroup: Server '{0}' had no databases. Returning 'null'.", adConfig.TargetServerName);
                return(null);
            }
            IEnumerable <IADDatabase> source = from db in enumerable
                                               where StringUtil.IsEqualIgnoreCase(db.DatabaseGroup, targetGroup)
                                               select db;
            int num = source.Count <IADDatabase>();

            if (num != context.Dag.AutoDagDatabaseCopiesPerVolume)
            {
                AutoReseedWorkflow.Tracer.TraceError <int, string, int>((long)this.GetHashCode(), "FindTargetDbSetFromDatabaseGroup: There are only '{0}' db copies in the group for database '{1}'. Expected number is: {2}. Returning 'null'.", num, database.Name, context.Dag.AutoDagDatabaseCopiesPerVolume);
                return(null);
            }
            Dictionary <Guid, IADDatabase>            dbGroupMap = source.ToDictionary((IADDatabase db) => db.Guid);
            IEnumerable <CopyStatusClientCachedEntry> source2    = from status in context.CopyStatusesForTargetServer
                                                                   where dbGroupMap.ContainsKey(status.DbGuid)
                                                                   select status;

            return(source2.ToArray <CopyStatusClientCachedEntry>());
        }
Пример #14
0
 protected AutoReseedWorkflow(AutoReseedWorkflowType workflowType, string workflowLaunchReason, AutoReseedContext context)
 {
     this.m_workflowType         = workflowType;
     this.m_workflowName         = workflowType.ToString();
     this.m_workflowLaunchReason = workflowLaunchReason;
     this.m_context = context;
 }
Пример #15
0
 public FailedSuspendedCatalogRebuildWorkflow(AutoReseedContext context, string workflowLaunchReason) : base(AutoReseedWorkflowType.FailedSuspendedCatalogRebuild, workflowLaunchReason, context)
 {
 }
Пример #16
0
 // Token: 0x0600197A RID: 6522 RVA: 0x0006A44A File Offset: 0x0006864A
 public HealthyCopyCompletedSeedWorkflow(AutoReseedContext context) : base(AutoReseedWorkflowType.HealthyCopyCompletedSeed, string.Empty, context)
 {
 }