private void HandleMountTimeout(AmServerName serverThatFailedToMount, AmMountTimeoutException timeoutException) { ReplayCrimsonEvents.MountTimeout.Log <string, Guid, string, string>(base.DatabaseName, base.DatabaseGuid, serverThatFailedToMount.Fqdn, timeoutException.Message); AmDbActionCode actionCode = new AmDbActionCode(AmDbActionInitiator.Automatic, AmDbActionReason.TimeoutFailure, AmDbActionCategory.Move); AmDbMoveOperation amDbMoveOperation = new AmDbMoveOperation(base.Database, actionCode); AmDbMoveArguments arguments = amDbMoveOperation.Arguments; arguments.MountDialOverride = DatabaseMountDialOverride.None; arguments.MoveComment = timeoutException.Message; arguments.SourceServer = serverThatFailedToMount; amDbMoveOperation.Arguments = arguments; amDbMoveOperation.Enqueue(); }
private void RunMountDatabaseDirect(AmServerName serverToMount, MountFlags storeMountFlags, AmMountFlags amMountFlags, bool fLossyMountEnabled, TimeSpan mountTimeout, ref bool isMasterChanged) { bool flag = false; bool flag2 = false; isMasterChanged = false; AmDbNodeAttemptTable dbNodeAttemptTable = AmSystemManager.Instance.DbNodeAttemptTable; AmServerName activeServer = base.State.ActiveServer; try { isMasterChanged = this.UpdateMaster(serverToMount, false); base.ReportStatus(AmDbActionStatus.StoreMountInitiated); if (fLossyMountEnabled) { storeMountFlags |= MountFlags.AllowDatabasePatch; } ExTraceGlobals.FaultInjectionTracer.TraceTest(2229677373U); try { InvokeWithTimeout.Invoke(delegate() { AmDbAction.MountDatabaseDirect(serverToMount, this.State.LastMountedServer, this.DatabaseGuid, storeMountFlags, amMountFlags, this.ActionCode); ExTraceGlobals.FaultInjectionTracer.TraceTest(2441489725U); }, mountTimeout); } catch (TimeoutException ex) { base.DbTrace.Error("Mount timeout on {0}: {1}", new object[] { base.DatabaseName, ex }); AmMountTimeoutException ex2 = new AmMountTimeoutException(base.DatabaseName, serverToMount.NetbiosName, (int)mountTimeout.TotalSeconds, ex); this.HandleMountTimeout(serverToMount, ex2); throw ex2; } flag = true; dbNodeAttemptTable.ClearFailedTime(base.DatabaseGuid); try { base.WriteStateMountSuccess(); } catch (AmRoleChangedWhileOperationIsInProgressException ex3) { base.DbTrace.Warning("Mount AmRoleChanged exception (error={0})", new object[] { ex3 }); } base.ReportStatus(AmDbActionStatus.StoreMountSuccessful); } catch (TransientException ex4) { base.DbTrace.Error("Mount transient exception (error={0})", new object[] { ex4 }); flag2 = true; throw; } catch (AmReplayServiceDownException ex5) { base.DbTrace.Error("Mount transient RPC exception (error={0})", new object[] { ex5 }); flag2 = true; throw; } finally { if (flag) { SharedDependencies.WritableADHelper.ResetAllowFileRestoreDsFlag(base.DatabaseGuid, activeServer, serverToMount); } else { base.WriteStateMountFailed(true); if (base.ActionCode.IsAutomaticFailureItem && !flag2) { dbNodeAttemptTable.MarkFailedTime(base.DatabaseGuid, serverToMount, base.ActionCode); } base.ReportStatus(AmDbActionStatus.StoreMountFailed); } if (isMasterChanged && AmSystemManager.Instance.Config.IsPAM) { this.SendReplicaNotifications(); } } }