Esempio n. 1
0
        internal static TagHandler GetInstance(FailureItemWatcher watcher, DatabaseFailureItem dbfi)
        {
            TagHandler result = null;

            switch (dbfi.Tag)
            {
            case FailureTag.NoOp:
                result = new NoOpTagHandler(watcher, dbfi);
                break;

            case FailureTag.Configuration:
                result = new ConfigurationTagHandler(watcher, dbfi);
                break;

            case FailureTag.Repairable:
                result = new RepairableTagHandler(watcher, dbfi);
                break;

            case FailureTag.Space:
                result = new SpaceTagHandler(watcher, dbfi);
                break;

            case FailureTag.IoHard:
                result = new IoHardTagHandler(watcher, dbfi);
                break;

            case FailureTag.SourceCorruption:
                result = new SourceCorruptionTagHandler(watcher, dbfi);
                break;

            case FailureTag.Corruption:
                result = new CorruptionTagHandler(watcher, dbfi);
                break;

            case FailureTag.Hard:
                result = new HardTagHandler(watcher, dbfi);
                break;

            case FailureTag.Unrecoverable:
                result = new UnrecoverableTagHandler(watcher, dbfi);
                break;

            case FailureTag.Remount:
                result = new RemountTagHandler(watcher, dbfi);
                break;

            case FailureTag.Reseed:
                result = new ReseedTagHandler(watcher, dbfi);
                break;

            case FailureTag.Performance:
                result = new PerformanceTagHandler(watcher, dbfi);
                break;

            case FailureTag.MoveLoad:
                result = new MoveLoadTagHandler(watcher, dbfi);
                break;

            case FailureTag.Memory:
                result = new MemoryTagHandler(watcher, dbfi);
                break;

            case FailureTag.CatalogReseed:
                result = new CatalogReseedTagHandler(watcher, dbfi);
                break;

            case FailureTag.AlertOnly:
                result = new AlertOnlyTagHandler(watcher, dbfi);
                break;

            case FailureTag.ExpectedDismount:
                result = new ExpectedDismountTagHandler(watcher, dbfi);
                break;

            case FailureTag.UnexpectedDismount:
                result = new UnexpectedDismountTagHandler(watcher, dbfi);
                break;

            case FailureTag.ExceededMaxDatabases:
                result = new ExceededMaxDatabasesTagHandler(watcher, dbfi);
                break;

            case FailureTag.GenericMountFailure:
                result = new GenericMountFailureTagHandler(watcher, dbfi);
                break;

            case FailureTag.PagePatchRequested:
                result = new PagePatchRequestedTagHandler(watcher, dbfi);
                break;

            case FailureTag.PagePatchCompleted:
                result = new PagePatchCompletedTagHandler(watcher, dbfi);
                break;

            case FailureTag.LostFlushDetected:
                result = new LostFlushDetectedTagHandler(watcher, dbfi);
                break;

            case FailureTag.SourceLogCorruption:
                result = new SourceLogCorruptionTagHandler(watcher, dbfi);
                break;

            case FailureTag.FailedToRepair:
                result = new FailedToRepairTagHandler(watcher, dbfi);
                break;

            case FailureTag.LostFlushDbTimeTooOld:
                result = new LostFlushDbTimeTooOldTagHandler(watcher, dbfi);
                break;

            case FailureTag.LostFlushDbTimeTooNew:
                result = new LostFlushDbTimeTooNewTagHandler(watcher, dbfi);
                break;

            case FailureTag.ExceededMaxActiveDatabases:
                result = new ExceededMaxActiveDatabasesTagHandler(watcher, dbfi);
                break;

            case FailureTag.SourceLogCorruptionOutsideRequiredRange:
                result = new SourceLogCorruptionOutsideRequiredRangeTagHandler(watcher, dbfi);
                break;

            case FailureTag.HungIoExceededThreshold:
                result = new HungIoExceededThresholdTagHandler(watcher, dbfi);
                break;

            case FailureTag.HungIoCancelSucceeded:
                result = new HungIoCancelSucceededTagHandler(watcher, dbfi);
                break;

            case FailureTag.HungIoCancelFailed:
                result = new HungIoCancelFailedTagHandler(watcher, dbfi);
                break;

            case FailureTag.RecoveryRedoLogCorruption:
                result = new RecoveryRedoLogCorruptionTagHandler(watcher, dbfi);
                break;

            case FailureTag.ReplayFailedToPagePatch:
                result = new ReplayFailedToPagePatchTagHandler(watcher, dbfi);
                break;

            case FailureTag.FileSystemCorruption:
                result = new FileSystemCorruptionTagHandler(watcher, dbfi);
                break;

            case FailureTag.HungIoLowThreshold:
                result = new HungIoLowThresholdTagHandler(watcher, dbfi);
                break;

            case FailureTag.HungIoMediumThreshold:
                result = new HungIoMediumThresholdTagHandler(watcher, dbfi);
                break;

            case FailureTag.HungIoExceededThresholdDoubleDisk:
                result = new HungIoExceededThresholdDoubleDiskTagHandler(watcher, dbfi);
                break;

            case FailureTag.HungStoreWorker:
                result = new HungStoreWorkerTagHandler(watcher, dbfi);
                break;

            case FailureTag.UnaccessibleStoreWorker:
                result = new UnaccessibleStoreWorkerTagHandler(watcher, dbfi);
                break;

            case FailureTag.MonitoredDatabaseFailed:
                result = new MonitoredDatabaseFailedTagHandler(watcher, dbfi);
                break;

            case FailureTag.LogGapFatal:
                result = new LogGapFatalTagHandler(watcher, dbfi);
                break;

            case FailureTag.ExceededDatabaseMaxSize:
                result = new ExceededDatabaseMaxSizeTagHandler(watcher, dbfi);
                break;

            case FailureTag.LowDiskSpaceStraggler:
                result = new LowDiskSpaceStragglerTagHandler(watcher, dbfi);
                break;

            case FailureTag.LockedVolume:
                result = new LockedVolumeTagHandler(watcher, dbfi);
                break;

            default:
                ExTraceGlobals.FailureItemTracer.TraceDebug <FailureTag>(0L, "[TH] Invalid failure item tag '{0}'", dbfi.Tag);
                break;
            }
            return(result);
        }
        private bool ProcessRecord(EventRecord rec)
        {
            bool          flag = false;
            int           num  = 0;
            EventRecord   suppressUntilRecord = null;
            EventBookmark bookmark            = null;
            TagHandler    tagHandler          = null;

            this.m_suppressUntilRecord = null;
            try
            {
                this.Trace("Processing Record# {0}", new object[]
                {
                    rec.RecordId
                });
                bookmark = rec.Bookmark;
                DatabaseFailureItem databaseFailureItem = DatabaseFailureItem.Parse(rec);
                if (databaseFailureItem != null)
                {
                    if (databaseFailureItem.Tag == FailureTag.Remount)
                    {
                        DatabaseFailureItem databaseFailureItem2 = FailureItemWatcher.FindMostRecentIdenticalFailureItem(databaseFailureItem, out num, out suppressUntilRecord);
                        if (num > 0)
                        {
                            this.Trace("Skipped {0} identical failure items of tag {1}", new object[]
                            {
                                num,
                                databaseFailureItem.Tag
                            });
                            databaseFailureItem = databaseFailureItem2;
                        }
                    }
                    bookmark = databaseFailureItem.Bookmark;
                    this.Trace("Starting to process failure item: {0}", new object[]
                    {
                        databaseFailureItem
                    });
                    tagHandler = TagHandler.GetInstance(this, databaseFailureItem);
                    if (tagHandler != null)
                    {
                        ExTraceGlobals.FaultInjectionTracer.TraceTest(2640719165U);
                        flag = tagHandler.Execute();
                        if (flag)
                        {
                            this.Trace("Finished processing failure item for database '{0}'", new object[]
                            {
                                this.m_database.Name
                            });
                        }
                        else
                        {
                            this.Trace("Could not process failure item for database '{0}'", new object[]
                            {
                                this.m_database.Name
                            });
                        }
                    }
                    else
                    {
                        this.Trace("Failed to process failure item since there is no handler found (failureitem:{0})", new object[]
                        {
                            databaseFailureItem
                        });
                        flag = true;
                    }
                    this.Trace("Finished processing failure item", new object[0]);
                }
            }
            catch (InvalidFailureItemException ex)
            {
                this.Trace("Ignoring the invalid failure item. (error={0}, eventxml={1})", new object[]
                {
                    ex,
                    rec.ToXml()
                });
                flag = true;
            }
            if (flag)
            {
                this.Bookmarker.Write(bookmark);
                if (num > 0)
                {
                    this.m_suppressUntilRecord = suppressUntilRecord;
                }
                if (tagHandler != null && tagHandler.PostProcessingAction != null)
                {
                    tagHandler.PostProcessingAction();
                }
            }
            return(flag);
        }