// 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);
        }
Пример #2
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);
        }
Пример #3
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);
        }
Пример #4
0
        private void CheckActionResultsAndUpdateAdProperties(AmServerName initialSourceServer, AmServerName targetServer, IBestCopySelector bcs, Exception lastException, int countServersTried, int natSkippedServersCount)
        {
            Exception lastException2 = bcs.LastException;

            if (countServersTried == 0)
            {
                lastException = lastException2;
            }
            else if (lastException == null && natSkippedServersCount == countServersTried)
            {
                AmTrace.Diagnostic("{0} for database {1} was not attempted in any of the servers in the DAG since all the servers in the DAG recently unsuccessful in performing the failover action.", new object[]
                {
                    base.ActionCode,
                    base.DatabaseName
                });
                lastException = new AmDbOperationAttempedTooSoonException(base.DatabaseName);
            }
            else if (bcs.BestCopySelectionType == AmBcsType.BestCopySelection && lastException != null && lastException2 != null)
            {
                lastException = lastException2;
            }
            this.UpdateAdProperties(lastException == null, initialSourceServer);
            AmHelper.ThrowDbActionWrapperExceptionIfNecessary(lastException);
        }