// Token: 0x060002DA RID: 730 RVA: 0x0000FFC0 File Offset: 0x0000E1C0
        protected override void RunInternal()
        {
            Exception lastException = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                this.CheckIfOperationIsAllowedOnCurrentRole();
                AmDbStateInfo amDbStateInfo = AmSystemManager.Instance.Config.DbState.Read(base.Database.Guid);
                if (!amDbStateInfo.IsAdminDismounted)
                {
                    AmTrace.Debug("AmDbDismountAdminDismountedOperation skipped since database is not marked as admin dismounted anymore", new object[0]);
                    return;
                }
                MountStatus storeDatabaseMountStatus = AmStoreHelper.GetStoreDatabaseMountStatus(null, base.Database.Guid);
                if (storeDatabaseMountStatus == MountStatus.Mounted)
                {
                    AmDbAction amDbAction = base.PrepareDbAction(this.ActionCode);
                    ReplayCrimsonEvents.DismountingAdminDismountRequestedDatabase.Log <string, Guid, AmServerName>(base.Database.Name, base.Database.Guid, amDbStateInfo.ActiveServer);
                    amDbAction.Dismount(UnmountFlags.None);
                    return;
                }
                AmTrace.Debug("AmDbDismountAdminDismountedOperation skipped since database is not mounted (db={0}, mountStatus={1})", new object[]
                {
                    base.Database.Name,
                    storeDatabaseMountStatus
                });
            });

            base.LastException = lastException;
        }
        // Token: 0x060003C7 RID: 967 RVA: 0x0001482C File Offset: 0x00012A2C
        protected override Exception RunServerRpc(AmServerName node, out object result)
        {
            Exception result2        = null;
            Exception storeException = null;

            MdbStatus[] mdbStatuses = null;
            result = null;
            AmMdbStatusServerInfo amMdbStatusServerInfo = this.ServerInfoMap[node];
            bool flag = false;

            try
            {
                InvokeWithTimeout.Invoke(delegate()
                {
                    storeException = this.RunServerRpcInternal(node, out mdbStatuses);
                }, amMdbStatusServerInfo.TimeOut);
            }
            catch (TimeoutException ex)
            {
                result2 = ex;
                flag    = true;
            }
            if (!flag)
            {
                result2 = storeException;
                amMdbStatusServerInfo.IsStoreRunning  = true;
                amMdbStatusServerInfo.IsReplayRunning = AmHelper.IsReplayRunning(node);
                result = mdbStatuses;
            }
            return(result2);
        }
Пример #3
0
        public static void HandleRequest(RpcGenericRequestInfo requestInfo, ref RpcGenericReplyInfo replyInfo)
        {
            RpcGenericReplyInfo tmpReplyInfo = null;

            RpcKillServiceImpl.Request req = null;
            RpcKillServiceImpl.Reply   rep = new RpcKillServiceImpl.Reply();
            Exception ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                req = ActiveManagerGenericRpcHelper.ValidateAndGetAttachedRequest <RpcKillServiceImpl.Request>(requestInfo, 1, 0);
                ReplayCrimsonEvents.ReceivedRequestToKillService.Log <string, string, RpcKillServiceImpl.Request>(req.ServiceName, req.OriginatingServerName, req);
                lock (RpcKillServiceImpl.locker)
                {
                    RpcKillServiceImpl.HandleRequestInternal(req, rep);
                }
                tmpReplyInfo = ActiveManagerGenericRpcHelper.PrepareServerReply(requestInfo, rep, 1, 0);
            });

            if (tmpReplyInfo != null)
            {
                replyInfo = tmpReplyInfo;
            }
            if (ex != null)
            {
                throw new AmServerException(ex.Message, ex);
            }
        }
Пример #4
0
        // Token: 0x0600054E RID: 1358 RVA: 0x0001AF88 File Offset: 0x00019188
        protected override void TimerCallbackInternal()
        {
            bool      flag = true;
            Exception ex   = null;
            AmSystemFailoverOnReplayDownTracker failoverTracker = AmSystemManager.Instance.SystemFailoverOnReplayDownTracker;

            if (failoverTracker != null)
            {
                try
                {
                    ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
                    {
                        this.Run(failoverTracker);
                    });
                    flag = false;
                }
                finally
                {
                    failoverTracker.RemoveTimer(this.serverName);
                    if (flag || ex != null)
                    {
                        ReplayCrimsonEvents.FailoverOnReplDownFailedToInitiate.Log <AmServerName, string>(this.serverName, (ex != null) ? ex.Message : "<Unhandled exception>");
                    }
                }
            }
        }
Пример #5
0
        // Token: 0x0600054F RID: 1359 RVA: 0x0001B024 File Offset: 0x00019224
        private void Run(AmSystemFailoverOnReplayDownTracker failoverTracker)
        {
            AmConfig config = AmSystemManager.Instance.Config;

            if (!config.IsPAM)
            {
                ReplayCrimsonEvents.FailoverOnReplDownSkipped.Log <AmServerName, string, string>(this.serverName, "RoleNotPAM", "TimerCallback");
                return;
            }
            if (AmHelper.IsReplayRunning(this.serverName))
            {
                ReplayCrimsonEvents.FailoverOnReplDownSkipped.Log <AmServerName, string, string>(this.serverName, "ReplRunning", "TimerCallback");
                return;
            }
            AmThrottledActionTracker <FailoverData> .ThrottlingShapshot throttlingSnapshot = failoverTracker.GetThrottlingSnapshot(this.serverName);
            if (throttlingSnapshot.IsActionCalledTooSoonPerNode || throttlingSnapshot.IsActionCalledTooSoonAcrossDag || throttlingSnapshot.IsMaxActionsPerNodeExceeded || throttlingSnapshot.IsMaxActionsAcrossDagExceeded)
            {
                throttlingSnapshot.LogResults(ReplayCrimsonEvents.FailoverOnReplDownThrottlingFailed, TimeSpan.FromMinutes(15.0));
                return;
            }
            failoverTracker.AddFailoverEntry(this.serverName);
            throttlingSnapshot.LogResults(ReplayCrimsonEvents.FailoverOnReplDownThrottlingSucceeded, TimeSpan.Zero);
            AmEvtSystemFailoverOnReplayDown amEvtSystemFailoverOnReplayDown = new AmEvtSystemFailoverOnReplayDown(this.serverName);

            amEvtSystemFailoverOnReplayDown.Notify();
        }
        // Token: 0x060004B2 RID: 1202 RVA: 0x00019670 File Offset: 0x00017870
        private void DismountCompletionCallback(IAsyncResult ar)
        {
            DismountDatabasesInParallel.AsyncDismountState state = (DismountDatabasesInParallel.AsyncDismountState)ar.AsyncState;
            Exception ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                state.DismountFunction.EndInvoke(ar);
            });

            if (ex == null)
            {
                AmTrace.Debug("DismountDatabasesInParallel: Finished dismount for DB {0}.", new object[]
                {
                    state.MdbGuid
                });
            }
            else
            {
                AmTrace.Debug("DismountDatabasesInParallel: Dismount for DB {0} failed with {1}.", new object[]
                {
                    state.MdbGuid,
                    ex.Message
                });
            }
            lock (this.m_locker)
            {
                this.m_completedCount++;
                if (this.m_completedCount == this.m_totalRequests && this.m_completedEvent != null)
                {
                    this.m_completedEvent.Set();
                }
            }
        }
Пример #7
0
        // Token: 0x0600079D RID: 1949 RVA: 0x00024D10 File Offset: 0x00022F10
        public static void HandleRequest(RpcGenericRequestInfo requestInfo, ref RpcGenericReplyInfo replyInfo)
        {
            RpcGenericReplyInfo tmpReplyInfo = null;

            RpcUpdateLastLogImpl.Request req = null;
            RpcUpdateLastLogImpl.Reply   rep = new RpcUpdateLastLogImpl.Reply();
            Exception ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                req = ActiveManagerGenericRpcHelper.ValidateAndGetAttachedRequest <RpcUpdateLastLogImpl.Request>(requestInfo, 1, 0);
                ExDateTime exDateTime = ExDateTime.MinValue;
                AmCachedLastLogUpdater pamCachedLastLogUpdater = AmSystemManager.Instance.PamCachedLastLogUpdater;
                if (pamCachedLastLogUpdater != null)
                {
                    exDateTime = pamCachedLastLogUpdater.AddEntries(req.ServerName, req.InitiatedTimeUtc, req.LastLogEntries);
                }
                rep.LastSuccessfulUpdateTimeUtc = exDateTime.UniversalTime;
                tmpReplyInfo = ActiveManagerGenericRpcHelper.PrepareServerReply(requestInfo, rep, 1, 0);
            });

            if (tmpReplyInfo != null)
            {
                replyInfo = tmpReplyInfo;
            }
            if (ex != null)
            {
                throw new AmServerException(ex.Message, ex);
            }
        }
        // Token: 0x060003DB RID: 987 RVA: 0x00014DA0 File Offset: 0x00012FA0
        protected override Exception RunServerRpc(AmServerName node, out object result)
        {
            Exception exception = null;

            result = null;
            AmRole?role = null;

            try
            {
                InvokeWithTimeout.Invoke(delegate()
                {
                    string errorMessage = null;
                    exception           = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
                    {
                        role = new AmRole?(Dependencies.AmRpcClientWrapper.GetActiveManagerRole(node.Fqdn, out errorMessage));
                    });
                }, this.timeout);
            }
            catch (TimeoutException exception)
            {
                TimeoutException exception2;
                exception = exception2;
            }
            if (role != null)
            {
                Interlocked.Increment(ref this.successCount);
                result = role;
            }
            return(exception);
        }
        // Token: 0x060002F5 RID: 757 RVA: 0x00011688 File Offset: 0x0000F888
        protected override void MountInternal(MountFlags storeFlags, AmMountFlags amMountFlags, DatabaseMountDialOverride mountDialoverride, ref AmDbOperationDetailedStatus mountStatus)
        {
            Exception    ex            = null;
            bool         isSuccess     = false;
            AmServerName activeServer  = base.State.ActiveServer;
            AmServerName serverToMount = AmServerName.LocalComputerName;
            Stopwatch    stopwatch     = new Stopwatch();

            stopwatch.Start();
            try
            {
                ReplayCrimsonEvents.DirectMountInitiated.LogGeneric(base.PrepareSubactionArgs(new object[]
                {
                    serverToMount,
                    storeFlags,
                    false,
                    amMountFlags
                }));
                ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
                {
                    this.ReportStatus(AmDbActionStatus.StoreMountInitiated);
                    this.WriteStateMountStart(serverToMount);
                    AmDbAction.MountDatabaseDirect(serverToMount, this.State.LastMountedServer, this.DatabaseGuid, storeFlags, amMountFlags, this.ActionCode);
                    isSuccess = true;
                });
            }
            finally
            {
                stopwatch.Stop();
                if (isSuccess)
                {
                    base.DbTrace.Debug("Database is now mounted on {0}", new object[]
                    {
                        serverToMount
                    });
                    SharedDependencies.WritableADHelper.ResetAllowFileRestoreDsFlag(base.DatabaseGuid, activeServer, serverToMount);
                    ReplayCrimsonEvents.DirectMountSuccess.LogGeneric(base.PrepareSubactionArgs(new object[]
                    {
                        serverToMount,
                        stopwatch.Elapsed
                    }));
                    base.WriteStateMountSuccess();
                    base.ReportStatus(AmDbActionStatus.StoreMountSuccessful);
                }
                else
                {
                    string text = (ex != null) ? ex.Message : ReplayStrings.UnknownError;
                    ReplayCrimsonEvents.DirectMountFailed.LogGeneric(base.PrepareSubactionArgs(new object[]
                    {
                        serverToMount,
                        stopwatch.Elapsed,
                        text
                    }));
                    base.WriteStateMountFailed(true);
                    base.ReportStatus(AmDbActionStatus.StoreMountFailed);
                }
            }
            AmHelper.ThrowDbActionWrapperExceptionIfNecessary(ex);
        }
Пример #10
0
        // Token: 0x060003FB RID: 1019 RVA: 0x00015764 File Offset: 0x00013964
        private void PerformVerification()
        {
            AmConfig config = AmSystemManager.Instance.Config;

            if (config.IsSAM)
            {
                AmServerName pam          = config.DagConfig.CurrentPAM;
                AmRole       role         = AmRole.Unknown;
                string       errorMessage = null;
                Exception    ex           = null;
                bool         flag         = false;
                if (this.IsServerDisabled(AmServerName.LocalComputerName))
                {
                    AmTrace.Debug("PamMonitor.PerformVerification found local server marked ActivationDisabled", new object[0]);
                    return;
                }
                IADServer server = Dependencies.ADConfig.GetServer(pam);
                if (server == null)
                {
                    AmTrace.Error("PamMonitor.PerformVerification found pam on {0} but no server data in ADConfig", new object[]
                    {
                        pam.Fqdn
                    });
                    return;
                }
                if (this.IsServerDisabled(server))
                {
                    AmTrace.Debug("PamMonitor.PerformVerification found PAM server marked ActivationDisabled", new object[0]);
                    flag = true;
                }
                if (!flag)
                {
                    ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
                    {
                        role = Dependencies.AmRpcClientWrapper.GetActiveManagerRole(pam.Fqdn, out errorMessage);
                    });
                }
                if (flag || role != AmRole.PAM)
                {
                    string text = string.Empty;
                    int    num  = RegistryParameters.PamMonitorRecoveryDurationInSec;
                    if (flag)
                    {
                        errorMessage = "PAM has been marked ActivationDisabled";
                        num          = 5;
                    }
                    else if (ex != null)
                    {
                        text = ex.Message;
                    }
                    ReplayCrimsonEvents.PamMonitorServerNotInPamRole.Log <AmServerName, AmRole, string, string>(pam, role, errorMessage, text);
                    this.pamServerInVerificationPhase = pam;
                    this.phase = AmPamMonitor.PamMonitorPhase.Recovery;
                    TimeSpan timeSpan = TimeSpan.FromSeconds((double)num);
                    base.ChangeTimer(timeSpan, timeSpan);
                }
            }
        }
Пример #11
0
        protected override void RunInternal()
        {
            Exception lastException = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                AmDbAction.DismountIfMismounted(base.Database, this.ActionCode, this.MismountedNodes);
            });

            base.LastException = lastException;
        }
Пример #12
0
        // Token: 0x0600081B RID: 2075 RVA: 0x00027510 File Offset: 0x00025710
        internal static bool SleepUntilShutdown(TimeSpan ts, bool throwIfShuttingdown)
        {
            bool flag = AmHelper.SleepUntilShutdown(ts);

            if (flag && throwIfShuttingdown)
            {
                throw new AmServiceShuttingDownException();
            }
            return(flag);
        }
Пример #13
0
        protected override void RunInternal()
        {
            Exception lastException = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                AmDbAction amDbAction = base.PrepareDbAction(this.ActionCode);
                amDbAction.Remount(this.Flags, this.MountDialOverride, this.FromServer);
            });

            base.LastException = lastException;
        }
        // Token: 0x060002E0 RID: 736 RVA: 0x00010040 File Offset: 0x0000E240
        protected override void RunInternal()
        {
            Exception lastException = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                this.CheckIfOperationIsAllowedOnCurrentRole();
                AmDbAction.SyncDatabaseOwningServerAndLegacyDn(base.Database, this.ActionCode);
            });

            base.LastException = lastException;
        }
Пример #15
0
        // Token: 0x0600082A RID: 2090 RVA: 0x00027B40 File Offset: 0x00025D40
        internal static DateTime GetLocalBootTime()
        {
            DateTime bootTimeWithWmi;

            using (ManagementClass managementClass = new ManagementClass("Win32_OperatingSystem"))
            {
                bootTimeWithWmi = AmHelper.GetBootTimeWithWmi(managementClass, AmServerName.LocalComputerName);
            }
            return(bootTimeWithWmi);
        }
Пример #16
0
        // Token: 0x06000628 RID: 1576 RVA: 0x0001E7A4 File Offset: 0x0001C9A4
        internal void DeleteFromPersistentStoreBestEffort()
        {
            Exception ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                this.DeleteFromPersistentStore();
            });

            if (ex != null)
            {
                ReplayCrimsonEvents.TransientFailoverSuppressionPersistentStoreFailure.Log <string, AmServerName, string>("Delete", this.ServerName, ex.Message);
            }
        }
        // Token: 0x060002A9 RID: 681 RVA: 0x0000F8DC File Offset: 0x0000DADC
        protected override void RunInternal()
        {
            AmDbOperationDetailedStatus mountStatus = null;
            Exception lastException = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                AmDbAction amDbAction = this.PrepareDbAction(this.ActionCode);
                amDbAction.Mount(this.StoreMountFlags, this.AmMountFlags, this.MountDialOverride, ref mountStatus);
            });

            base.DetailedStatus = mountStatus;
            base.LastException  = lastException;
        }
 // Token: 0x0600005B RID: 91 RVA: 0x00002E33 File Offset: 0x00001033
 protected void DelayFirstStartup()
 {
     if (AmStartupAutoMounter.sm_isFirstTimeStartupMount)
     {
         AmStartupAutoMounter.sm_isFirstTimeStartupMount = false;
         AmHelper.SleepUntilShutdown(TimeSpan.FromMilliseconds((double)RegistryParameters.AutoMounterFirstStartupDelayInMsec), true);
     }
     if (AmSystemManager.Instance.StoreStateMarker != null)
     {
         AmSystemManager.Instance.StoreStateMarker.ClearAllStoreStartRequests();
     }
 }
        // Token: 0x060002C2 RID: 706 RVA: 0x0000FCD8 File Offset: 0x0000DED8
        protected override void RunInternal()
        {
            AmDbOperationDetailedStatus moveStatus = null;
            Exception lastException = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                AmDbAction amDbAction = this.PrepareDbAction(this.Arguments.ActionCode);
                amDbAction.Move(this.Arguments.MountFlags, this.Arguments.DismountFlags, this.Arguments.MountDialOverride, this.Arguments.SourceServer, this.Arguments.TargetServer, this.Arguments.TryOtherHealthyServers, this.Arguments.SkipValidationChecks, this.Arguments.MoveComment, this.Arguments.ComponentName, ref moveStatus);
            });

            base.DetailedStatus = moveStatus;
            base.LastException  = lastException;
        }
Пример #20
0
        internal static RpcKillServiceImpl.Reply SendKillRequest(string serverName, string serviceName, DateTime minTimeCheck, bool isForce, int timeoutInMSec)
        {
            Exception ex = null;

            RpcKillServiceImpl.Reply reply = null;
            bool isSucceded = false;
            bool flag       = true;

            try
            {
                ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
                {
                    ReplayCrimsonEvents.SendingServiceKillRequest.Log <string, string>(serviceName, serverName);
                    RpcKillServiceImpl.Request attachedRequest = new RpcKillServiceImpl.Request(serviceName, minTimeCheck, false);
                    RpcGenericRequestInfo requestInfo          = ActiveManagerGenericRpcHelper.PrepareClientRequest(attachedRequest, 1, 1, 0);
                    reply      = ActiveManagerGenericRpcHelper.RunRpcAndGetReply <RpcKillServiceImpl.Reply>(requestInfo, serverName, timeoutInMSec);
                    isSucceded = reply.IsSucceeded;
                });
                flag = false;
            }
            finally
            {
                if (isSucceded)
                {
                    ReplayCrimsonEvents.ServiceKillRequestSucceeded.Log <string, string, string>(serviceName, serverName, reply.ToString());
                }
                else
                {
                    string text = "Unknown";
                    if (ex != null)
                    {
                        text = string.Format("Error: {0}", ex.Message);
                    }
                    else if (reply != null)
                    {
                        if (reply.IsThrottled)
                        {
                            text = "Throttled";
                        }
                        else if (reply.IsSkippedDueToTimeCheck)
                        {
                            text = "SkippedDueToTimeCheck";
                        }
                        else if (reply.IsSkippedDueToRegistryOverride)
                        {
                            text = "SkippedDueToRegistryOverride";
                        }
                    }
                    ReplayCrimsonEvents.ServiceKillRequestFailed.Log <string, string, bool, string, bool, string>(serviceName, serverName, reply != null && reply.IsThrottled, text, flag, (reply != null) ? reply.ToString() : "<null>");
                }
            }
            return(reply);
        }
Пример #21
0
 // Token: 0x060001B0 RID: 432 RVA: 0x0000AB10 File Offset: 0x00008D10
 internal void AttemptCopyLastLogsDirect(Guid mdbGuid, AmAcllArgs acllArgs, ref AmAcllReturnStatus acllStatus)
 {
     acllStatus = new AmAcllReturnStatus();
     ThirdPartyManager.PreventOperationWhenTPREnabled("AttemptCopyLastLogsDirect");
     if (!AmHelper.IsDatabaseRcrEnabled(mdbGuid))
     {
         throw new AmDbMoveOperationNotSupportedException(mdbGuid.ToString());
     }
     AmTrace.Debug("AttemptCopyLastLogsDirect: Calling AmAcllCallback ({0})", new object[]
     {
         mdbGuid
     });
     acllStatus = this.m_replicaInstanceManager.AmAttemptCopyLastLogsCallback(mdbGuid, acllArgs);
     if (acllArgs.ActionCode.IsAutomaticShutdownSwitchover)
     {
         if (!acllStatus.NoLoss)
         {
             ReplayCrimsonEvents.AcllFailedOnSwitchover.Log <Guid>(mdbGuid);
             throw new AcllFailedException(acllStatus.LastError);
         }
         ReplayCrimsonEvents.AcllLosslessOnSwitchover.Log <Guid>(mdbGuid);
         return;
     }
     else
     {
         if (!acllStatus.NoLoss && acllStatus.MountAllowed)
         {
             ReplayCrimsonEvents.LossyMountEnabled.Log <Guid>(mdbGuid);
             AmTrace.Warning("AttemptCopyLastLogsDirect: ACLL detected a lossy mount will be allowed for DB {0}.", new object[]
             {
                 mdbGuid
             });
             return;
         }
         if (acllStatus.MountAllowed)
         {
             AmTrace.Debug("AttemptCopyLastLogsDirect: ACLL completed with no loss for DB {0}.", new object[]
             {
                 mdbGuid
             });
             ReplayCrimsonEvents.AcllLosslessOnMoveOrFailover.Log <Guid>(mdbGuid);
             return;
         }
         if (string.IsNullOrEmpty(acllStatus.LastError))
         {
             ReplayCrimsonEvents.MountRejected.Log <Guid>(mdbGuid);
             throw new AmDbMountNotAllowedDueToLossException();
         }
         ReplayCrimsonEvents.MountRejectedAcllError.Log <Guid, string>(mdbGuid, acllStatus.LastError);
         throw new AmDbMountNotAllowedDueToAcllErrorException(acllStatus.LastError, acllStatus.NumberOfLogsLost);
     }
 }
Пример #22
0
        // Token: 0x0600082B RID: 2091 RVA: 0x00027B84 File Offset: 0x00025D84
        internal static DateTime GetBootTime(AmServerName machineName)
        {
            System.Management.ManagementScope managementScope = AmHelper.GetManagementScope(machineName);
            ManagementPath   path    = new ManagementPath("Win32_OperatingSystem");
            ObjectGetOptions options = null;
            DateTime         bootTimeWithWmi;

            using (ManagementClass managementClass = new ManagementClass(managementScope, path, options))
            {
                bootTimeWithWmi = AmHelper.GetBootTimeWithWmi(managementClass, machineName);
            }
            return(bootTimeWithWmi);
        }
Пример #23
0
        // Token: 0x06000624 RID: 1572 RVA: 0x0001E57C File Offset: 0x0001C77C
        internal static AmFailoverEntry ReadFromPersistentStoreBestEffort(AmServerName serverName)
        {
            AmFailoverEntry entry = null;
            Exception       ex    = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                entry = AmFailoverEntry.ReadFromPersistentStore(serverName);
            });

            if (ex != null)
            {
                ReplayCrimsonEvents.TransientFailoverSuppressionPersistentStoreFailure.Log <string, AmServerName, string>("Read", serverName, ex.Message);
            }
            return(entry);
        }
Пример #24
0
        internal void InitializeFromClusdb()
        {
            Exception ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                lock (this.locker)
                {
                    this.InitializeFromClusdbInternal();
                }
            });

            if (ex != null)
            {
                ReplayCrimsonEvents.FailoverOnReplDownClusdbInitializeFailed.Log <string, int, string>(this.ActionName, this.MaxHistorySize, (ex != null) ? ex.Message : "<null>");
            }
        }
Пример #25
0
        protected override void RemountInternal(MountFlags mountFlags, DatabaseMountDialOverride mountDialoverride, AmServerName fromServer)
        {
            Exception exception = null;

            base.AttemptDismount(base.State.ActiveServer, UnmountFlags.SkipCacheFlush, true, out exception);
            int num = 0;
            AmDbNodeAttemptTable dbNodeAttemptTable = AmSystemManager.Instance.DbNodeAttemptTable;
            AmAcllReturnStatus   amAcllReturnStatus = null;

            this.AttemptMountOnServer(base.State.ActiveServer, base.State.ActiveServer, mountFlags, AmMountFlags.None, UnmountFlags.SkipCacheFlush, mountDialoverride, AmBcsSkipFlags.None, false, ref num, ref amAcllReturnStatus, out exception);
            base.DbTrace.Debug("AttemptMountOnServer returned AcllStatus: {0}", new object[]
            {
                amAcllReturnStatus
            });
            AmHelper.ThrowDbActionWrapperExceptionIfNecessary(exception);
        }
Пример #26
0
        protected void DismountCommon(UnmountFlags flags)
        {
            AmServerName serverToDismount  = this.State.ActiveServer;
            Exception    dismountException = null;
            bool         isSuccess         = false;
            Exception    ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                this.ReportStatus(AmDbActionStatus.StoreDismountInitiated);
                isSuccess = this.AttemptDismount(this.State.ActiveServer, flags, false, out dismountException);
                if (this.ActionCode.IsAdminDismountOperation)
                {
                    MountStatus storeDatabaseMountStatus = AmStoreHelper.GetStoreDatabaseMountStatus(serverToDismount, this.DatabaseGuid);
                    if (storeDatabaseMountStatus == MountStatus.Dismounted)
                    {
                        this.WriteStateAdminDismounted();
                        dismountException = null;
                        return;
                    }
                    if (storeDatabaseMountStatus == MountStatus.Mounted)
                    {
                        if (dismountException == null)
                        {
                            dismountException = new AmDismountSucceededButStillMountedException(serverToDismount.Fqdn, this.Database.Name);
                        }
                        this.WriteStateDismountFinished(true, MountStatus.Mounted, true);
                        return;
                    }
                    if (dismountException == null)
                    {
                        dismountException = new AmFailedToDetermineDatabaseMountStatusException(serverToDismount.Fqdn, this.Database.Name);
                    }
                    this.WriteStateDismountFinished(true, MountStatus.Dismounted, true);
                }
            });

            if (dismountException != null)
            {
                ex = dismountException;
            }
            if (ex != null)
            {
                this.ReportStatus(AmDbActionStatus.StoreDismountFailed);
                AmHelper.ThrowDbActionWrapperExceptionIfNecessary(ex);
                return;
            }
            this.ReportStatus(AmDbActionStatus.StoreDismountSuccessful);
        }
Пример #27
0
 // Token: 0x060003FC RID: 1020 RVA: 0x000158D4 File Offset: 0x00013AD4
 private void PerformRecovery()
 {
     try
     {
         Exception ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
         {
             this.PerformRecoveryInternal();
         });
         if (ex != null)
         {
             ReplayCrimsonEvents.PamMonitorEncounteredException.Log <string, string>(ex.Message, "Recovery");
         }
     }
     finally
     {
         this.phase = AmPamMonitor.PamMonitorPhase.Verification;
         base.ChangeTimer(this.checkPeriod, this.checkPeriod);
     }
 }
        private static bool ReportStoreStatus(AmServerName serverToContact, AmSystemEventCode eventCode, AmServerName reportingServer)
        {
            Exception ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
            {
                AmRpcClientHelper.ReportSystemEvent(serverToContact.Fqdn, (int)eventCode, reportingServer.Fqdn);
            });

            if (ex != null)
            {
                AmServiceMonitor.Tracer.TraceError(0L, "Failed to report status to PAM (pam={0}, eventCode={1}, reportingServer={2}): error={3}", new object[]
                {
                    serverToContact,
                    eventCode,
                    reportingServer,
                    ex.Message
                });
                return(false);
            }
            return(true);
        }
 // Token: 0x06000045 RID: 69 RVA: 0x00002878 File Offset: 0x00000A78
 internal void Run()
 {
     AmTrace.Entering("AmBatchOperationBase.Run()", new object[0]);
     if (RegistryParameters.AmDisableBatchOperations)
     {
         ReplayCrimsonEvents.BatchMounterOperationsDisabled.Log();
         AmTrace.Leaving("AmBatchOperationBase.Run(), BatchMounterOperationsDisabled", new object[0]);
         return;
     }
     lock (this.m_locker)
     {
         try
         {
             this.m_isDebugOptionEnabled = this.m_amConfig.IsDebugOptionsEnabled();
             this.LogStartupInternal();
             Exception ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
             {
                 this.RunInternal();
             });
             if (ex != null)
             {
                 AmTrace.Error("Batch mounter operation {0} got an exception {1}", new object[]
                 {
                     base.GetType().Name,
                     ex
                 });
                 ReplayCrimsonEvents.BatchMounterOperationFailed.Log <string>(ex.Message);
             }
         }
         finally
         {
             if (!this.m_derivedManagesAllDone && (this.m_opList == null || this.m_opList.Count == 0))
             {
                 this.MarkAllDone();
             }
         }
     }
     AmTrace.Leaving("AmBatchOperationBase.Run()", new object[0]);
 }
Пример #30
0
        internal void NotifyServiceKillToOtherServers(string serviceName, ExDateTime timeInUtc)
        {
            AmLastKnownGoodConfig lastKnownGoodConfig = AmSystemManager.Instance.LastKnownGoodConfig;

            if (lastKnownGoodConfig != null && lastKnownGoodConfig.Role != AmRole.Unknown && lastKnownGoodConfig.Members != null)
            {
                timeInUtc.ToString("s");
                AmServerName[] members = lastKnownGoodConfig.Members;
                for (int i = 0; i < members.Length; i++)
                {
                    AmServerName serverName = members[i];
                    ThreadPool.QueueUserWorkItem(delegate(object param0)
                    {
                        AmServerName serverToRpc     = serverName;
                        AmServerName reportingServer = AmServerName.LocalComputerName;
                        AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1)
                        {
                            AmRpcClientHelper.AmReportServiceKill(serverToRpc.NetbiosName, AmRpcClientHelper.RpcTimeoutShort, serviceName, reportingServer.NetbiosName, timeInUtc.ToString("u"));
                        });
                    });
                }
            }
        }