コード例 #1
0
        internal static bool IsVolumeLockedException(IOException exception)
        {
            int hrforException = Marshal.GetHRForException(exception);

            return(FileOperations.IsVolumeLockedHResult(hrforException));
        }
コード例 #2
0
        internal static bool Win32ErrorCodeToIOFailureTag(int win32code, FailureTag defaultFailureTag, out FailureTag failureTag)
        {
            failureTag = FailureTag.NoOp;
            if (win32code <= 80)
            {
                switch (win32code)
                {
                case 0:
                case 2:
                    break;

                case 1:
                case 4:
                    goto IL_77;

                case 3:
                case 5:
                    failureTag = FailureTag.Configuration;
                    return(true);

                default:
                    switch (win32code)
                    {
                    case 38:
                        break;

                    case 39:
                        goto IL_72;

                    default:
                        if (win32code != 80)
                        {
                            goto IL_77;
                        }
                        break;
                    }
                    break;
                }
            }
            else if (win32code <= 112)
            {
                if (win32code != 87)
                {
                    if (win32code != 112)
                    {
                        goto IL_77;
                    }
                    goto IL_72;
                }
            }
            else if (win32code != 183)
            {
                if (win32code != 206)
                {
                    goto IL_77;
                }
                failureTag = FailureTag.Unrecoverable;
                return(true);
            }
            failureTag = FailureTag.NoOp;
            return(true);

IL_72:
            failureTag = FailureTag.Space;
            return(true);

IL_77:
            if (FileOperations.IsRetryableIOErrorCode(win32code))
            {
                failureTag = FailureTag.NoOp;
                return(true);
            }
            if (FileOperations.IsFatalIOErrorCode(win32code))
            {
                failureTag = FailureTag.IoHard;
                return(true);
            }
            failureTag = defaultFailureTag;
            return(false);
        }
コード例 #3
0
        // Token: 0x06000A21 RID: 2593 RVA: 0x0002F2C0 File Offset: 0x0002D4C0
        public static void MoveLogFiles(ReplayConfiguration config, FileState fileState, ISetBroken setBroken, long corruptLogGen)
        {
            string    text = Path.Combine(config.E00LogBackupPath, "SkippedLogs");
            Exception ex   = DirectoryOperations.TryCreateDirectory(text);

            if (ex != null)
            {
                setBroken.SetBroken(FailureTag.Configuration, ReplayEventLogConstants.Tuple_FailedToCreateDirectory, ex, new string[]
                {
                    text,
                    ex.ToString()
                });
                return;
            }
            string currentDateString = FileOperations.GetCurrentDateString();
            string text2             = Path.Combine(text, currentDateString);

            ex = DirectoryOperations.TryCreateDirectory(text2);
            if (ex != null)
            {
                setBroken.SetBroken(FailureTag.Configuration, ReplayEventLogConstants.Tuple_FailedToCreateDirectory, ex, new string[]
                {
                    text2,
                    ex.ToString()
                });
                return;
            }
            string destinationLogPath = config.DestinationLogPath;
            string text3 = string.Empty;
            string path  = string.Empty;

            try
            {
                ReplayEventLogConstants.Tuple_MovingFilesToRestartLogStream.LogEvent(null, new object[]
                {
                    config.DatabaseName,
                    EseHelper.MakeLogfileName(config.LogFilePrefix, config.LogFileSuffix, corruptLogGen),
                    text2
                });
                foreach (string text4 in Directory.GetFiles(destinationLogPath, "*." + config.LogExtension))
                {
                    text3 = text4;
                    path  = Path.GetFileName(text4);
                    long logfileGenerationFromFilePath = EseHelper.GetLogfileGenerationFromFilePath(text4, config.LogFilePrefix);
                    if (logfileGenerationFromFilePath >= fileState.LowestGenerationRequired)
                    {
                        ExTraceGlobals.ReplicaInstanceTracer.TraceError <string>(0L, "MoveLogFiles(): Cannot move logfile '{0}' because it is required by the database.", text4);
                    }
                    else
                    {
                        File.Move(text4, Path.Combine(text2, path));
                    }
                }
                foreach (string text5 in Directory.GetFiles(destinationLogPath, "*.jsl"))
                {
                    text3 = text5;
                    path  = Path.GetFileName(text5);
                    File.Move(text5, Path.Combine(text2, path));
                }
                ExTraceGlobals.ReplicaInstanceTracer.TraceError <string>(0L, "Moved log files successfully from '{0}'", config.DestinationLogPath);
            }
            catch (IOException ex2)
            {
                ExTraceGlobals.ReplicaInstanceTracer.TraceError <string, string, IOException>(0L, "Moving file '{0}' to '{1}' failed with exception: {2}", text3, text2, ex2);
                setBroken.SetBroken(ReplicaInstance.IOExceptionToFailureTag(ex2), ReplayEventLogConstants.Tuple_CouldNotDeleteLogFile, ex2, new string[]
                {
                    text3,
                    ex2.ToString()
                });
            }
            catch (UnauthorizedAccessException ex3)
            {
                ExTraceGlobals.ReplicaInstanceTracer.TraceError <string, string, UnauthorizedAccessException>(0L, "Moving file '{0}' to '{1}' failed with exception: {2}", text3, text2, ex3);
                setBroken.SetBroken(FailureTag.AlertOnly, ReplayEventLogConstants.Tuple_CouldNotDeleteLogFile, ex3, new string[]
                {
                    text3,
                    ex3.ToString()
                });
            }
        }