public IExecutableCommand SummaryReportChain(ReportContextWithModel <SummaryEmailModel> context)
        {
            CommandChainCreator chain = new CommandChainCreator();

            chain.Add(commands.LoadDataAndCreateEmailModelCommand(context));
            chain.Add(commands.GenerateEmailCommand(context));
            chain.Add(commands.SendEmailCommand(context));
            return(chain.FirstCommand);
        }
Beispiel #2
0
        private IChainableCommand CreateViewStatisticsProcessingChain(LogEntryProcessingContext context)
        {
            CommandChainCreator chain = new CommandChainCreator();

            chain.Add(new ActionCommand(() => context.DatabaseCollectingConfiguration.IsEnabledGeneralCollection));
            chain.Add(statisticsProcessingCommands.EnqueueCommand());
            chain.Add(statisticsProcessingCommands.PublishTotalViewStatisticsCommand(context));
            return(chain.AsChainableCommand());
        }
        public IExecutableCommand MergeStatisticsChain(MergeTotalViewStatisticsContext context)
        {
            CommandChainCreator chain = new CommandChainCreator();

            chain.Add(commands.LoadStatisticsForMergeCommand(context));
            chain.Add(commands.MergeStatisticsCommand(context));
            chain.Add(commands.SaveMergedStatisticsCommand(context));
            return(chain.FirstCommand);
        }
        public IExecutableCommand MergeStatisticsChain(MergeNormalizedStatementRelationStatisticsContext context)
        {
            CommandChainCreator chain = new CommandChainCreator();

            chain.Add(commands.LoadStatisticsForMergeCommand(context));
            chain.Add(commands.MergeStatisticsCommand(context));
            chain.Add(commands.SaveMergedStatisticsCommand(context));
            return(chain.FirstCommand);
        }
Beispiel #5
0
        public IExecutableCommand TotalStatisticsCollectNextSampleChain(TotalStatisticsCollectNextSampleContext context)
        {
            CommandChainCreator chain = new CommandChainCreator();

            chain.Add(commands.LoadDatabasesForTotalStatisticsCommand(context));
            chain.Add(commands.CollectTotalDatabaseStatisticsCommand(context));
            chain.Add(commands.PublishTotalDatabaseStatisticsCommand(context));
            return(chain.FirstCommand);
        }
        public IChainableCommand LoadQueryPlanToContextCommand(LogEntryProcessingContext context)
        {
            LogEntryProcessingWrapperContext wrapperContext = new LogEntryProcessingWrapperContext();

            wrapperContext.InnerContext = context;
            var chain = new CommandChainCreator();

            chain.Add(new LoadDebugTreesToContextCommand(() => context.Entry.PlanTrees, () => wrapperContext.QueryPlans));
            chain.Add(new LoadQueryPlansToContextCommand(wrapperContext));
            return(chain.AsChainableCommand());
        }
Beispiel #7
0
        public IExecutableCommand LogEntryProcessingChain(LogEntryProcessingContext context)
        {
            ParallelCommandStepsCreator parallelSteps = new ParallelCommandStepsCreator();

            parallelSteps.AddParallelStep(CreateStatementProcessingChain(context));
            parallelSteps.AddParallelStep(CreateViewStatisticsProcessingChain(context));

            CommandChainCreator chain = new CommandChainCreator();

            chain.Add(generalCommands.LoadDatabaseInfoForLogEntryCommand(context));
            chain.Add(parallelSteps.CreateParallelCommand());

            return(chain.FirstCommand);
        }
Beispiel #8
0
        public IExecutableCommand LogEntryPersistenceChain()
        {
            CommandChainCreator chain = new CommandChainCreator();

            chain.Add(generalCommands.PersistDataAccumulatorsCommand());
            return(chain.FirstCommand);
        }
Beispiel #9
0
        public IExecutableCommand TotalStatisticsPersistenceChain()
        {
            CommandChainCreator chain = new CommandChainCreator();

            chain.Add(commands.PersistDataAccumulatorsCommand());
            return(chain.FirstCommand);
        }
Beispiel #10
0
        private IChainableCommand CreateStatementProcessingChain(LogEntryProcessingContext context)
        {
            CommandChainCreator chain = new CommandChainCreator();

            chain.Add(new ActionCommand(() => context.DatabaseCollectingConfiguration.IsEnabledStatementCollection));
            chain.Add(new ActionCommand(() =>
            {
                generalCommands.ExternalStatementNormalizationCommand(context).Execute();
                if (string.IsNullOrEmpty(context.StatementData.NormalizedStatement))
                {
                    externalCommands.NormalizeStatementCommand(log, context).Execute();
                }
                return(!string.IsNullOrEmpty(context.StatementData.NormalizedStatement));
            }));
            chain.Add(generalCommands.ComputeNormalizedStatementFingerprintCommand(context));
            chain.Add(generalCommands.PublishNormalizedStatementCommand(context));


            ParallelCommandStepsCreator parallelSteps = new ParallelCommandStepsCreator();

            CommandChainCreator queryTreeProcessingChain = new CommandChainCreator();

            queryTreeProcessingChain.Add(externalCommands.LoadQueryTreeToContextCommand(context));
            queryTreeProcessingChain.Add(generalCommands.PublishNormalizedStatementDefinitionCommand(context));
            parallelSteps.AddParallelStep(queryTreeProcessingChain.AsChainableCommand());

            CommandChainCreator queryPlanProcessingChain = new CommandChainCreator();

            queryPlanProcessingChain.Add(externalCommands.LoadQueryPlanToContextCommand(context));
            queryPlanProcessingChain.Add(generalCommands.PublishNormalizedStatementIndexStatisticsCommand(context));
            queryPlanProcessingChain.Add(generalCommands.PublishNormalizedStatementRelationStatisticsCommand(context));
            parallelSteps.AddParallelStep(queryPlanProcessingChain.AsChainableCommand());

            chain.Add(parallelSteps.CreateParallelCommand());
            chain.Add(generalCommands.PublishNormalizedStatementStatisticsCommand(context));
            return(chain.AsChainableCommand());
        }
Beispiel #11
0
        public IExecutableCommand WorkloadAnalysisChain(WorkloadAnalysisContext context)
        {
            CommandChainCreator chain = new CommandChainCreator();

            chain.Add(commands.UpdateAnalysisStateCommand(context, WorkloadAnalysisStateType.InProgress));
            chain.Add(commands.HandleExceptionCommand(ex => { context.WorkloadAnalysis.ErrorMessage = ex.Message;
                                                              commands.UpdateAnalysisStateCommand(context, WorkloadAnalysisStateType.EndedWithError).Execute(); }));
            chain.Add(commands.LoadWorkloadCommand(context));
            chain.Add(commands.LoadDatabaseInfoCommand(context));
            chain.Add(commands.LoadWorkloadStatementsDataCommand(context));
            chain.Add(commands.LoadWorkloadRelationsDataCommand(context));
            chain.Add(commands.ExtractStatementsQueryDataCommand(context));
            chain.Add(commands.GetRealExecutionPlansCommand(context));

            // horizontal partitioning design
            chain.Add(commands.InitializeHPartitioningEnvironmentCommand(context));
            chain.Add(commands.PrepareHPartitioningAttributeDefinitionsCommand(context));
            chain.Add(commands.GenerateBaseHPartitioningEnvironmentsCommand(context));
            chain.Add(commands.EvaluateHPartitioningEnvironmentsCommand(context));
            chain.Add(commands.CleanUpNotImprovingHPartitioningAndTheirEnvsCommand(context));
            chain.Add(commands.PersistsHPartitioningsDesignDataCommand(context));

            // indices design
            chain.Add(commands.InitializeVirtualIndicesEnvironmentCommand(context));
            chain.Add(commands.LoadExistingIndicesCommand(context));
            chain.Add(commands.GenerateBaseBtreeIndicesCommand(context));
            chain.Add(commands.ExcludeExistingIndicesCommand(context));
            chain.Add(commands.GenerateBaseIndicesEnvironmentsCommand(context));
            chain.Add(commands.EvaluateIndicesEnvironmentsCommand(context));
            chain.Add(commands.CleanUpNotImprovingIndiciesAndTheirEnvsCommand(context));
            chain.Add(commands.GenerateCoveringBTreeIndicesCommand(context));
            chain.Add(commands.GenerateFinalIndicesEnvironmentsCommand(context));
            chain.Add(commands.EvaluateIndicesEnvironmentsCommand(context));
            chain.Add(commands.CleanUpNotImprovingIndiciesAndTheirEnvsCommand(context));
            chain.Add(commands.GenerateAndEvaluateFilteredIndicesCommand(context));
            chain.Add(commands.PersistsIndicesDesignDataCommand(context));

            chain.Add(commands.PersistsRealExecutionPlansCommand(context));
            chain.Add(commands.UpdateAnalysisStateCommand(context, WorkloadAnalysisStateType.EndedSuccesfully));
            return(chain.FirstCommand);
        }