// Token: 0x0600008B RID: 139 RVA: 0x000046B4 File Offset: 0x000028B4
        private void MoveDatabasesNormally(AmDbActionCode actionCode, IADDatabase[] dbList)
        {
            AmDbNodeAttemptTable dbNodeAttemptTable = AmSystemManager.Instance.DbNodeAttemptTable;
            LocalizedString      reason             = LocalizedString.Empty;

            foreach (IADDatabase iaddatabase in dbList)
            {
                if (iaddatabase.ReplicationType == ReplicationType.Remote && this.IsActiveOnServer(iaddatabase, this.m_nodeName, out reason))
                {
                    dbNodeAttemptTable.ClearFailedTime(iaddatabase.Guid);
                    AmDbMoveOperation amDbMoveOperation = new AmDbMoveOperation(iaddatabase, actionCode);
                    amDbMoveOperation.Arguments.SourceServer = this.m_nodeName;
                    AmDbMoveArguments arguments = amDbMoveOperation.Arguments;
                    this.PrepareMoveArguments(ref arguments);
                    amDbMoveOperation.Arguments = arguments;
                    this.m_moveRequests++;
                    base.EnqueueDatabaseOperation(amDbMoveOperation);
                }
                else
                {
                    if (iaddatabase.ReplicationType != ReplicationType.Remote)
                    {
                        reason = ReplayStrings.AmDbMoveOperationNotSupportedException(iaddatabase.Name);
                    }
                    AmDbSkippedMoveOperation operation = new AmDbSkippedMoveOperation(iaddatabase, reason);
                    this.m_moveRequests++;
                    base.EnqueueDatabaseOperation(operation);
                }
            }
            base.StartDatabaseOperations();
        }
예제 #2
0
        protected override void MountInternal(MountFlags storeMountFlags, AmMountFlags amMountFlags, DatabaseMountDialOverride mountDialOverride, ref AmDbOperationDetailedStatus mountStatus)
        {
            Exception ex = null;
            int       natSkippedServersCount = 0;
            int       num  = 0;
            bool      flag = true;

            if (ThirdPartyManager.IsThirdPartyReplicationEnabled)
            {
                flag = false;
            }
            if (base.ActionCode.IsAdminOperation)
            {
                if (base.State.IsActiveServerValid)
                {
                    flag = false;
                }
                else
                {
                    AmTrace.Debug("Mount issued for the first time on this database. We will try all the available servers. (db={0})", new object[]
                    {
                        base.DatabaseName
                    });
                }
            }
            AmServerName amServerName = base.State.ActiveServer;

            if (AmServerName.IsNullOrEmpty(amServerName))
            {
                amServerName = new AmServerName(base.Database.Server.Name);
            }
            AmBcsSkipFlags skipValidationChecks = AmBcsSkipFlags.SkipAll;

            if (flag)
            {
                skipValidationChecks = AmBcsSkipFlags.None;
            }
            IBestCopySelector    bestCopySelector   = this.ConstructBestCopySelector(flag, skipValidationChecks, null, amServerName, amServerName, mountDialOverride, null);
            AmDbNodeAttemptTable dbNodeAttemptTable = AmSystemManager.Instance.DbNodeAttemptTable;

            if (base.ActionCode.IsAdminOperation)
            {
                dbNodeAttemptTable.ClearFailedTime(base.DatabaseGuid);
            }
            AmServerName       sourceServer       = amServerName;
            AmAcllReturnStatus amAcllReturnStatus = null;
            AmServerName       amServerName2      = bestCopySelector.FindNextBestCopy();

            while (amServerName2 != null)
            {
                num++;
                base.DbTrace.Debug("Attempting mount on server {0}", new object[]
                {
                    amServerName2
                });
                this.AttemptMountOnServer(amServerName2, sourceServer, storeMountFlags, amMountFlags, UnmountFlags.SkipCacheFlush, mountDialOverride, AmBcsSkipFlags.None, flag, ref natSkippedServersCount, ref amAcllReturnStatus, out ex);
                base.DbTrace.Debug("AttemptMountOnServer returned AcllStatus: {0}", new object[]
                {
                    amAcllReturnStatus
                });
                sourceServer = base.State.ActiveServer;
                if (ex == null)
                {
                    break;
                }
                bestCopySelector.ErrorLogger.ReportServerFailure(amServerName2, "CopyHasBeenTriedCheck", ex.Message);
                if (ex is AmRoleChangedWhileOperationIsInProgressException || ex is AmMountTimeoutException)
                {
                    break;
                }
                amServerName2 = bestCopySelector.FindNextBestCopy();
                base.CurrentAttemptNumber++;
            }
            this.CheckActionResultsAndUpdateAdProperties(amServerName, null, bestCopySelector, ex, num, natSkippedServersCount);
        }
예제 #3
0
        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();
                }
            }
        }