(cfg *Config)
| 35 | } |
| 36 | |
| 37 | func ValidateConfig(cfg *Config) error { |
| 38 | if err := work.ValidateConfig(&cfg.Work); err != nil { |
| 39 | return err |
| 40 | } |
| 41 | |
| 42 | if err := provider.ValidateConfig(&cfg.ProviderConfig); err != nil { |
| 43 | return err |
| 44 | } |
| 45 | |
| 46 | // Validate the measurement interval is twice the speed of the prune interval |
| 47 | // so that the when newBlockSelector is called it has enough time to delete |
| 48 | // the temporary entry and know that it has been persisted to the work cache. |
| 49 | // If the prune age is too short, work could get deleted before the |
| 50 | // newBlockSelector is able to delete the temporary entry. |
| 51 | if cfg.ProviderConfig.Compaction.MeasureInterval > cfg.Work.PruneAge/2 { |
| 52 | return fmt.Errorf("provider.compaction.measure_interval must be no more than half of work.prune_age; tenant measurement should happen at least twice as often as the work prune, got %s and %s", cfg.ProviderConfig.Compaction.MeasureInterval, cfg.Work.PruneAge/2) |
| 53 | } |
| 54 | |
| 55 | if cfg.ProviderConfig.Redaction.RescanDelay > 0 && cfg.Work.PruneAge <= cfg.ProviderConfig.Redaction.RescanDelay { |
| 56 | return fmt.Errorf("work.prune_age must be greater than provider.redaction.rescan_delay so that compaction jobs are still in memory when a rescan fires; got prune_age=%s rescan_delay=%s", cfg.Work.PruneAge, cfg.ProviderConfig.Redaction.RescanDelay) |
| 57 | } |
| 58 | |
| 59 | return nil |
| 60 | } |
no test coverage detected