// Token: 0x060001A7 RID: 423 RVA: 0x0000A4FC File Offset: 0x000086FC internal void DismountDatabase(Guid mdbGuid, UnmountFlags flags, AmDbActionCode actionCode) { AmTrace.Debug("Task: DismountDatabase({0},{1},{2}) called", new object[] { mdbGuid, flags, actionCode }); ActiveManagerCore.ValidatePamOrStandalone("DismountDatabase"); IADDatabase iaddatabase = this.AdLookup.DatabaseLookup.FindAdObjectByGuidEx(mdbGuid, AdObjectLookupFlags.ReadThrough); if (iaddatabase == null) { throw new AmDatabaseNotFoundException(mdbGuid); } AmDbDismountOperation amDbDismountOperation = new AmDbDismountOperation(iaddatabase, actionCode); amDbDismountOperation.Flags = flags; amDbDismountOperation.Enqueue(); AmDbCompletionReason amDbCompletionReason = amDbDismountOperation.Wait(); AmTrace.Debug("DismountDatabase({0}) completed (reason={1})", new object[] { mdbGuid, amDbCompletionReason }); }
// Token: 0x06000496 RID: 1174 RVA: 0x00018950 File Offset: 0x00016B50 internal static Exception Dismount(Guid mdbGuid, UnmountFlags flags) { Exception result = null; if ((flags & UnmountFlags.SkipCacheFlush) == UnmountFlags.SkipCacheFlush) { result = AmStoreHelper.DismountWithKillOnTimeout(mdbGuid, flags, true); } else { try { AmStoreHelper.RemoteDismount(null, mdbGuid, flags, true); } catch (MapiRetryableException ex) { result = ex; } catch (MapiPermanentException ex2) { result = ex2; } } return(result); }
// Token: 0x060001A8 RID: 424 RVA: 0x0000A59C File Offset: 0x0000879C internal void MoveDatabase(Guid mdbGuid, MountFlags mountFlags, UnmountFlags dismountFlags, DatabaseMountDialOverride mountDialOverride, AmServerName fromServer, AmServerName targetServer, bool tryOtherHealthyServers, AmBcsSkipFlags skipValidationChecks, AmDbActionCode actionCode, string moveComment, ref AmDatabaseMoveResult databaseMoveResult) { AmTrace.Debug("Task: MoveDatabase({0},{1},{2},{3},{4},{5},{6},{7},'{8}') called", new object[] { mdbGuid, mountFlags, dismountFlags, mountDialOverride, fromServer, targetServer, tryOtherHealthyServers, actionCode, moveComment }); ActiveManagerCore.ValidatePamOrStandalone("MoveDatabase"); ThirdPartyManager.PreventOperationWhenTPREnabled("MoveDatabase"); IADDatabase iaddatabase = this.AdLookup.DatabaseLookup.FindAdObjectByGuidEx(mdbGuid, AdObjectLookupFlags.ReadThrough); if (iaddatabase == null) { throw new AmDatabaseNotFoundException(mdbGuid); } AmDbMoveOperation amDbMoveOperation = new AmDbMoveOperation(iaddatabase, actionCode); AmDbMoveArguments arguments = amDbMoveOperation.Arguments; AmDbCompletionReason amDbCompletionReason = AmDbCompletionReason.None; arguments.MountFlags = mountFlags; arguments.DismountFlags = dismountFlags; arguments.MountDialOverride = mountDialOverride; arguments.SourceServer = fromServer; arguments.TargetServer = targetServer; arguments.TryOtherHealthyServers = tryOtherHealthyServers; arguments.SkipValidationChecks = skipValidationChecks; arguments.MoveComment = moveComment; amDbMoveOperation.Arguments = arguments; amDbMoveOperation.Enqueue(); try { amDbCompletionReason = amDbMoveOperation.Wait(); } finally { if (amDbMoveOperation.DetailedStatus != null) { databaseMoveResult = amDbMoveOperation.ConvertDetailedStatusToRpcMoveResult(amDbMoveOperation.DetailedStatus); } } AmTrace.Debug("MoveDatabase({0}) completed (reason={1})", new object[] { mdbGuid, amDbCompletionReason }); }
// Token: 0x060020E5 RID: 8421 RVA: 0x000975B0 File Offset: 0x000957B0 public void UnmountDatabase(Guid guidStorageGroup, Guid guidMdb, int flags) { UnmountFlags flags2 = (UnmountFlags)flags; TimeSpan timeout = InvokeWithTimeout.InfiniteTimeSpan; if (this.ShouldUseTimeout && (flags2 & UnmountFlags.SkipCacheFlush) != UnmountFlags.None) { timeout = TimeSpan.FromSeconds((double)RegistryParameters.AmDismountOrKillTimeoutInSec); } base.ProtectedCallWithTimeout("UnmountDatabase", timeout, delegate { this.ExRpcAdmin.UnmountDatabase(guidStorageGroup, guidMdb, flags); }); }
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); }
// Token: 0x060004A9 RID: 1193 RVA: 0x00019340 File Offset: 0x00017540 private static Exception DismountWithKillOnTimeout(Guid mdbGuid, UnmountFlags flags, bool retryOnConflict) { AmTrace.Debug("DismountWithKillOnTimeout {0}", new object[] { mdbGuid }); Exception result = null; bool flag = false; DateTime utcNow = DateTime.UtcNow; TimeSpan timeSpan = TimeSpan.FromSeconds((double)RegistryParameters.AmDismountOrKillTimeoutInSec); try { InvokeWithTimeout.Invoke(delegate() { AmStoreHelper.RemoteDismount(null, mdbGuid, flags, retryOnConflict); }, timeSpan); } catch (TimeoutException) { flag = true; } catch (MapiPermanentException ex) { result = ex; } catch (MapiRetryableException ex2) { result = ex2; } if (flag) { AmTrace.Debug("Dismount {0} timedOut after {1}ms", new object[] { mdbGuid, timeSpan.TotalMilliseconds }); ReplayCrimsonEvents.DismountFailedOnTimeout.Log <Guid, TimeSpan>(mdbGuid, timeSpan); result = AmStoreServiceMonitor.KillStoreIfRunningBefore(utcNow, "DismountWithKillOnTimeout"); } return(result); }
// Token: 0x060001B3 RID: 435 RVA: 0x0000B1EC File Offset: 0x000093EC internal void DismountDatabaseDirect(Guid mdbGuid, UnmountFlags flags, AmDbActionCode actionCode) { AmTrace.Debug("DismountDatabaseDirect called. (Guid={0}, Flags={1}, ActionCode={2})", new object[] { mdbGuid, flags, actionCode }); Exception ex = AmStoreHelper.Dismount(mdbGuid, flags); if (ex != null) { AmTrace.Error("DismountDatabaseDirect: Store dismount RPC for ({0}) threw exception: {1}", new object[] { mdbGuid, ex }); throw ex; } AmTrace.Debug("DismountDatabaseDirect: Store dismount RPC for ({0}) completed.", new object[] { mdbGuid }); AmTrace.Debug("DismountDatabaseDirect initiating UpdateReplicationContentIndexing() asynchronously for DB '{0}'.", new object[] { mdbGuid }); ThreadPool.QueueUserWorkItem(delegate(object obj) { Exception ex2 = ReplicaInstance.UpdateReplicationContentIndexing(); if (ex2 != null) { AmTrace.Error("DismountDatabaseDirect background call of UpdateReplicationContentIndexing() failed for DB '{0}'. Exception: {1}", new object[] { (Guid)obj, ex2 }); } }, mdbGuid); }
protected abstract void DismountInternal(UnmountFlags flags);
internal bool AttemptDismount(AmServerName serverName, UnmountFlags flags, bool isIgnoreKnownExceptions, out Exception exception) { bool result = false; exception = null; bool isNodeup = true; if (this.Config.IsPamOrSam && !this.Config.DagConfig.IsNodePubliclyUp(serverName)) { isNodeup = false; } TimeSpan bestEffortDismountTimeout = this.DetermineDismountTimeout(this.ActionCode, isNodeup); this.DbTrace.Debug("Attempting dismount (server={0}, flags={1}, actionCode={2}, dismountTimeout={3}ms, ignoreException={4})", new object[] { serverName, flags, this.ActionCode, bestEffortDismountTimeout.TotalMilliseconds, isIgnoreKnownExceptions }); AmDbAction.DismountMode modeOfDismount = AmDbAction.DismountMode.None; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); bool flag = true; MountStatus mountStatus = this.State.MountStatus; try { ReplayCrimsonEvents.StoreDismountInitiated.LogGeneric(this.PrepareSubactionArgs(new object[] { serverName, flags, bestEffortDismountTimeout })); if (AmServerName.IsEqual(this.State.ActiveServer, serverName)) { this.WriteStateDismounting(false); } ExTraceGlobals.FaultInjectionTracer.TraceTest(3152424253U); exception = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1) { InvokeWithTimeout.Invoke(delegate() { if (isNodeup && AmHelper.IsReplayRunning(serverName)) { this.DbTrace.Debug("Attempting Dismount through active manager", new object[0]); modeOfDismount = AmDbAction.DismountMode.ThroughReplayService; AmDbAction.DismountDatabaseDirect(serverName, this.DatabaseGuid, flags, this.ActionCode); return; } this.DbTrace.Debug("Attempting dismount by directly RPCing to store", new object[0]); modeOfDismount = AmDbAction.DismountMode.DirectlyToStore; AmStoreHelper.RemoteDismount(serverName, this.DatabaseGuid, flags, true); }, bestEffortDismountTimeout); this.DbTrace.Debug("Database is possibly dismounted at server {0}", new object[] { serverName }); }); if (exception != null) { this.DbTrace.Debug("Dismount failed with error: {0}", new object[] { exception }); } flag = false; } finally { stopwatch.Stop(); string text = null; if (flag) { text = ReplayStrings.UnknownError; } else if (exception != null) { text = exception.Message; } if (string.IsNullOrEmpty(text)) { result = true; ReplayCrimsonEvents.StoreDismountSuccess.LogGeneric(this.PrepareSubactionArgs(new object[] { serverName, modeOfDismount, stopwatch.Elapsed })); if (AmServerName.IsEqual(this.State.ActiveServer, serverName)) { this.WriteStateDismountFinished(true, MountStatus.Dismounted, false); } } else { ReplayCrimsonEvents.StoreDismountFailed.LogGeneric(this.PrepareSubactionArgs(new object[] { serverName, modeOfDismount, stopwatch.Elapsed, text })); if (AmServerName.IsEqual(this.State.ActiveServer, serverName)) { this.WriteStateDismountFinished(true, mountStatus, false); } } } return(result); }
// Token: 0x06000498 RID: 1176 RVA: 0x000189B0 File Offset: 0x00016BB0 internal static void RemoteDismount(AmServerName serverName, Guid mdbGuid, UnmountFlags flags, bool retryOnConflict) { bool isCheckDbStatus = true; bool isMounted = true; Exception ex = null; try { AmTrace.Debug("RemoteDismount() starting for DB {0} on server {1}. UnmountFlags = {2}, retryOnConflict = {3}", new object[] { mdbGuid, serverName, flags, retryOnConflict }); ReplayCrimsonEvents.DismountStoreRpcInitiated.Log <AmServerName, Guid, UnmountFlags, bool>(serverName, mdbGuid, flags, retryOnConflict); using (IStoreMountDismount storeMountDismountInstance = Dependencies.GetStoreMountDismountInstance(AmServerName.IsNullOrEmpty(serverName) ? null : serverName.Fqdn)) { if (!retryOnConflict) { storeMountDismountInstance.UnmountDatabase(Guid.Empty, mdbGuid, (int)flags); isCheckDbStatus = false; isMounted = false; AmTrace.Info("rpcAdmin.UnmountDatabase({0}) successful.", new object[] { mdbGuid }); } else { bool flag = false; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); for (;;) { try { storeMountDismountInstance.UnmountDatabase(Guid.Empty, mdbGuid, (int)flags); isCheckDbStatus = false; isMounted = false; AmTrace.Info("rpcAdmin.UnmountDatabase({0}) successful.", new object[] { mdbGuid }); } catch (MapiRetryableException ex2) { AmTrace.Error("rpcAdmin.UnmountDatabase({0}) encountered {1}.", new object[] { mdbGuid, ex2.Message }); if (!(ex2 is MapiExceptionDismountInProgress)) { throw; } if (!flag) { ReplayCrimsonEvents.DismountDelayedUntilPreviousOperationIsComplete.Log <Guid, string>(mdbGuid, ex2.Message); flag = true; } if (stopwatch.Elapsed > AmStoreHelper.defaultMapiConflictTimeout) { throw; } if (AmHelper.SleepUntilShutdown(AmStoreHelper.defaultMapiConflictRetryInterval)) { AmTrace.Debug("shutdown requested - hence not retrying dismount for database {0}", new object[] { mdbGuid }); throw; } continue; } break; } } } } catch (MapiPermanentException ex3) { ex = ex3; AmTrace.Debug("Dismount encountered exception {0}", new object[] { ex3.Message }); if (!AmStoreHelper.IsMapiExceptionDueToDatabaseDismounted(ex3)) { throw; } } catch (MapiRetryableException ex4) { ex = ex4; AmTrace.Debug("Dismount encountered exception {0}", new object[] { ex4.Message }); if (!AmStoreHelper.IsMapiExceptionDueToDatabaseDismounted(ex4)) { throw; } } finally { ReplayCrimsonEvents.DismountStoreRpcFinished.Log <AmServerName, Guid, string>(serverName, mdbGuid, (ex != null) ? ex.Message : "<none>"); if (AmServerName.IsNullOrEmpty(serverName) || AmServerName.IsEqual(AmServerName.LocalComputerName, serverName)) { AmStoreHelper.UpdateIsMountedCounterNoDatabaseCache(mdbGuid, null, isMounted, isCheckDbStatus); } } }
internal void Move(MountFlags mountFlags, UnmountFlags dismountFlags, DatabaseMountDialOverride mountDialoverride, AmServerName fromServer, AmServerName targetServer, bool tryOtherHealthyServers, AmBcsSkipFlags skipValidationChecks, string moveComment, string componentName, ref AmDbOperationDetailedStatus moveStatus) { moveStatus = new AmDbOperationDetailedStatus(this.Database); Exception ex = null; bool flag = true; AmServerName initialSourceServer = null; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); string initialActive = string.Empty; AmDbOperationDetailedStatus tempStatus = moveStatus; try { using (AmDatabaseOperationLock.Lock(this.DatabaseGuid, AmDbLockReason.Move, null)) { ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1) { initialActive = this.GetSafeActiveServer(); ReplayCrimsonEvents.ToplevelMoveInitiated.LogGeneric(this.PrepareStartupArgs(new object[] { mountFlags, dismountFlags, mountDialoverride, AmServerName.IsNullOrEmpty(fromServer) ? initialActive : fromServer.Fqdn, targetServer, tryOtherHealthyServers, skipValidationChecks, moveComment, componentName })); initialSourceServer = this.State.ActiveServer; this.EnsureAutomaticActionIsAllowed(); this.ClearFailureAttemptIfAdminAction(this.DatabaseGuid); this.MoveInternal(mountFlags, dismountFlags, mountDialoverride, fromServer, targetServer, tryOtherHealthyServers, skipValidationChecks, componentName, ref tempStatus); }); this.WriteStateClearIfInProgressStatus(true); flag = false; } } catch (AmDbLockConflictException ex2) { ex = ex2; } finally { stopwatch.Stop(); moveStatus = tempStatus; if (flag || ex != null) { string text = (ex != null) ? ex.Message : ReplayStrings.UnknownError; ReplayCrimsonEvents.ToplevelMoveFailed.LogGeneric(this.PrepareCompletionArgs(new object[] { initialActive, stopwatch.Elapsed, text, moveComment })); if (AmServerName.IsNullOrEmpty(targetServer)) { ReplayEventLogConstants.Tuple_AmDatabaseMoveUnspecifiedServerFailed.LogEvent(null, new object[] { this.DatabaseName, initialSourceServer, text, moveComment }); } else { ReplayEventLogConstants.Tuple_AmDatabaseMoveFailed.LogEvent(null, new object[] { this.DatabaseName, initialActive, targetServer, text, moveComment }); } } else { ReplayCrimsonEvents.ToplevelMoveSuccess.LogGeneric(this.PrepareCompletionArgs(new object[] { initialActive, stopwatch.Elapsed, moveComment })); ReplayEventLogConstants.Tuple_AmDatabaseMoved.LogEvent(null, new object[] { this.DatabaseName, initialActive, moveStatus.FinalDbState.ActiveServer, moveComment }); } } if (ex != null) { throw ex; } }
protected override void MoveInternal(MountFlags storeMountFlags, UnmountFlags dismountFlags, DatabaseMountDialOverride mountDialoverride, AmServerName fromServer, AmServerName targetServer, bool tryOtherHealthyServers, AmBcsSkipFlags skipValidationChecks, string componentName, ref AmDbOperationDetailedStatus moveStatus) { AmDbNodeAttemptTable dbNodeAttemptTable = AmSystemManager.Instance.DbNodeAttemptTable; IBestCopySelector bestCopySelector = null; Exception ex = null; bool flag = false; int num = 0; int natSkippedServersCount = 0; if (!base.State.IsEntryExist) { base.DbTrace.Error("Database was never mounted. Move is applicable only if it was mounted at least once", new object[0]); throw new AmDatabaseNeverMountedException(); } if (base.State.IsAdminDismounted) { AmTrace.Diagnostic("Moving a dismounted database {0}. The database will be moved, but won't be mounted", new object[] { base.DatabaseName }); } moveStatus.InitialDbState = base.State.Copy(); AmServerName activeServer = base.State.ActiveServer; AmAcllReturnStatus amAcllReturnStatus = null; bool flag2 = true; try { this.CheckIfMoveApplicableForDatabase(base.State.ActiveServer, fromServer, base.ActionCode); bestCopySelector = this.ConstructBestCopySelector(tryOtherHealthyServers, skipValidationChecks, null, activeServer, targetServer, mountDialoverride, componentName); if (base.ActionCode.IsAutomaticShutdownSwitchover) { base.AttemptDismount(base.State.ActiveServer, dismountFlags, true, out ex); flag = true; } AmServerName amServerName = bestCopySelector.FindNextBestCopy(); while (amServerName != null) { num++; if (!flag) { base.AttemptDismount(activeServer, dismountFlags, true, out ex); flag = true; } AmMountFlags amMountFlags = AmMountFlags.None; if (BitMasker.IsOn((int)skipValidationChecks, 4)) { amMountFlags = AmMountFlags.MoveWithSkipHealth; } this.AttemptMountOnServer(amServerName, base.State.ActiveServer, storeMountFlags, amMountFlags, dismountFlags, mountDialoverride, skipValidationChecks, tryOtherHealthyServers, ref natSkippedServersCount, ref amAcllReturnStatus, out ex); base.DbTrace.Debug("AttemptMountOnServer returned AcllStatus: {0}", new object[] { amAcllReturnStatus }); moveStatus.AddSubstatus(new AmDbOperationSubStatus(amServerName, amAcllReturnStatus, ex)); if (ex == null) { flag2 = false; break; } bestCopySelector.ErrorLogger.ReportServerFailure(amServerName, "CopyHasBeenTriedCheck", ex.Message); if (ex is AmRoleChangedWhileOperationIsInProgressException) { flag2 = false; break; } if (ex is AmMountTimeoutException) { flag2 = false; break; } amServerName = bestCopySelector.FindNextBestCopy(); base.CurrentAttemptNumber++; } } finally { moveStatus.FinalDbState = base.State.Copy(); } if (flag2) { MountStatus storeDatabaseMountStatus = AmStoreHelper.GetStoreDatabaseMountStatus(base.State.ActiveServer, base.Database.Guid); if (storeDatabaseMountStatus != base.State.MountStatus) { ReplayCrimsonEvents.MismatchErrorAfterMove.Log <string, Guid, AmServerName, MountStatus, MountStatus>(base.Database.Name, base.Database.Guid, base.State.ActiveServer, base.State.MountStatus, storeDatabaseMountStatus); if (storeDatabaseMountStatus == MountStatus.Dismounted) { base.State.MountStatus = MountStatus.Dismounted; base.WriteState(); } } } this.CheckActionResultsAndUpdateAdProperties(activeServer, targetServer, bestCopySelector, ex, num, natSkippedServersCount); }
internal void Dismount(UnmountFlags flags) { Exception ex = null; bool flag = true; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); try { using (AmDatabaseOperationLock.Lock(this.DatabaseGuid, AmDbLockReason.Dismount, this.m_lockTimeout)) { ex = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1) { ReplayCrimsonEvents.ToplevelDismountInitiated.LogGeneric(this.PrepareStartupArgs(new object[] { flags })); if (!this.State.IsEntryExist) { throw new AmDatabaseNeverMountedException(); } this.ClearFailureAttemptIfAdminAction(this.DatabaseGuid); this.DismountInternal(flags); }); this.WriteStateClearIfInProgressStatus(true); flag = false; } } catch (AmDbLockConflictException ex2) { ex = ex2; } finally { stopwatch.Stop(); AmSystemManager.Instance.TransientFailoverSuppressor.AdminRequestedForRemoval(this.State.ActiveServer, "Dismount-Database"); if (flag || ex != null) { string text = (ex != null) ? ex.Message : ReplayStrings.UnknownError; ReplayCrimsonEvents.ToplevelDismountFailed.LogGeneric(this.PrepareCompletionArgs(new object[] { stopwatch.Elapsed, text })); ReplayEventLogConstants.Tuple_AmDatabaseDismountFailed.LogEvent(null, new object[] { this.DatabaseName, this.State.ActiveServer, text }); } else { ReplayCrimsonEvents.ToplevelDismountSuccess.LogGeneric(this.PrepareCompletionArgs(new object[] { stopwatch.Elapsed })); ReplayEventLogConstants.Tuple_AmDatabaseDismounted.LogEvent(null, new object[] { this.DatabaseName, this.State.ActiveServer }); } } if (ex != null) { throw ex; } }
internal static void DismountDatabaseDirect(AmServerName serverName, Guid dbGuid, UnmountFlags flags, AmDbActionCode actionCode) { AmFaultInject.GenerateMapiExceptionIfRequired(dbGuid, serverName); AmDismountArg dismountArg = new AmDismountArg((int)flags, (int)actionCode); Dependencies.AmRpcClientWrapper.DismountDatabaseDirect(serverName.Fqdn, dbGuid, dismountArg); }
private bool AttemptMountOnServer(AmServerName serverToMount, AmServerName sourceServer, MountFlags storeMountFlags, AmMountFlags amMountFlags, UnmountFlags dismountFlags, DatabaseMountDialOverride mountDialoverride, AmBcsSkipFlags skipValidationChecks, bool tryOtherHealthyServers, ref int natSkippedServersCount, ref AmAcllReturnStatus acllStatus, out Exception lastException) { bool flag = true; bool fLossyMountEnabled = false; bool isSuccess = false; bool isAcllSuccess = false; bool isMasterServerChanged = false; lastException = null; bool isSuccess2; try { acllStatus = new AmAcllReturnStatus(); AmDbNodeAttemptTable dbNodeAttemptTable = AmSystemManager.Instance.DbNodeAttemptTable; if (!base.ActionCode.IsAdminOperation && base.Config.IsIgnoreServerDebugOptionEnabled(serverToMount)) { ReplayCrimsonEvents.OperationNotPerformedDueToDebugOption.Log <string, string, string>(serverToMount.Fqdn, AmDebugOptions.IgnoreServerFromAutomaticActions.ToString(), "Mount database"); throw new AmDbOperationException("Mount not applicable for a server when debug options are enabled"); } bool flag2 = this.IsAcllRequired(serverToMount, sourceServer); if (dbNodeAttemptTable.IsOkayForAction(base.Database, serverToMount, base.ActionCode)) { if (!flag2) { acllStatus.NoLoss = true; acllStatus.MountAllowed = true; } else { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); try { ReplayCrimsonEvents.AcllInitiated.LogGeneric(base.PrepareSubactionArgs(new object[] { serverToMount, sourceServer })); AmAcllReturnStatus tempAcllStatus = null; lastException = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1) { this.RunAttemptCopyLastLogsOnServer(serverToMount, sourceServer, mountDialoverride, skipValidationChecks, 1, 15000, 15000, 15000, out fLossyMountEnabled, ref tempAcllStatus); isAcllSuccess = true; }); acllStatus = tempAcllStatus; } finally { stopwatch.Stop(); if (isAcllSuccess) { ReplayCrimsonEvents.AcllSuccess2.LogGeneric(base.PrepareSubactionArgs(new object[] { serverToMount, fLossyMountEnabled, stopwatch.Elapsed })); } else { ReplayCrimsonEvents.AcllFailed.LogGeneric(base.PrepareSubactionArgs(new object[] { serverToMount, stopwatch.Elapsed, (lastException != null) ? lastException.Message : ReplayStrings.UnknownError })); } } if (lastException == null) { if (base.State.IsAdminDismounted && !base.ActionCode.IsAdminMountOperation) { AmTrace.Debug("Skipping mount for database '{0}' on server '{1}' since it was admin dismounted.", new object[] { base.DatabaseName, serverToMount }); if (this.UpdateMaster(serverToMount, true)) { this.SendReplicaNotifications(); isMasterServerChanged = true; } isSuccess = true; flag = false; } } else { flag = false; } } if (!flag) { goto IL_45C; } isSuccess = false; lastException = null; Stopwatch stopwatch2 = new Stopwatch(); stopwatch2.Start(); try { ReplayCrimsonEvents.DirectMountInitiated.LogGeneric(base.PrepareSubactionArgs(new object[] { serverToMount, storeMountFlags, fLossyMountEnabled, amMountFlags })); lastException = AmHelper.HandleKnownExceptions(delegate(object param0, EventArgs param1) { TimeSpan mountTimeout = this.DetermineMountTimeout(skipValidationChecks); this.RunMountDatabaseDirect(serverToMount, storeMountFlags, amMountFlags, fLossyMountEnabled, mountTimeout, ref isMasterServerChanged); isSuccess = true; }); goto IL_45C; } finally { stopwatch2.Stop(); if (isSuccess) { ReplayCrimsonEvents.DirectMountSuccess.LogGeneric(base.PrepareSubactionArgs(new object[] { serverToMount, stopwatch2.Elapsed })); } else { string text = (lastException != null) ? lastException.Message : ReplayStrings.UnknownError; ReplayCrimsonEvents.DirectMountFailed.LogGeneric(base.PrepareSubactionArgs(new object[] { serverToMount, stopwatch2.Elapsed, text })); } } } natSkippedServersCount++; AmTrace.Debug("Mount for database '{0}' skipped server '{1}' since a recent mount operation on this node failed.", new object[] { base.DatabaseName, serverToMount }); lastException = new AmDbOperationAttempedTooSoonException(base.DatabaseName); ReplayCrimsonEvents.MountServerSkipped.LogGeneric(base.PrepareSubactionArgs(new object[] { serverToMount, lastException.Message })); isSuccess = false; IL_45C: isSuccess2 = isSuccess; } finally { if (!isMasterServerChanged) { AmTrace.Error("The active server for database '{0}' has not been changed, so we need to rollback the database state tracker information.", new object[] { base.DatabaseName }); AmDatabaseStateTracker databaseStateTracker = AmSystemManager.Instance.DatabaseStateTracker; if (databaseStateTracker != null) { databaseStateTracker.UpdateActive(base.DatabaseGuid, sourceServer); } } } return(isSuccess2); }
// Token: 0x060001AA RID: 426 RVA: 0x0000A74C File Offset: 0x0000894C internal List <AmDatabaseMoveResult> ServerMoveAllDatabases(AmServerName sourceServer, AmServerName targetServer, MountFlags mountFlags, UnmountFlags dismountFlags, DatabaseMountDialOverride mountDialOverride, bool tryOtherHealthyServers, AmBcsSkipFlags skipValidationChecks, AmDbActionCode actionCode, string moveComment, string componentName) { AmTrace.Debug("ServerMoveAllDatabases() called: sourceServer='{0}', targetServer='{1}', mountFlags='{2}', dismountFlags='{3}', mountDialOverride='{4}', tryOtherHealthyServers='{5}', skipValidationChecks='{6}', actionCode='{7}', MoveComment='{8}' Component='{9}'", new object[] { sourceServer, targetServer, mountFlags, dismountFlags, mountDialOverride, tryOtherHealthyServers, skipValidationChecks, actionCode, moveComment, componentName }); ActiveManagerCore.ValidatePamOrStandalone("ServerMoveAllDatabases"); ThirdPartyManager.PreventOperationWhenTPREnabled("ServerMoveAllDatabases"); AmDbMoveArguments amDbMoveArguments = new AmDbMoveArguments(actionCode); amDbMoveArguments.SourceServer = sourceServer; amDbMoveArguments.TargetServer = targetServer; amDbMoveArguments.MountFlags = mountFlags; amDbMoveArguments.DismountFlags = dismountFlags; amDbMoveArguments.MountDialOverride = mountDialOverride; amDbMoveArguments.TryOtherHealthyServers = tryOtherHealthyServers; amDbMoveArguments.SkipValidationChecks = skipValidationChecks; amDbMoveArguments.MoveComment = moveComment; amDbMoveArguments.ComponentName = componentName; if (string.IsNullOrEmpty(sourceServer.Fqdn)) { return(MoveBackToServer.Move(amDbMoveArguments)); } AmEvtMoveAllDatabasesBase amEvtMoveAllDatabasesBase; if (actionCode.IsAutomaticManagedAvailabilityFailover) { amEvtMoveAllDatabasesBase = new AmEvtMoveAllDatabasesOnComponentRequest(sourceServer); } else { amEvtMoveAllDatabasesBase = new AmEvtMoveAllDatabasesOnAdminRequest(sourceServer); } amEvtMoveAllDatabasesBase.MoveArgs = amDbMoveArguments; amEvtMoveAllDatabasesBase.Notify(); amEvtMoveAllDatabasesBase.WaitForSwitchoverComplete(); AmTrace.Debug("ServerMoveAllDatabases({0}) completed", new object[] { sourceServer }); return(amEvtMoveAllDatabasesBase.GetMoveResultsForOperationsRun()); }
protected override void DismountInternal(UnmountFlags flags) { base.DismountCommon(flags); }
protected abstract void MoveInternal(MountFlags mountFlags, UnmountFlags dismountFlags, DatabaseMountDialOverride mountDialoverride, AmServerName fromServer, AmServerName targetServer, bool tryOtherHealthyServers, AmBcsSkipFlags skipValidationChecks, string componentName, ref AmDbOperationDetailedStatus moveStatus);
// Token: 0x060002F7 RID: 759 RVA: 0x00011869 File Offset: 0x0000FA69 protected override void MoveInternal(MountFlags mountFlags, UnmountFlags dismountFlags, DatabaseMountDialOverride mountDialoverride, AmServerName fromServer, AmServerName targetServer, bool tryOtherHealthyServers, AmBcsSkipFlags skipValidationChecks, string componentName, ref AmDbOperationDetailedStatus moveStatus) { throw new AmDbMoveOperationNotSupportedStandaloneException(base.DatabaseName); }