Exemplo n.º 1
0
        private static Exception MoveDatabase(FailedSuspendedCatalogRebuildWorkflow workflow)
        {
            Exception result = null;

            try
            {
                AmDatabaseMoveResult amDatabaseMoveResult = null;
                AmDbActionCode       actionCode           = new AmDbActionCode(AmDbActionInitiator.Admin, AmDbActionReason.CatalogFailureItem, AmDbActionCategory.Move);
                string serverName;
                AmRpcClientHelper.MoveDatabaseEx(workflow.Context.Database, 0, 16, 0, null, workflow.Context.TargetServerName.Fqdn, false, 2, actionCode, ReplayStrings.AutoReseedMoveActiveBeforeRebuildCatalog, out serverName, ref amDatabaseMoveResult);
                AmRpcExceptionWrapper.Instance.ClientRethrowIfFailed(amDatabaseMoveResult.DbName, serverName, amDatabaseMoveResult.ErrorInfo);
            }
            catch (AmReplayServiceDownException ex)
            {
                result = ex;
            }
            catch (AmServerException ex2)
            {
                result = ex2;
            }
            catch (AmServerTransientException ex3)
            {
                result = ex3;
            }
            return(result);
        }
Exemplo n.º 2
0
        private static Exception RebuildIndexSystem(FailedSuspendedCatalogRebuildWorkflow workflow)
        {
            Exception result = null;
            SearchServiceRpcClient searchServiceRpcClient = null;
            bool flag = false;

            try
            {
                searchServiceRpcClient = RpcConnectionPool.GetSearchRpcClient();
                searchServiceRpcClient.RebuildIndexSystem(workflow.Context.Database.Guid);
                flag = true;
            }
            catch (RpcException ex)
            {
                result = ex;
            }
            finally
            {
                if (searchServiceRpcClient != null)
                {
                    RpcConnectionPool.ReturnSearchRpcClientToCache(ref searchServiceRpcClient, !flag);
                }
            }
            return(result);
        }
        // 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;
            }
        }