Esempio n. 1
0
        private IReadOnlyList <SourceTimetableData> CheckPreconditions()
        {
            _log.DebugFormat(
                "Checking preconditions in Admin database: {0}",
                DatabaseUtils.GetConnectionDescription(AdminConnectionString));

            // check existence and validity of the source timetables...
            var srcTimetableRecords = SourceValidityCheck.Execute(
                TimetableConnectionStrings,
                Timeouts.SourceTimetables,
                _configuration.MaxDegreeOfParallelism);

            CheckAdminAndPublicDatabasesAreDifferent();

            CheckConfigConsolidation();

            ConsolidationKeyCheck.CheckNaturalKeyColumnsInConfiguration(_configuration.Consolidation);

            // check existence of admin db...
            EnsureAdminDatabaseExists();

            _adminDatabaseAccessible = true;

            // check validity of admin db...
            AdminDatabaseValidityCheck.Execute(
                AdminConnectionString,
                Timeouts.AdminDatabase,
                _configuration.MaxDegreeOfParallelism,
                _configuration.Pipelines);

            InitMutex();

            CheckAllChangesApplied();

            var pOptions = new ParallelOptions {
                MaxDegreeOfParallelism = _configuration.MaxDegreeOfParallelism
            };

            Parallel.Invoke(pOptions, () =>
            {
                SourceTimetableRegistration.EnsureSourceTimetablesAreRegistered(
                    AdminConnectionString,
                    Timeouts.AdminDatabase,
                    srcTimetableRecords,
                    _configuration.MaxDegreeOfParallelism,
                    _configuration.Pipelines);

                StagingTablesExistence.EnsureExist(AdminConnectionString, Timeouts.AdminDatabase);
                HistoryTablesExistence.EnsureExist(AdminConnectionString, Timeouts.AdminDatabase);
                ClearTempStage();
            });

            return(srcTimetableRecords);
        }
Esempio n. 2
0
        private void CheckStageIntegrity()
        {
            // first check that all foreign key values have an entry in the primary table...
            var sc = new StagingSchema(
                AdminConnectionString,
                StagingSchema.TemporaryStagingSchemaName,
                Timeouts.AdminDatabase,
                _configuration.MaxDegreeOfParallelism,
                _configuration.Pipelines);

            sc.CheckIntegrity();

            // now check that the consolidation key values are not blank...
            ConsolidationKeyCheck.Execute(
                AdminConnectionString,
                Timeouts.AdminDatabase,
                _configuration.MaxDegreeOfParallelism,
                _configuration.Consolidation,
                StagingSchema.TemporaryStagingSchemaName);
        }