コード例 #1
0
        private void HandleReadError(FileIOonSourceException wrappedEx)
        {
            Exception innerException = wrappedEx.InnerException;
            bool      flag           = false;

            if (innerException is CorruptLogDetectedException)
            {
                flag = true;
            }
            else if (innerException is IOException)
            {
                int hresult = 0;
                if (FileOperations.IsCorruptedIOException(innerException as IOException, out hresult))
                {
                    flag = true;
                    int num;
                    FileOperations.ConvertHResultToWin32(hresult, out num);
                    ReplayEventLogConstants.Tuple_FatalIOErrorEncountered.LogEvent(this.Database.Identity, new object[]
                    {
                        this.Database.DatabaseName,
                        wrappedEx.FileFullPath,
                        innerException.Message,
                        num,
                        innerException.ToString()
                    });
                }
            }
            if (flag)
            {
                this.HandleCorruptLog(innerException);
                return;
            }
            this.HandleSourceReadError(wrappedEx);
        }
コード例 #2
0
        public Exception TrySendLogWithStandardHandling(long logGen, NetworkChannel ch)
        {
            Exception result = null;

            try
            {
                this.SendLog(logGen, ch, null);
            }
            catch (FileIOonSourceException ex)
            {
                result = ex;
                Exception innerException = ex.InnerException;
                bool      flag           = false;
                if (innerException is CorruptLogDetectedException)
                {
                    flag = true;
                }
                else if (innerException is IOException)
                {
                    int hresult = 0;
                    if (FileOperations.IsCorruptedIOException(innerException as IOException, out hresult))
                    {
                        flag = true;
                        int num;
                        FileOperations.ConvertHResultToWin32(hresult, out num);
                        ReplayEventLogConstants.Tuple_FatalIOErrorEncountered.LogEvent(this.Identity, new object[]
                        {
                            this.DatabaseName,
                            ex.FileFullPath,
                            innerException.Message,
                            num,
                            innerException.ToString()
                        });
                    }
                }
                if (flag)
                {
                    ReplayEventLogConstants.Tuple_LogCopierErrorOnSourceTriggerFailover.LogEvent(this.Identity, new object[]
                    {
                        this.DatabaseName,
                        ch.PartnerNodeName,
                        innerException.Message
                    });
                    this.ProcessSourceLogCorruption(logGen, innerException);
                }
                else
                {
                    ReplayEventLogConstants.Tuple_LogCopierErrorOnSource.LogEvent(this.Identity, new object[]
                    {
                        this.DatabaseName,
                        ch.PartnerNodeName,
                        ex.Message
                    });
                }
                ch.SendException(ex);
            }
            return(result);
        }
コード例 #3
0
        internal static bool IsFatalIOException(IOException exception, out int hresult)
        {
            bool result    = false;
            int  win32Code = 0;

            hresult = Marshal.GetHRForException(exception);
            if (FileOperations.ConvertHResultToWin32(hresult, out win32Code))
            {
                result = FileOperations.IsFatalIOErrorCode(win32Code);
            }
            return(result);
        }
コード例 #4
0
        internal static bool IsRetryableIOException(IOException exception)
        {
            bool result         = false;
            int  win32Code      = 0;
            int  hrforException = Marshal.GetHRForException(exception);

            if (FileOperations.IsVolumeLockedHResult(hrforException))
            {
                return(true);
            }
            if (FileOperations.ConvertHResultToWin32(hrforException, out win32Code))
            {
                result = FileOperations.IsRetryableIOErrorCode(win32Code);
            }
            return(result);
        }