Esempio n. 1
0
        internal static void WaitUntilDatabaseIsNotMounted(IADDatabase database, int seconds)
        {
            bool flag = true;

            DatabaseTasks.Trace("Waiting for database {0} to reach dismounted/dismounting state for {1} seconds", new object[]
            {
                database.Name,
                seconds
            });
            for (int i = 0; i < seconds; i++)
            {
                if (!AmStoreHelper.IsMounted(null, database.Guid))
                {
                    flag = false;
                    break;
                }
                Thread.Sleep(1000);
            }
            if (flag)
            {
                DatabaseTasks.Trace("Database is still mounted {0} after {1} seconds", new object[]
                {
                    database.Name,
                    seconds
                });
            }
        }
Esempio n. 2
0
        internal static Exception ResumeLocalDatabaseCopy(IADDatabase database)
        {
            string    localMachineFqdn = DatabaseTasks.LocalMachineFqdn;
            Exception ex = null;

            try
            {
                DatabaseCopyActionFlags flags = DatabaseCopyActionFlags.Replication | DatabaseCopyActionFlags.Activation;
                Dependencies.ReplayRpcClientWrapper.RequestResume2(localMachineFqdn, database.Guid, (uint)flags);
            }
            catch (TaskServerException ex2)
            {
                ex = ex2;
            }
            catch (TaskServerTransientException ex3)
            {
                ex = ex3;
            }
            if (ex != null)
            {
                DatabaseTasks.Trace("ResumeLocalDatabaseCopy(): Failed with exception: {0}", new object[]
                {
                    ex
                });
                return(ex);
            }
            return(null);
        }
Esempio n. 3
0
        internal static void Remount(IADDatabase database, string from)
        {
            Exception ex = null;

            DatabaseTasks.Trace("Database '{0}' is attempting to remount on '{1}'", new object[]
            {
                database.Name,
                from
            });
            try
            {
                DatabaseTasks.WaitUntilDatabaseIsNotMounted(database, 5);
                AmRpcClientHelper.RemountDatabase(database, 0, -1, from);
            }
            catch (AmServerException ex2)
            {
                DatabaseTasks.Trace("RemountDatabase() failed with {0}", new object[]
                {
                    ex2
                });
                ex = ex2;
            }
            catch (AmServerTransientException ex3)
            {
                DatabaseTasks.Trace("RemountDatabase() failed with {0}", new object[]
                {
                    ex3
                });
                ex = ex3;
            }
            if (ex != null)
            {
                throw new DatabaseRemountFailedException(database.Name, ex.ToString(), ex);
            }
        }
Esempio n. 4
0
 // Token: 0x0600107A RID: 4218 RVA: 0x00045C69 File Offset: 0x00043E69
 internal override void ActiveRecoveryActionInternal()
 {
     if (!AmStoreHelper.IsMountedLocally(base.Database.Guid))
     {
         DatabaseTasks.Move(base.Database, Environment.MachineName);
         return;
     }
     this.m_moveWasSkipped = true;
     base.Trace("Skipping failover since the database is already mounted", new object[0]);
 }
Esempio n. 5
0
        protected void SuspendLocalCopy()
        {
            if (ThirdPartyManager.IsThirdPartyReplicationEnabled)
            {
                return;
            }
            string suspendMsg = ReplayStrings.TagHandlerSuspendCopy(this.FormatSuccessActionMessage());

            DatabaseTasks.SuspendLocalDatabaseCopy(this.Database, suspendMsg);
        }
Esempio n. 6
0
        internal static void SuspendLocalDatabaseCopy(IADDatabase database, string suspendMsg)
        {
            string    serverNameFqdn = DatabaseTasks.LocalMachineFqdn;
            Exception ex             = null;

            try
            {
                Action invokableAction = delegate()
                {
                    DatabaseCopyActionFlags flags = DatabaseCopyActionFlags.Replication | DatabaseCopyActionFlags.Activation;
                    Dependencies.ReplayRpcClientWrapper.RequestSuspend3(serverNameFqdn, database.Guid, suspendMsg, (uint)flags, 1U);
                };
                InvokeWithTimeout.Invoke(invokableAction, TimeSpan.FromSeconds((double)RegistryParameters.FailureItemLocalDatabaseOperationTimeoutInSec));
            }
            catch (ReplayServiceSuspendCommentException ex2)
            {
                DatabaseTasks.Trace("SuspendLocalDatabaseCopy(): Catching and ignoring exception: {0}", new object[]
                {
                    ex2
                });
            }
            catch (TimeoutException ex3)
            {
                DatabaseTasks.Trace("SuspendLocalDatabaseCopy(): Failed on timeout: {0}", new object[]
                {
                    ex3
                });
                ex = ex3;
            }
            catch (TaskServerException ex4)
            {
                ex = ex4;
            }
            catch (TaskServerTransientException ex5)
            {
                ex = ex5;
            }
            if (ex != null)
            {
                DatabaseTasks.Trace("SuspendLocalDatabaseCopy(): Failed with exception: {0}", new object[]
                {
                    ex
                });
                throw new DatabaseCopySuspendException(database.Name, Environment.MachineName, ex.ToString(), ex);
            }
        }
Esempio n. 7
0
        protected Exception SuspendAndFailLocalCopyNoThrow(bool blockResume = false, bool blockReseed = false, bool blockInPlaceReseed = false)
        {
            if (ThirdPartyManager.IsThirdPartyReplicationEnabled)
            {
                return(null);
            }
            string    text = this.FormatSuccessActionMessage();
            uint      successActionMessageId = this.GetSuccessActionMessageId();
            string    suspendMsg             = ReplayStrings.TagHandlerSuspendCopy(text);
            Exception ex = DatabaseTasks.SuspendAndFailLocalDatabaseCopy(this.Database, suspendMsg, text, successActionMessageId, blockResume, blockReseed, blockInPlaceReseed);

            if (ex != null)
            {
                ReplayCrimsonEvents.FailureItemProcessingErrorDuringSuspend.Log <IADDatabase, string>(this.Database, ex.Message);
            }
            return(ex);
        }
        // Token: 0x0600103D RID: 4157 RVA: 0x000459A4 File Offset: 0x00043BA4
        internal override void ActiveRecoveryActionInternal()
        {
            Exception ex = null;

            try
            {
                base.SuspendAndFailLocalCopyNoThrow(false, false, false);
            }
            finally
            {
                ex = DatabaseTasks.TryToDismountClean(base.Database);
            }
            if (ex != null)
            {
                ReplayCrimsonEvents.UnrecoverableDismountCleanFailure.Log <IADDatabase, string>(base.Database, ex.Message);
                throw new FailureItemRecoveryException(base.Database.Name, ex.ToString(), ex);
            }
        }
Esempio n. 9
0
        internal static Exception SuspendAndFailLocalDatabaseCopy(IADDatabase database, string suspendMsg, string errorMsg, uint errorEventId, bool blockResume, bool blockReseed, bool blockInPlaceReseed)
        {
            Exception ex = null;

            try
            {
                Action invokableAction = delegate()
                {
                    ReplicaInstanceManager replicaInstanceManager = Dependencies.ReplayCoreManager.ReplicaInstanceManager;
                    replicaInstanceManager.RequestSuspendAndFail(database.Guid, errorEventId, errorMsg, suspendMsg, true, blockResume, blockReseed, blockInPlaceReseed);
                };
                InvokeWithTimeout.Invoke(invokableAction, TimeSpan.FromSeconds((double)RegistryParameters.FailureItemLocalDatabaseOperationTimeoutInSec));
            }
            catch (TimeoutException ex2)
            {
                DatabaseTasks.Trace("SuspendLocalDatabaseCopy(): Failed on timeout: {0}", new object[]
                {
                    ex2
                });
                ex = ex2;
            }
            catch (TaskServerException ex3)
            {
                ex = ex3;
            }
            catch (TaskServerTransientException ex4)
            {
                ex = ex4;
            }
            if (ex != null)
            {
                DatabaseTasks.Trace("SuspendAndFailLocalDatabaseCopy failed to suspend: {0}", new object[]
                {
                    ex
                });
                return(new DatabaseCopySuspendException(database.Name, Environment.MachineName, ex.ToString(), ex));
            }
            return(null);
        }
Esempio n. 10
0
        internal static void Move(IADDatabase database, string from, AmDbActionCode actionCode, DatabaseMountDialOverride mountDialOverride)
        {
            Exception            ex = null;
            AmDatabaseMoveResult amDatabaseMoveResult = null;

            DatabaseTasks.Trace("Database '{0}' moved from '{1}'", new object[]
            {
                database.Name,
                from
            });
            try
            {
                string text;
                AmRpcClientHelper.MoveDatabaseEx(database, 0, 16, (int)mountDialOverride, from, null, true, 0, actionCode, null, out text, ref amDatabaseMoveResult);
            }
            catch (AmServerException ex2)
            {
                DatabaseTasks.Trace("MoveDatabase() failed with {0}; Exception: {1}", new object[]
                {
                    amDatabaseMoveResult,
                    ex2
                });
                ex = ex2;
            }
            catch (AmServerTransientException ex3)
            {
                DatabaseTasks.Trace("MoveDatabase() failed with {0}; Exception: {1}", new object[]
                {
                    amDatabaseMoveResult,
                    ex3
                });
                ex = ex3;
            }
            if (ex != null)
            {
                throw new DatabaseFailoverFailedException(database.Name, ex.ToString(), ex);
            }
        }
 internal override void ActiveRecoveryActionInternal()
 {
     DatabaseTasks.Move(base.Database, Environment.MachineName);
 }
Esempio n. 12
0
        internal static void HandleSourceLogCorruption(IADDatabase database, string from)
        {
            Exception            ex = null;
            AmDatabaseMoveResult amDatabaseMoveResult = null;

            DatabaseTasks.Trace("HandleSourceLogCorruption for Database '{0}' from '{1}'", new object[]
            {
                database.Name,
                from
            });
            ReplayEventLogConstants.Tuple_CorruptLogRecoveryIsAttempted.LogEvent(null, new object[]
            {
                database.Name
            });
            try
            {
                AmDbActionCode actionCode = new AmDbActionCode(AmDbActionInitiator.Automatic, AmDbActionReason.FailureItem, AmDbActionCategory.Move);
                string         text;
                AmRpcClientHelper.MoveDatabaseEx(database, 0, 0, RegistryParameters.MaxAutoDatabaseMountDial, from, null, true, 0, actionCode, "HandleSourceLogCorruption", out text, ref amDatabaseMoveResult);
            }
            catch (AmServerException ex2)
            {
                ex = ex2;
            }
            catch (AmServerTransientException ex3)
            {
                ex = ex3;
            }
            if (ex != null)
            {
                DatabaseTasks.Tracer.TraceError <Exception>(0L, "HandleSourceLogCorruption: Move failed: {0}", ex);
            }
            bool      flag = false;
            Exception ex4  = null;

            try
            {
                string text2;
                ActiveManagerCore.GetDatabaseMountStatus(database.Guid, out text2);
                if (!string.IsNullOrEmpty(text2) && !Cluster.StringIEquals(text2, Dependencies.ManagementClassHelper.LocalMachineName))
                {
                    flag = true;
                }
            }
            catch (ClusterException ex5)
            {
                ex4 = ex5;
            }
            catch (AmServerException ex6)
            {
                ex4 = ex6;
            }
            if (ex4 != null)
            {
                DatabaseTasks.Tracer.TraceError <Exception>(0L, "HandleSourceLogCorruption: Determine active failed: {0}", ex4);
                if (ex == null)
                {
                    ex = ex4;
                }
            }
            if (flag)
            {
                Exception ex7 = DatabaseTasks.ResumeLocalDatabaseCopy(database);
                if (ex7 != null)
                {
                    DatabaseTasks.Tracer.TraceError <Exception>(0L, "HandleSourceLogCorruption: Resume failed: {0}", ex7);
                    ReplayEventLogConstants.Tuple_ResumeFailedDuringFailureItemProcessing.LogEvent(database.Name, new object[]
                    {
                        database.Name,
                        ex7.Message
                    });
                }
            }
            if (ex != null)
            {
                throw new DatabaseLogCorruptRecoveryException(database.Name, ex.ToString(), ex);
            }
        }
Esempio n. 13
0
        internal static void Move(IADDatabase database, string from)
        {
            AmDbActionCode actionCode = new AmDbActionCode(AmDbActionInitiator.Automatic, AmDbActionReason.FailureItem, AmDbActionCategory.Move);

            DatabaseTasks.Move(database, from, actionCode, DatabaseMountDialOverride.None);
        }
 internal override void ActiveRecoveryActionInternal()
 {
     DatabaseTasks.InitiateMoveForCatalog(base.Database, Environment.MachineName);
 }
 // Token: 0x060010AA RID: 4266 RVA: 0x00045E57 File Offset: 0x00044057
 internal override void ActiveRecoveryActionInternal()
 {
     DatabaseTasks.HandleSourceLogCorruption(base.Database, Environment.MachineName);
 }
Esempio n. 16
0
 // Token: 0x06001107 RID: 4359 RVA: 0x000462EF File Offset: 0x000444EF
 internal override void ActiveRecoveryActionInternal()
 {
     LogRepair.EnableLogRepair(base.Database.Guid);
     DatabaseTasks.Move(base.Database, Environment.MachineName);
 }
Esempio n. 17
0
 protected void MoveAfterSuspendAndFailLocalCopy(bool blockResume = false, bool blockReseed = false, bool blockInPlaceReseed = false)
 {
     this.SuspendAndFailLocalCopyNoThrow(blockResume, blockReseed, blockInPlaceReseed);
     DatabaseTasks.Move(this.Database, Environment.MachineName);
 }