private void DismountForSourceLogCorruption(Exception corruptionEx)
 {
     ReplayEventLogConstants.Tuple_CorruptLogRecoveryIsImmediatelyAttempted.LogEvent(null, new object[]
     {
         this.DatabaseCopyName,
         corruptionEx.Message
     });
     try
     {
         ReplicaInstanceManager replicaInstanceManager = Dependencies.ReplayCoreManager.ReplicaInstanceManager;
         int    num;
         string text = ReplayEventLogConstants.Tuple_CorruptLogRecoveryIsImmediatelyAttempted.EventLogToString(out num, new object[]
         {
             this.DatabaseCopyName,
             corruptionEx.Message
         });
         uint eventViewerEventId = DiagCore.GetEventViewerEventId(ReplayEventLogConstants.Tuple_CorruptLogRecoveryIsImmediatelyAttempted);
         replicaInstanceManager.RequestSuspendAndFail(this.DatabaseGuid, eventViewerEventId, text, text, false, false, false, false);
         MonitoredDatabase.Tracer.TraceDebug((long)this.GetHashCode(), "DismountForSourceLogCorruption successfully suspended");
     }
     catch (TaskServerException ex)
     {
         MonitoredDatabase.Tracer.TraceError <TaskServerException>((long)this.GetHashCode(), "DismountForSourceLogCorruption failed to suspend: {0}", ex);
         ReplayEventLogConstants.Tuple_CorruptLogRecoveryFailedToSuspend.LogEvent(null, new object[]
         {
             this.DatabaseName,
             ex.Message
         });
     }
     finally
     {
         Exception ex2 = this.TryToDismountClean();
         if (ex2 != null)
         {
             ReplayEventLogConstants.Tuple_CorruptLogRecoveryFailedToDismount.LogEvent(null, new object[]
             {
                 this.DatabaseName,
                 ex2.Message
             });
         }
     }
 }
Example #2
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);
        }