예제 #1
0
        public RpcErrorExceptionInfo ConvertExceptionToErrorExceptionInfo(string databaseName, Exception ex)
        {
            RpcErrorExceptionInfo rpcErrorExceptionInfo = new RpcErrorExceptionInfo();

            if (ex == null)
            {
                return(rpcErrorExceptionInfo);
            }
            TBaseException          ex2 = ex as TBaseException;
            TBaseTransientException ex3 = ex as TBaseTransientException;
            string errorMessage;

            if (ex2 != null)
            {
                errorMessage = HaRpcExceptionWrapperBase <TBaseException, TBaseTransientException> .SetExceptionProperties <TBaseException>(ex2, true, databaseName);
            }
            else if (ex3 != null)
            {
                errorMessage = HaRpcExceptionWrapperBase <TBaseException, TBaseTransientException> .SetExceptionProperties <TBaseTransientException>(ex3, true, databaseName);
            }
            else
            {
                errorMessage = ex.ToString();
            }
            rpcErrorExceptionInfo.ErrorMessage           = errorMessage;
            rpcErrorExceptionInfo.ReconstitutedException = ex;
            HaRpcExceptionWrapperBase <TBaseException, TBaseTransientException> .TrySerializeException(ex, rpcErrorExceptionInfo);

            return(rpcErrorExceptionInfo);
        }
예제 #2
0
        // Token: 0x06001A47 RID: 6727 RVA: 0x0006EA10 File Offset: 0x0006CC10
        public void BeginServerLevelSeed(bool fDeleteExistingLogs, bool fSafeDeleteExistingFiles, int maxSeedsInParallel, bool fAutoSuspend, bool fManualResume, bool fSeedDatabase, bool fSeedCiFiles, bool?compressOverride, bool?encryptOverride, SeederRpcFlags flags = SeederRpcFlags.None)
        {
            RpcSeederArgs args = new RpcSeederArgs(Guid.Empty, fDeleteExistingLogs, fAutoSuspend, null, null, string.Empty, false, string.Empty, null, fManualResume, fSeedDatabase, fSeedCiFiles, compressOverride, encryptOverride, maxSeedsInParallel, fSafeDeleteExistingFiles, flags);

            this.ValidateArgs(args);
            ExTraceGlobals.SeederClientTracer.TraceDebug <RpcSeederArgs>((long)this.GetHashCode(), "BeginServerLevelSeed(): Constructed RpcSeederArgs: {0}", args);
            RpcErrorExceptionInfo errorInfo  = null;
            RpcSeederStatus       seedStatus = null;
            ServerVersion         version    = this.GetTestHookServerVersion();

            SeederRpcExceptionWrapper.Instance.ClientRetryableOperation(this.m_serverName, delegate
            {
                if (ReplayRpcVersionControl.IsSeedRpcV5Supported(version))
                {
                    errorInfo = this.m_client.RpccPrepareDatabaseSeedAndBegin5(args, ref seedStatus);
                    return;
                }
                if (ReplayRpcVersionControl.IsSeedRpcSafeDeleteSupported(version))
                {
                    errorInfo = this.m_client.RpccPrepareDatabaseSeedAndBegin4(args, ref seedStatus);
                    return;
                }
                ExTraceGlobals.SeederClientTracer.TraceError <string, ServerVersion, ServerVersion>((long)this.GetHashCode(), "BeginServerLevelSeed(): Server '{0}' does not support server-level reseed RPC. Server version: {1}. Minimum supported version: {2}", this.m_serverName, version, ReplayRpcVersionControl.SeedRpcSafeDeleteSupportVersion);
                throw new SeederRpcServerLevelUnsupportedException(this.m_serverName, version.ToString(), ReplayRpcVersionControl.SeedRpcSafeDeleteSupportVersion.ToString());
            });
            SeederRpcExceptionWrapper.Instance.ClientRethrowIfFailed(this.m_databaseName, this.m_serverName, errorInfo);
        }
예제 #3
0
        internal AmDatabaseMoveResult ConvertDetailedStatusToRpcMoveResult(AmDbOperationDetailedStatus detailedStatus)
        {
            Guid            guid                  = detailedStatus.Database.Guid;
            string          name                  = detailedStatus.Database.Name;
            string          fromServerFqdn        = string.Empty;
            string          finalActiveServerFqdn = string.Empty;
            AmDbMountStatus dbMountStatusAtStart  = AmDbMountStatus.Unknown;
            AmDbMountStatus dbMountStatusAtEnd    = AmDbMountStatus.Unknown;

            if (detailedStatus.InitialDbState != null)
            {
                fromServerFqdn       = detailedStatus.InitialDbState.ActiveServer.Fqdn;
                dbMountStatusAtStart = AmDbOperation.ConvertMountStatusToRpcMountStatus(detailedStatus.InitialDbState.MountStatus);
            }
            if (detailedStatus.FinalDbState != null)
            {
                finalActiveServerFqdn = detailedStatus.FinalDbState.ActiveServer.Fqdn;
                dbMountStatusAtEnd    = AmDbOperation.ConvertMountStatusToRpcMountStatus(detailedStatus.FinalDbState.MountStatus);
            }
            Exception                        lastException = this.LastException;
            RpcErrorExceptionInfo            errorInfo     = AmRpcExceptionWrapper.Instance.ConvertExceptionToErrorExceptionInfo(lastException);
            AmDbMoveStatus                   dbMoveStatus  = AmDbOperation.TranslateExceptionIntoMoveStatusEnum(lastException);
            List <AmDbRpcOperationSubStatus> attemptedServerSubStatuses = (from opSubStatus in detailedStatus.GetAllSubStatuses()
                                                                           select opSubStatus.ConvertToRpcSubStatus()).ToList <AmDbRpcOperationSubStatus>();

            return(new AmDatabaseMoveResult(guid, name, fromServerFqdn, finalActiveServerFqdn, dbMoveStatus, dbMountStatusAtStart, dbMountStatusAtEnd, errorInfo, attemptedServerSubStatuses));
        }
예제 #4
0
        // Token: 0x06000463 RID: 1123 RVA: 0x00017604 File Offset: 0x00015804
        public override RpcErrorExceptionInfo AttemptCopyLastLogsDirect(Guid guid, int mountDialOverride, int numRetries, int e00timeoutMs, int networkIOtimeoutMs, int networkConnecttimeoutMs, string sourceServer, int iActionCode, int skipValidationChecks, bool mountPending, string uniqueOperationId, int subactionAttemptNumber, ref AmAcllReturnStatus acllStatus)
        {
            AmTrace.Debug("Running ACLL for database (on behalf of PAM): {0}", new object[]
            {
                guid
            });
            AmAcllReturnStatus tempAcllStatus = null;

            acllStatus = null;
            AmAcllArgs acllArgs = new AmAcllArgs();

            acllArgs.NumRetries              = numRetries;
            acllArgs.E00TimeoutMs            = e00timeoutMs;
            acllArgs.NetworkIOTimeoutMs      = networkIOtimeoutMs;
            acllArgs.NetworkConnectTimeoutMs = networkConnecttimeoutMs;
            acllArgs.SourceServer            = new AmServerName(sourceServer);
            acllArgs.ActionCode              = new AmDbActionCode(iActionCode);
            acllArgs.SkipValidationChecks    = (AmBcsSkipFlags)skipValidationChecks;
            acllArgs.MountPending            = mountPending;
            acllArgs.MountDialOverride       = (DatabaseMountDialOverride)mountDialOverride;
            acllArgs.UniqueOperationId       = uniqueOperationId;
            acllArgs.SubactionAttemptNumber  = subactionAttemptNumber;
            RpcErrorExceptionInfo result = AmRpcExceptionWrapper.Instance.RunRpcServerOperation(delegate()
            {
                AmRpcServer.m_amInstance.AttemptCopyLastLogsDirect(guid, acllArgs, ref tempAcllStatus);
            });

            acllStatus = tempAcllStatus;
            return(result);
        }
예제 #5
0
        public void ClientRethrowIfFailed(string databaseName, string serverName, RpcErrorExceptionInfo errorInfo)
        {
            Exception ex   = null;
            string    text = HaRpcExceptionWrapperBase <TBaseException, TBaseTransientException> .SanitizeServerName(serverName);

            if (errorInfo.IsFailed())
            {
                if (errorInfo.ReconstitutedException != null)
                {
                    ex = this.ConstructClientExceptionFromServerException(text, errorInfo.ReconstitutedException);
                }
                else
                {
                    if (errorInfo.SerializedException != null && errorInfo.SerializedException.Length > 0)
                    {
                        try
                        {
                            errorInfo.ReconstitutedException = SerializationServices.Deserialize <Exception>(errorInfo.SerializedException);
                            ex = this.ConstructClientExceptionFromServerException(text, errorInfo.ReconstitutedException);
                            goto IL_109;
                        }
                        catch (SerializationException innerException)
                        {
                            ex = this.GetGenericOperationFailedException(errorInfo.ErrorMessage, innerException);
                            ((TBaseException)((object)ex)).OriginatingServer = text;
                            goto IL_109;
                        }
                        catch (TargetInvocationException innerException2)
                        {
                            ex = this.GetGenericOperationFailedException(errorInfo.ErrorMessage, innerException2);
                            ((TBaseException)((object)ex)).OriginatingServer = text;
                            goto IL_109;
                        }
                    }
                    if (!string.IsNullOrEmpty(errorInfo.ErrorMessage))
                    {
                        ex = this.GetGenericOperationFailedException(errorInfo.ErrorMessage);
                        ((TBaseException)((object)ex)).OriginatingServer = text;
                    }
                    else
                    {
                        ex = this.GetGenericOperationFailedWithEcException(errorInfo.ErrorCode);
                        ((TBaseException)((object)ex)).OriginatingServer = text;
                    }
                }
IL_109:
                IHaRpcServerBaseException ex2 = ex as IHaRpcServerBaseException;
                if (ex2 != null && string.IsNullOrEmpty(ex2.DatabaseName) && !string.IsNullOrEmpty(databaseName))
                {
                    ((IHaRpcServerBaseExceptionInternal)ex).DatabaseName = databaseName;
                }
            }
            if (ex != null)
            {
                throw ex;
            }
        }
예제 #6
0
        // Token: 0x0600045C RID: 1116 RVA: 0x00017154 File Offset: 0x00015354
        public override RpcErrorExceptionInfo RpcsGetServerForDatabase(Guid guid, ref AmDbStatusInfo2 dbInfo)
        {
            AmDbStatusInfo2       tmpDbInfo = null;
            RpcErrorExceptionInfo result    = AmRpcExceptionWrapper.Instance.RunRpcServerOperation(delegate()
            {
                tmpDbInfo = AmRpcServer.m_amInstance.AmServerGetServerForDatabase(guid);
            });

            dbInfo = tmpDbInfo;
            return(result);
        }
예제 #7
0
        // Token: 0x06000460 RID: 1120 RVA: 0x000174C0 File Offset: 0x000156C0
        public override RpcErrorExceptionInfo GetPrimaryActiveManager(ref AmPamInfo pamInfo)
        {
            AmPamInfo             tmpPamInfo = null;
            RpcErrorExceptionInfo result     = AmRpcExceptionWrapper.Instance.RunRpcServerOperation(delegate()
            {
                tmpPamInfo = AmRpcServer.m_amInstance.GetPrimaryActiveManager();
            });

            pamInfo = tmpPamInfo;
            return(result);
        }
        private static void RunRpcOperationDbName(AmServerName serverName, string databaseName, int timeoutMs, IHaRpcExceptionWrapper rpcExceptionWrapperInstance, ReplayRpcClientWrapper.InternalRpcOperation rpcOperation)
        {
            RpcErrorExceptionInfo errorInfo = null;

            rpcExceptionWrapperInstance.ClientRetryableOperation(serverName.Fqdn, delegate
            {
                using (ReplayRpcClient replayRpcClient = ReplayRpcClientWrapper.RpcClientFactory(serverName, timeoutMs))
                {
                    errorInfo = rpcOperation(replayRpcClient);
                }
            });
            rpcExceptionWrapperInstance.ClientRethrowIfFailed(databaseName, serverName.Fqdn, errorInfo);
        }
예제 #9
0
        private static void RunRpcOperation(string serverName, int?timeoutMs, DagNetworkRpc.InternalRpcOperation rpcOperation)
        {
            RpcErrorExceptionInfo errorInfo = null;

            TasksRpcExceptionWrapper.Instance.ClientRetryableOperation(serverName, delegate
            {
                using (ReplayRpcClient replayRpcClient = DagNetworkRpc.RpcClientFactory(serverName, timeoutMs))
                {
                    errorInfo = rpcOperation(replayRpcClient);
                }
            });
            TasksRpcExceptionWrapper.Instance.ClientRethrowIfFailed(serverName, errorInfo);
        }
예제 #10
0
        // Token: 0x06000461 RID: 1121 RVA: 0x0001751C File Offset: 0x0001571C
        public override RpcErrorExceptionInfo GetActiveManagerRole(ref AmRole amRole, ref string errorMessage)
        {
            AmRole tmpAmRole             = AmRole.Unknown;
            string tmpMsg                = string.Empty;
            RpcErrorExceptionInfo result = AmRpcExceptionWrapper.Instance.RunRpcServerOperation(delegate()
            {
                tmpAmRole = AmRpcServer.m_amInstance.GetActiveManagerRole(out tmpMsg);
            });

            amRole       = tmpAmRole;
            errorMessage = tmpMsg;
            return(result);
        }
        public static void RunRpcOperation(string serverName, int timeoutMs, ActiveMonitoringRpcExceptionWrapper rpcExceptionWrapperInstance, ActiveMonitoringGenericRpcHelper.InternalRpcOperation rpcOperation)
        {
            RpcErrorExceptionInfo errorInfo = null;

            rpcExceptionWrapperInstance.ClientRetryableOperation(serverName, delegate
            {
                using (ActiveMonitoringRpcClient activeMonitoringRpcClient = ActiveMonitoringGenericRpcHelper.RpcClientFactory(serverName, timeoutMs))
                {
                    errorInfo = rpcOperation(activeMonitoringRpcClient);
                }
            });
            rpcExceptionWrapperInstance.ClientRethrowIfFailed(serverName, errorInfo);
        }
예제 #12
0
        public RpcErrorExceptionInfo RunRpcServerOperation(string databaseName, RpcServerOperation rpcOperation)
        {
            RpcErrorExceptionInfo result = new RpcErrorExceptionInfo();

            try
            {
                try
                {
                    rpcOperation();
                }
                catch (MapiRetryableException ex)
                {
                    result = this.ConvertExceptionToErrorExceptionInfo(databaseName, ex);
                }
                catch (MapiPermanentException ex2)
                {
                    result = this.ConvertExceptionToErrorExceptionInfo(databaseName, ex2);
                }
                catch (TBaseTransientException ex3)
                {
                    TBaseTransientException ex4 = (TBaseTransientException)((object)ex3);
                    result = this.ConvertExceptionToErrorExceptionInfo(databaseName, ex4);
                }
                catch (TBaseException ex5)
                {
                    TBaseException ex6 = (TBaseException)((object)ex5);
                    result = this.ConvertExceptionToErrorExceptionInfo(databaseName, ex6);
                }
                catch (TransientException ex7)
                {
                    result = this.ConvertExceptionToErrorExceptionInfo(databaseName, ex7);
                }
                catch (Exception ex8)
                {
                    if (this.IsKnownException(ex8))
                    {
                        result = this.ConvertExceptionToErrorExceptionInfo(databaseName, ex8);
                    }
                    else
                    {
                        ExWatson.SendReportAndCrashOnAnotherThread(ex8);
                    }
                }
            }
            catch (Exception exception)
            {
                ExWatson.SendReportAndCrashOnAnotherThread(exception);
            }
            return(result);
        }
예제 #13
0
        // Token: 0x06000470 RID: 1136 RVA: 0x00017FAC File Offset: 0x000161AC
        public override RpcErrorExceptionInfo GenericRequest(RpcGenericRequestInfo requestInfo, ref RpcGenericReplyInfo replyInfo)
        {
            RpcGenericReplyInfo   tmpReplyInfo = null;
            RpcErrorExceptionInfo result       = AmRpcExceptionWrapper.Instance.RunRpcServerOperation(delegate()
            {
                AmRpcServer.m_amInstance.GenericRpcDispatch(requestInfo, ref tmpReplyInfo);
            });

            if (tmpReplyInfo != null)
            {
                replyInfo = tmpReplyInfo;
            }
            return(result);
        }
예제 #14
0
        // Token: 0x06000462 RID: 1122 RVA: 0x0001758C File Offset: 0x0001578C
        public override RpcErrorExceptionInfo CheckThirdPartyListener(ref bool healthy, ref string errorMessage)
        {
            healthy = false;
            bool   tempHealthy           = false;
            string tmpMsg                = string.Empty;
            RpcErrorExceptionInfo result = AmRpcExceptionWrapper.Instance.RunRpcServerOperation(delegate()
            {
                tempHealthy = ThirdPartyManager.Instance.CheckHealth(out tmpMsg);
            });

            errorMessage = tmpMsg;
            healthy      = tempHealthy;
            return(result);
        }
 public RpcDatabaseCopyStatus2[] GetCopyStatus(string serverName, RpcGetDatabaseCopyStatusFlags2 collectionFlags2, Guid[] dbGuids, int timeoutMs)
 {
     if (dbGuids == null || dbGuids.Length == 0)
     {
         dbGuids = new Guid[]
         {
             Guid.Empty
         };
     }
     RpcDatabaseCopyStatus2[] statusResults = null;
     ReplayRpcClientWrapper.RunRpcOperation(serverName, null, timeoutMs, TasksRpcExceptionWrapper.Instance, delegate(ReplayRpcClient rpcClient)
     {
         RpcErrorExceptionInfo result;
         try
         {
             if (ReplayRpcVersionControl.IsGetCopyStatusEx4RpcSupported(ReplayRpcClientWrapper.GetServerVersion(serverName)))
             {
                 ExTraceGlobals.ReplayServiceRpcTracer.TraceDebug <string>(0L, "GetCopyStatus(): Now making RpccGetCopyStatusEx4() RPC to server {0}.", serverName);
                 RpcErrorExceptionInfo rpcErrorExceptionInfo = rpcClient.RpccGetCopyStatusEx4(collectionFlags2, dbGuids, ref statusResults);
                 if (!rpcErrorExceptionInfo.IsFailed())
                 {
                     ReplayRpcClientWrapper.DeserializeExtendedErrorInfo(statusResults);
                 }
                 result = rpcErrorExceptionInfo;
             }
             else
             {
                 RpcDatabaseCopyStatus[] array = null;
                 ExTraceGlobals.ReplayServiceRpcTracer.TraceDebug <string>(0L, "GetCopyStatus(): Now making GetCopyStatusEx2() RPC to server {0}.", serverName);
                 RpcErrorExceptionInfo copyStatusEx = rpcClient.GetCopyStatusEx2(ReplayRpcClientWrapper.ConvertToLegacyCopyStatusFlags(collectionFlags2), dbGuids, ref array);
                 if (!copyStatusEx.IsFailed() && array != null)
                 {
                     statusResults = ReplayRpcClientWrapper.ConvertLegacyCopyStatusArray(array);
                 }
                 result = copyStatusEx;
             }
         }
         catch (RpcException ex)
         {
             if (ReplayRpcErrorCode.IsRpcTimeoutError(ex.ErrorCode))
             {
                 throw new ReplayServiceDownException(serverName, ex.Message, ex);
             }
             throw;
         }
         return(result);
     });
     return(statusResults);
 }
예제 #16
0
        // Token: 0x06001A4A RID: 6730 RVA: 0x0006EC98 File Offset: 0x0006CE98
        public void EndDbSeed(Guid dbGuid)
        {
            if (dbGuid == Guid.Empty)
            {
                throw new ArgumentException("An invalid Database Guid was specified.", "dbGuid");
            }
            RpcErrorExceptionInfo errorInfo = null;

            ExTraceGlobals.SeederClientTracer.TraceDebug <Guid>((long)this.GetHashCode(), "EndDbSeed(): calling server RPC for guid ({0}).", dbGuid);
            SeederRpcExceptionWrapper.Instance.ClientRetryableOperation(this.m_serverName, delegate
            {
                errorInfo = this.m_client.EndDbSeed(dbGuid);
            });
            SeederRpcExceptionWrapper.Instance.ClientRethrowIfFailed(this.m_databaseName, this.m_serverName, errorInfo);
        }
        // Token: 0x060019A2 RID: 6562 RVA: 0x0006B2C4 File Offset: 0x000694C4
        private string GetErrorMessageAndExceptionFromErrorExceptionInfo(RpcErrorExceptionInfo errorExceptionInfo, SeederState origState, out Exception newException)
        {
            string text;

            if (errorExceptionInfo.ReconstitutedException != null)
            {
                text = this.GetMessageAndException(errorExceptionInfo.ReconstitutedException, origState, out newException);
            }
            else
            {
                text         = errorExceptionInfo.ErrorMessage;
                newException = this.GetException(text, origState);
            }
            return(text);
        }
예제 #18
0
        // Token: 0x0600046F RID: 1135 RVA: 0x00017EF8 File Offset: 0x000160F8
        public override RpcErrorExceptionInfo GetDeferredRecoveryEntries(ref List <AmDeferredRecoveryEntry> entries)
        {
            AmTrace.Debug("Entering GetDeferredRecoveryEntries", new object[0]);
            List <AmDeferredRecoveryEntry> tempEntries           = null;
            RpcErrorExceptionInfo          rpcErrorExceptionInfo = AmRpcExceptionWrapper.Instance.RunRpcServerOperation(delegate()
            {
                tempEntries = AmRpcServer.m_amInstance.GetDeferredRecoveryEntries();
            });

            entries = tempEntries;
            AmTrace.Debug("Exiting GetDeferredRecoveryEntries (EntriesFound={0} Error={1})", new object[]
            {
                (entries != null) ? entries.Count.ToString() : "<null>",
                rpcErrorExceptionInfo.IsFailed() ? rpcErrorExceptionInfo.ErrorMessage : "<none>"
            });
            return(rpcErrorExceptionInfo);
        }
예제 #19
0
        // Token: 0x06001A48 RID: 6728 RVA: 0x0006EB00 File Offset: 0x0006CD00
        public RpcSeederStatus GetDatabaseSeedStatus(Guid dbGuid)
        {
            if (dbGuid == Guid.Empty)
            {
                throw new ArgumentException("An invalid Database Guid was specified.", "dbGuid");
            }
            ExTraceGlobals.SeederClientTracer.TraceDebug <Guid>((long)this.GetHashCode(), "GetDatabaseSeedStatus(): calling server RPC for guid ({0}).", dbGuid);
            RpcErrorExceptionInfo errorExceptionInfo = null;
            RpcSeederStatus       seedStatus         = null;

            SeederRpcExceptionWrapper.Instance.ClientRetryableOperation(this.m_serverName, delegate
            {
                errorExceptionInfo = this.m_client.RpccGetDatabaseSeedStatus(dbGuid, ref seedStatus);
            });
            SeederRpcExceptionWrapper.Instance.ClientRethrowIfFailed(this.m_databaseName, this.m_serverName, errorExceptionInfo);
            return(seedStatus);
        }
        public RpcCopyStatusContainer GetCopyStatusWithHealthState(string serverName, RpcGetDatabaseCopyStatusFlags2 collectionFlags2, Guid[] dbGuids, int timeoutMs)
        {
            if (dbGuids == null || dbGuids.Length == 0)
            {
                dbGuids = new Guid[]
                {
                    Guid.Empty
                };
            }
            RpcCopyStatusContainer container = null;

            if (ReplayRpcVersionControl.IsGetCopyStatusWithHealthStateRpcSupported(ReplayRpcClientWrapper.GetServerVersion(serverName)))
            {
                ReplayRpcClientWrapper.RunRpcOperation(serverName, null, timeoutMs, TasksRpcExceptionWrapper.Instance, delegate(ReplayRpcClient rpcClient)
                {
                    RpcErrorExceptionInfo result;
                    try
                    {
                        ExTraceGlobals.ReplayServiceRpcTracer.TraceDebug <string>(0L, "GetCopyStatusWithHealthState(): Now making RpccGetCopyStatusWithHealthState() RPC to server {0}.", serverName);
                        RpcErrorExceptionInfo rpcErrorExceptionInfo = rpcClient.RpccGetCopyStatusWithHealthState(collectionFlags2, dbGuids, ref container);
                        if (!rpcErrorExceptionInfo.IsFailed())
                        {
                            ReplayRpcClientWrapper.DeserializeExtendedErrorInfo(container.CopyStatuses);
                        }
                        result = rpcErrorExceptionInfo;
                    }
                    catch (RpcException ex)
                    {
                        if (ReplayRpcErrorCode.IsRpcTimeoutError(ex.ErrorCode))
                        {
                            throw new ReplayServiceDownException(serverName, ex.Message, ex);
                        }
                        throw;
                    }
                    return(result);
                });
            }
            else
            {
                container = new RpcCopyStatusContainer();
                container.HealthStates = null;
                container.CopyStatuses = this.GetCopyStatus(serverName, collectionFlags2, dbGuids, timeoutMs);
            }
            return(container);
        }
예제 #21
0
        // Token: 0x06000465 RID: 1125 RVA: 0x00017818 File Offset: 0x00015A18
        public override RpcErrorExceptionInfo DismountDatabaseDirect(Guid guid, AmDismountArg dismountArg)
        {
            AmTrace.Debug("Dismounting database: {0}", new object[]
            {
                guid
            });
            RpcErrorExceptionInfo rpcErrorExceptionInfo = AmRpcExceptionWrapper.Instance.RunRpcServerOperation(delegate()
            {
                AmDbActionCode actionCode = new AmDbActionCode(dismountArg.Reason);
                AmRpcServer.m_amInstance.DismountDatabaseDirect(guid, (UnmountFlags)dismountArg.Flags, actionCode);
            });

            if (rpcErrorExceptionInfo.IsFailed())
            {
                ReplayCrimsonEvents.DismountDirectFailed.Log <Guid, string>(guid, rpcErrorExceptionInfo.ErrorMessage);
            }
            return(rpcErrorExceptionInfo);
        }
 // Token: 0x06001994 RID: 6548 RVA: 0x0006AC90 File Offset: 0x00068E90
 protected void SeedThreadProc()
 {
     try
     {
         RpcErrorExceptionInfo rpcErrorExceptionInfo = SeederRpcExceptionWrapper.Instance.RunRpcServerOperation(this.ConfigArgs.Name, delegate()
         {
             this.SeedThreadProcInternal();
         });
         if (rpcErrorExceptionInfo != null && rpcErrorExceptionInfo.IsFailed())
         {
             this.LogErrorExceptionInfo(rpcErrorExceptionInfo, false);
         }
         ExTraceGlobals.SeederServerTracer.TraceDebug((long)this.GetHashCode(), "DatabaseSeederInstance: StoppedEvent set.");
     }
     finally
     {
         this.m_completedTimeUtc = DateTime.UtcNow;
     }
 }
예제 #23
0
        // Token: 0x06000467 RID: 1127 RVA: 0x000179BC File Offset: 0x00015BBC
        public override RpcErrorExceptionInfo ServerMoveAllDatabases(string sourceServer, string targetServer, int mountFlags, int dismountFlags, int mountDialOverride, int tryOtherHealthyServers, int skipValidationChecks, int actionCode, string moveComment, string componentName, ref List <AmDatabaseMoveResult> databaseMoveResults)
        {
            AmTrace.Debug("Request ServerMoveAllDatabases from {0}", new object[]
            {
                sourceServer
            });
            List <AmDatabaseMoveResult> tempMoveResults = null;
            AmServerName sourceServerName = new AmServerName(sourceServer);
            AmServerName targetServerName = new AmServerName(targetServer);

            if (string.IsNullOrEmpty(moveComment))
            {
                moveComment = ReplayStrings.AmBcsNoneSpecified;
            }
            RpcErrorExceptionInfo rpcErrorExceptionInfo = AmRpcExceptionWrapper.Instance.RunRpcServerOperation(delegate()
            {
                tempMoveResults = AmRpcServer.m_amInstance.ServerMoveAllDatabases(sourceServerName, targetServerName, (MountFlags)mountFlags, (UnmountFlags)dismountFlags, (DatabaseMountDialOverride)mountDialOverride, Convert.ToBoolean(tryOtherHealthyServers), (AmBcsSkipFlags)skipValidationChecks, new AmDbActionCode(actionCode), moveComment, componentName);
            });

            databaseMoveResults = tempMoveResults;
            if (rpcErrorExceptionInfo.IsFailed())
            {
                ReplayCrimsonEvents.ServerMoveAllDatabasesFailed.Log <string, string, string>(sourceServer, rpcErrorExceptionInfo.ErrorMessage, moveComment);
            }
            else
            {
                IEnumerable <AmDatabaseMoveResult> source = from moveResult in databaseMoveResults
                                                            where moveResult.MoveStatus != AmDbMoveStatus.Succeeded
                                                            select moveResult;
                int num = source.Count <AmDatabaseMoveResult>();
                AmTrace.Debug("ServerMoveAllDatabases from {0} had {1} failed database moves.", new object[]
                {
                    sourceServer,
                    num
                });
                if (num > 0)
                {
                    ReplayCrimsonEvents.ServerMoveAllDatabasesFailed.Log <string, LocalizedString, string>(sourceServer, ReplayStrings.ServerMoveAllDatabasesFailed(num), moveComment);
                }
            }
            return(rpcErrorExceptionInfo);
        }
예제 #24
0
        // Token: 0x0600046C RID: 1132 RVA: 0x00017D38 File Offset: 0x00015F38
        public override RpcErrorExceptionInfo RpcsGetAutomountConsensusState(ref int automountConsensusState)
        {
            MommyMayIAutomount    dummy  = MommyMayIAutomount.InsufficientInformationDoNotMount;
            RpcErrorExceptionInfo result = AmRpcExceptionWrapper.Instance.RunRpcServerOperation(delegate()
            {
                if (AmSystemManager.Instance.ConfigManager.MommyMayIMount)
                {
                    dummy = MommyMayIAutomount.SomebodyGrantsPermission;
                    return;
                }
                dummy = MommyMayIAutomount.InsufficientInformationDoNotMount;
            });

            AmTrace.Debug("Retrieved the DAC consensus state as {0}.", new object[]
            {
                dummy
            });
            automountConsensusState = (int)dummy;
            return(result);
        }
예제 #25
0
        // Token: 0x0600045F RID: 1119 RVA: 0x000173AC File Offset: 0x000155AC
        public override RpcErrorExceptionInfo MoveDatabaseEx(Guid guid, int mountFlags, int dismountFlags, int mountDialOverride, string fromServer, string targetServerFqdn, bool tryOtherHealthyServers, int skipValidationChecks, int iActionCode, string moveComment, ref AmDatabaseMoveResult databaseMoveResult)
        {
            AmTrace.Debug("Moving database: {0} flags: {1} mountdialoverride: {2} targetserver: {3}", new object[]
            {
                guid,
                mountFlags,
                mountDialOverride,
                targetServerFqdn
            });
            if (ActiveManagerUtil.IsNullEncoded(fromServer))
            {
                fromServer = null;
            }
            if (ActiveManagerUtil.IsNullEncoded(targetServerFqdn))
            {
                targetServerFqdn = null;
            }
            AmDatabaseMoveResult tempMoveResult = null;

            databaseMoveResult = null;
            RpcErrorExceptionInfo result = AmRpcExceptionWrapper.Instance.RunRpcServerOperation(delegate()
            {
                AmDbActionCode actionCode;
                if (iActionCode == 4)
                {
                    actionCode = new AmDbActionCode(AmDbActionInitiator.Admin, AmDbActionReason.Cmdlet, AmDbActionCategory.Move);
                }
                else if (iActionCode == 7)
                {
                    actionCode = new AmDbActionCode(AmDbActionInitiator.Automatic, AmDbActionReason.FailureItem, AmDbActionCategory.Move);
                }
                else
                {
                    actionCode = new AmDbActionCode(iActionCode);
                }
                AmRpcServer.m_amInstance.MoveDatabase(guid, (MountFlags)mountFlags, (UnmountFlags)dismountFlags, (DatabaseMountDialOverride)mountDialOverride, new AmServerName(fromServer), new AmServerName(targetServerFqdn), tryOtherHealthyServers, (AmBcsSkipFlags)skipValidationChecks, actionCode, moveComment, ref tempMoveResult);
            });

            databaseMoveResult = tempMoveResult;
            return(result);
        }
        // Token: 0x06001999 RID: 6553 RVA: 0x0006AE4C File Offset: 0x0006904C
        protected void LogErrorExceptionInfo(RpcErrorExceptionInfo errorExceptionInfo, bool fThrow)
        {
            Exception ex = null;

            lock (this)
            {
                ExTraceGlobals.SeederServerTracer.TraceError <string, RpcErrorExceptionInfo>((long)this.GetHashCode(), "LogErrorExceptionInfo: Database ({0}) failed to seed. errorExceptionInfo = ({1})", this.ConfigArgs.Name, errorExceptionInfo);
                SeederState seederState;
                SeederState origState;
                bool        flag2 = this.UpdateState(SeederState.SeedFailed, out seederState, out origState);
                string      errorMessageAndExceptionFromErrorExceptionInfo = this.GetErrorMessageAndExceptionFromErrorExceptionInfo(errorExceptionInfo, origState, out ex);
                string      text = string.Format("Msg={0} Ex={1}", errorMessageAndExceptionFromErrorExceptionInfo, ex);
                ReplayCrimsonEvents.SeedingErrorOnTarget.Log <Guid, string, string>(this.DatabaseGuid, this.DatabaseName, text);
                if (flag2 || seederState == SeederState.SeedCancelled || !Cluster.StringIEquals(this.m_lastErrorMessage, errorMessageAndExceptionFromErrorExceptionInfo))
                {
                    ExEventLog.EventTuple eventTupleFromState = this.GetEventTupleFromState(origState);
                    eventTupleFromState.LogEvent(null, new object[]
                    {
                        this.ConfigArgs.Name,
                        errorMessageAndExceptionFromErrorExceptionInfo
                    });
                    ExTraceGlobals.SeederServerTracer.TraceError <string, Exception>((long)this.GetHashCode(), "Database ({0}) failed to seed with the exception: {1}", this.ConfigArgs.Name, ex);
                    this.m_seederStatus.ErrorInfo = errorExceptionInfo;
                    this.m_lastErrorMessage       = errorMessageAndExceptionFromErrorExceptionInfo;
                    if (this.m_setSeedingCallback != null)
                    {
                        this.CallFailedDbSeed(eventTupleFromState, ex);
                    }
                }
                else
                {
                    this.m_lastErrorMessage = ex.Message;
                }
            }
            this.CloseSeeding(false);
            if (ex != null && fThrow)
            {
                throw ex;
            }
        }
예제 #27
0
        // Token: 0x06000466 RID: 1126 RVA: 0x000178B0 File Offset: 0x00015AB0
        public override RpcErrorExceptionInfo ServerSwitchOver(string sourceServer)
        {
            AmTrace.Debug("Request ServerSwitchOver from {0}", new object[]
            {
                sourceServer
            });
            ReplayCrimsonEvents.SwitchoverInitiated.Log <string>(sourceServer);
            RpcErrorExceptionInfo rpcErrorExceptionInfo = AmRpcExceptionWrapper.Instance.RunRpcServerOperation(delegate()
            {
                AmRpcServer.m_amInstance.ServerSwitchOver(new AmServerName(sourceServer));
            });

            if (rpcErrorExceptionInfo.IsFailed())
            {
                ReplayCrimsonEvents.SwitchoverFailed.Log <string, string>(sourceServer, rpcErrorExceptionInfo.ErrorMessage);
            }
            else
            {
                ReplayCrimsonEvents.SwitchoverSuccess.Log <string>(sourceServer);
            }
            return(rpcErrorExceptionInfo);
        }
예제 #28
0
        private static void TrySerializeException(Exception ex, RpcErrorExceptionInfo errorInfo)
        {
            Exception ex2 = null;

            try
            {
                errorInfo.SerializedException = SerializationServices.Serialize(ex);
            }
            catch (SerializationException ex3)
            {
                ex2 = ex3;
            }
            catch (TargetInvocationException ex4)
            {
                ex2 = ex4;
            }
            if (ex2 != null)
            {
                ExTraceGlobals.ReplayServiceRpcTracer.TraceError <Type, Exception>(0L, "ConvertExceptionToErrorExceptionInfo: Failed to serialize Exception of type '{0}'. Serialization Exception: {1}", ex.GetType(), ex2);
                errorInfo.ErrorMessage = ex.ToString();
            }
        }
예제 #29
0
        // Token: 0x06001A46 RID: 6726 RVA: 0x0006E83C File Offset: 0x0006CA3C
        public void PrepareDbSeedAndBegin(Guid dbGuid, bool fDeleteExistingLogs, bool fSafeDeleteExistingFiles, bool fAutoSuspend, bool fManualResume, bool fSeedDatabase, bool fSeedCiFiles, string networkId, string seedingPath, string sourceName, bool?compressOverride, bool?encryptOverride, SeederRpcFlags flags = SeederRpcFlags.None)
        {
            if (dbGuid == Guid.Empty)
            {
                throw new ArgumentException("An invalid Database Guid was specified.", "dbGuid");
            }
            RpcSeederArgs args = new RpcSeederArgs(dbGuid, fDeleteExistingLogs, fAutoSuspend, seedingPath, null, networkId, false, sourceName, null, fManualResume, fSeedDatabase, fSeedCiFiles, compressOverride, encryptOverride, 0, fSafeDeleteExistingFiles, flags);

            this.ValidateArgs(args);
            ExTraceGlobals.SeederClientTracer.TraceDebug <RpcSeederArgs>((long)this.GetHashCode(), "PrepareDbSeedAndBegin(): Constructed RpcSeederArgs: {0}", args);
            RpcErrorExceptionInfo errorInfo  = null;
            RpcSeederStatus       seedStatus = null;
            ServerVersion         version    = this.GetTestHookServerVersion();
            bool isSafeDeleteSupported       = ReplayRpcVersionControl.IsSeedRpcSafeDeleteSupported(version);
            bool isSeedV5Supported           = ReplayRpcVersionControl.IsSeedRpcV5Supported(version);

            SeederRpcExceptionWrapper.Instance.ClientRetryableOperation(this.m_serverName, delegate
            {
                if (isSeedV5Supported)
                {
                    errorInfo = this.m_client.RpccPrepareDatabaseSeedAndBegin5(args, ref seedStatus);
                    return;
                }
                if (isSafeDeleteSupported)
                {
                    errorInfo = this.m_client.RpccPrepareDatabaseSeedAndBegin4(args, ref seedStatus);
                    return;
                }
                if (!fSafeDeleteExistingFiles)
                {
                    errorInfo = this.m_client.RpccPrepareDatabaseSeedAndBegin(args, ref seedStatus);
                    return;
                }
                ExTraceGlobals.SeederClientTracer.TraceError <string, ServerVersion, ServerVersion>((long)this.GetHashCode(), "PrepareDbSeedAndBegin(): Server '{0}' does not support SafeDeleteExistingFiles RPC. Server version: {1}. Minimum supported version: {2}", this.m_serverName, version, ReplayRpcVersionControl.SeedRpcSafeDeleteSupportVersion);
                throw new SeederRpcSafeDeleteUnsupportedException(this.m_serverName, version.ToString(), ReplayRpcVersionControl.SeedRpcSafeDeleteSupportVersion.ToString());
            });
            SeederRpcExceptionWrapper.Instance.ClientRethrowIfFailed(this.m_databaseName, this.m_serverName, errorInfo);
        }
 public new void ClientRethrowIfFailed(string databaseName, string serverName, RpcErrorExceptionInfo errorInfo)
 {
     throw new NotImplementedException();
 }