diff options
Diffstat (limited to 'internal/praefect/config/config.go')
-rw-r--r-- | internal/praefect/config/config.go | 49 |
1 files changed, 6 insertions, 43 deletions
diff --git a/internal/praefect/config/config.go b/internal/praefect/config/config.go index bef7f8d62..60899deb3 100644 --- a/internal/praefect/config/config.go +++ b/internal/praefect/config/config.go @@ -36,9 +36,6 @@ const ( ElectionStrategySQL ElectionStrategy = "sql" // ElectionStrategyPerRepository configures an SQL based strategy that elects different primaries per repository. ElectionStrategyPerRepository ElectionStrategy = "per_repository" - - minimalSyncCheckInterval = time.Minute - minimalSyncRunInterval = time.Minute ) type Failover struct { @@ -100,14 +97,11 @@ type Replication struct { // BatchSize controls how many replication jobs to dequeue and lock // in a single call to the database. BatchSize uint `toml:"batch_size"` - // ParallelStorageProcessingWorkers is a number of workers used to process replication - // events per virtual storage (how many storages would be processed in parallel). - ParallelStorageProcessingWorkers uint `toml:"parallel_storage_processing_workers"` } // DefaultReplicationConfig returns the default values for replication configuration. func DefaultReplicationConfig() Replication { - return Replication{BatchSize: 10, ParallelStorageProcessingWorkers: 1} + return Replication{BatchSize: 10} } // Config is a container for everything found in the TOML config file @@ -128,10 +122,10 @@ type Config struct { DB `toml:"database"` Failover Failover `toml:"failover"` // Keep for legacy reasons: remove after Omnibus has switched - FailoverEnabled bool `toml:"failover_enabled"` - MemoryQueueEnabled bool `toml:"memory_queue_enabled"` - GracefulStopTimeout config.Duration `toml:"graceful_stop_timeout"` - RepositoriesCleanup RepositoriesCleanup `toml:"repositories_cleanup"` + FailoverEnabled bool `toml:"failover_enabled"` + MemoryQueueEnabled bool `toml:"memory_queue_enabled"` + GracefulStopTimeout config.Duration `toml:"graceful_stop_timeout"` + // ForceCreateRepositories will enable force-creation of repositories in the // coordinator when routing repository-scoped mutators. This must never be used // outside of tests. @@ -162,8 +156,7 @@ func FromFile(filePath string) (Config, error) { Replication: DefaultReplicationConfig(), Prometheus: prometheus.DefaultConfig(), // Sets the default Failover, to be overwritten when deserializing the TOML - Failover: Failover{Enabled: true, ElectionStrategy: ElectionStrategyPerRepository}, - RepositoriesCleanup: DefaultRepositoriesCleanup(), + Failover: Failover{Enabled: true, ElectionStrategy: ElectionStrategyPerRepository}, } if err := toml.Unmarshal(b, conf); err != nil { return Config{}, err @@ -256,15 +249,6 @@ func (c *Config) Validate() error { } } - if c.RepositoriesCleanup.RunInterval.Duration() > 0 { - if c.RepositoriesCleanup.CheckInterval.Duration() < minimalSyncCheckInterval { - return fmt.Errorf("repositories_cleanup.check_interval is less then %s, which could lead to a database performance problem", minimalSyncCheckInterval.String()) - } - if c.RepositoriesCleanup.RunInterval.Duration() < minimalSyncRunInterval { - return fmt.Errorf("repositories_cleanup.run_interval is less then %s, which could lead to a database performance problem", minimalSyncRunInterval.String()) - } - } - return nil } @@ -432,24 +416,3 @@ func (db DB) ToPQString(direct bool) string { return strings.Join(fields, " ") } - -// RepositoriesCleanup configures repository synchronisation. -type RepositoriesCleanup struct { - // CheckInterval is a time period used to check if operation should be executed. - // It is recommended to keep it less than run_interval configuration as some - // nodes may be out of service, so they can be stale for too long. - CheckInterval config.Duration `toml:"check_interval"` - // RunInterval: the check runs if the previous operation was done at least RunInterval before. - RunInterval config.Duration `toml:"run_interval"` - // RepositoriesInBatch is the number of repositories to pass as a batch for processing. - RepositoriesInBatch int `toml:"repositories_in_batch"` -} - -// DefaultRepositoriesCleanup contains default configuration values for the RepositoriesCleanup. -func DefaultRepositoriesCleanup() RepositoriesCleanup { - return RepositoriesCleanup{ - CheckInterval: config.Duration(30 * time.Minute), - RunInterval: config.Duration(24 * time.Hour), - RepositoriesInBatch: 16, - } -} |