Exemplo n.º 1
0
 protected override void InternalDispose(bool disposing)
 {
     if (disposing)
     {
         FileCleanup.TryDelete(this.m_fileFullPath);
     }
     this.m_fileFullPath = null;
 }
Exemplo n.º 2
0
        public static void TryDelete(string fName)
        {
            Exception ex = FileCleanup.Delete(fName);

            if (ex != null)
            {
                ExTraceGlobals.LogCopyTracer.TraceError <Exception, string>(0L, "FileCleanup: Ignoring exception during file delete for '{1}': {0}", ex, fName);
            }
        }
Exemplo n.º 3
0
        // Token: 0x0600114B RID: 4427 RVA: 0x00046CC8 File Offset: 0x00044EC8
        private static void DeletePatchFile(string fileFullPath)
        {
            Exception ex = FileCleanup.Delete(fileFullPath);

            if (ex != null)
            {
                EseDatabasePatchFileIO.Tracer.TraceError <string, Exception>(0L, "Failed to clean up one of the patch files: {0} ; Error: {1}", fileFullPath, ex);
                throw new PagePatchFileDeletionException(fileFullPath, ex.Message, ex);
            }
        }
Exemplo n.º 4
0
        protected override void TimerCallbackInternal()
        {
            LogTruncater.Tracer.TraceDebug <string, DateTime>((long)this.GetHashCode(), "TimerCallback: {0}: Entered at {1}", this.Configuration.Name, DateTime.UtcNow);
            if (base.PrepareToStopCalled || this.m_replicaInstanceContext.Initializing || this.m_replicaInstanceContext.Resynchronizing || this.m_replicaInstanceContext.Seeding)
            {
                LogTruncater.Tracer.TraceDebug <string>((long)this.GetHashCode(), "TimerCallback: {0}: The instance is stopping or checking stage, abort this timercallback", this.Configuration.Name);
                return;
            }
            if (this.Configuration.DestinationEdbPath == null)
            {
                LogTruncater.Tracer.TraceDebug <string>((long)this.GetHashCode(), "TimerCallback: {0}: Returns since we have no database.", this.Configuration.Name);
                return;
            }
            LogTruncater.Tracer.TraceDebug((long)this.GetHashCode(), "TimerCallback: {0} : m_localReplayerGen = 0x{1:X}, m_localInspectorGen = 0x{2:X}, m_lowestGenRequiredGlobally = 0x{3:X}, m_genTruncatedLocally = 0x{4:X}.", new object[]
            {
                this.Configuration.Name,
                this.m_localReplayerGen,
                this.m_localInspectorGen,
                this.m_lowestGenRequiredGlobally,
                this.m_genTruncatedLocally
            });
            long num = this.CalculateGlobalTruncateInput();

            if (num <= 0L)
            {
                LogTruncater.Tracer.TraceDebug <string>((long)this.GetHashCode(), "TimerCallback: {0}: Exiting because inspector/replayer haven't established position yet.", this.Configuration.Name);
                return;
            }
            num = this.GetExtendedGeneration(num);
            Exception arg  = null;
            bool      flag = false;

            try
            {
                this.LogShipCall(num, false);
                long            num2            = this.CalculatePassiveTruncationPoint();
                LooseTruncation looseTruncation = new LooseTruncation();
                if (looseTruncation.Enabled && looseTruncation.SpaceIsLow(this.m_configuration))
                {
                    long num3 = looseTruncation.MinRequiredGen(this.FileChecker, this.Configuration);
                    LogTruncater.Tracer.TraceDebug <long, long>((long)this.GetHashCode(), "LooseTruncation MinRequiredGen={0} NormalLocalGen={1}", num3, num2);
                    if (num3 > num2)
                    {
                        ReplayCrimsonEvents.LooseTruncationOnPassiveBeingUsed.LogPeriodic <string, string, long, long>(this.Configuration.Identity, DiagCore.DefaultEventSuppressionInterval, this.Configuration.Identity, this.Configuration.DatabaseName, num2, num3);
                        num2 = num3;
                    }
                }
                if (num2 > this.m_genTruncatedLocally)
                {
                    long num4 = num2;
                    if (this.m_configuration.TruncationLagTime != EnhancedTimeSpan.Zero)
                    {
                        if (this.m_genTruncatedLocally == 0L)
                        {
                            num4 = this.FileChecker.FileState.LowestGenerationPresent;
                        }
                        else
                        {
                            num4 = this.m_genTruncatedLocally;
                        }
                        while (num4 < num2)
                        {
                            if (base.PrepareToStopCalled)
                            {
                                throw new OperationAbortedException();
                            }
                            DateTime fileTime = this.GetFileTime(num4);
                            if ((DateTime)ExDateTime.UtcNow - fileTime < this.m_configuration.TruncationLagTime)
                            {
                                LogTruncater.Tracer.TraceDebug <long, DateTime, string>((long)this.GetHashCode(), "TimerCallback: {2}: Log 0x{0:X} with time '{1}' protected by TruncationLag", num4, fileTime, this.Configuration.Name);
                                break;
                            }
                            num4 += 1L;
                        }
                    }
                    if (num4 != this.m_genTruncatedLocally)
                    {
                        for (long num5 = this.FileChecker.FileState.LowestGenerationPresent; num5 < num4; num5 += 1L)
                        {
                            string    text = this.Configuration.BuildFullLogfileName(num5);
                            Exception ex   = FileCleanup.Delete(text);
                            if (ex != null)
                            {
                                LogTruncater.Tracer.TraceError <string, Exception>((long)this.GetHashCode(), "Truncation failed to delete {0}: {1}", text, ex);
                                uint hrforException = (uint)Marshal.GetHRForException(ex);
                                throw new FailedToTruncateLocallyException(hrforException, ex.Message, ex);
                            }
                            if (base.PrepareToStopCalled)
                            {
                                throw new OperationAbortedException();
                            }
                        }
                        this.m_genTruncatedLocally = num4;
                        this.ProbeForLowestLogPresent();
                    }
                }
                flag = true;
            }
            catch (OperationAbortedException arg2)
            {
                flag = true;
                LogTruncater.Tracer.TraceDebug <OperationAbortedException>((long)this.GetHashCode(), "Stop detected: {0}", arg2);
            }
            catch (IOException ex2)
            {
                flag = true;
                LogTruncater.Tracer.TraceError <string, IOException>((long)this.GetHashCode(), "TimerCallback: {0}: Got an IO exception and probably the file we are going to delete doesn't exist : {1}", this.Configuration.Name, ex2);
                ReplayEventLogConstants.Tuple_LogTruncationLocalFailure.LogEvent(null, new object[]
                {
                    this.Configuration.DisplayName,
                    ex2.Message
                });
            }
            catch (FailedToOpenLogTruncContextException ex3)
            {
                arg = ex3;
                ReplayEventLogConstants.Tuple_LogTruncationOpenFailed.LogEvent(this.Configuration.Identity, new object[]
                {
                    this.Configuration.DisplayName,
                    ex3.Hresult,
                    ex3.Message
                });
            }
            catch (CopyUnknownToActiveLogTruncationException ex4)
            {
                arg = ex4;
                ReplayEventLogConstants.Tuple_LogTruncationOpenFailed.LogEvent(this.Configuration.Identity, new object[]
                {
                    this.Configuration.DisplayName,
                    ex4.Hresult,
                    ex4.Message
                });
            }
            catch (FailedToNotifySourceLogTruncException ex5)
            {
                arg = ex5;
                ReplayEventLogConstants.Tuple_LogTruncationSourceFailure.LogEvent(null, new object[]
                {
                    this.Configuration.DisplayName,
                    ex5.Message
                });
            }
            catch (FailedToTruncateLocallyException ex6)
            {
                arg = ex6;
                ReplayEventLogConstants.Tuple_LogTruncationLocalFailure.LogEvent(this.Configuration.DisplayName, new object[]
                {
                    this.Configuration.DisplayName,
                    ex6.Message
                });
                FailureTag failureTag = FailureTag.NoOp;
                uint       hresult    = ex6.Hresult;
                if (hresult == 3355444222U)
                {
                    failureTag = FailureTag.IoHard;
                }
                if (failureTag != FailureTag.NoOp)
                {
                    FailureItemPublisherHelper.PublishAction(failureTag, this.m_configuration.IdentityGuid, this.m_configuration.DatabaseName);
                }
            }
            finally
            {
                if (!flag)
                {
                    LogTruncater.Tracer.TraceError <string, Exception>((long)this.GetHashCode(), "TimerCallback: {0}: Esebcli2 call failed, or unhandled exception occurred. Disposing m_logShipContext... Exception: {1}", this.Configuration.Name, arg);
                    if (this.m_logShipContext != null)
                    {
                        this.m_logShipContext.Dispose();
                        this.m_logShipContext = null;
                    }
                    LogTruncater.Tracer.TraceDebug <string>((long)this.GetHashCode(), "TimerCallback: {0}: m_logShipContext disposed.", this.Configuration.Name);
                }
            }
            this.m_perfmonCounters.TruncatedGenerationNumber = this.m_genTruncatedLocally;
        }