diff options
author | Nick Thomas <nick@gitlab.com> | 2019-07-24 17:00:35 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-07-24 17:00:35 +0000 |
commit | e7f795a390a2f903a980d6b6356c9960f0b1179d (patch) | |
tree | 7af4fe63145be0f15f6b14f8ba6d5949331fa39c /lib/gitlab/database/count.rb | |
parent | 25698fda236d3ab2c5327d3acd1f9fde6f2b5e04 (diff) | |
parent | 259493bb4cbce2ab48b7e9b959430888dc9f9d8b (diff) | |
download | gitlab-ce-e7f795a390a2f903a980d6b6356c9960f0b1179d.tar.gz |
Merge branch 'ab-count-strategies' into 'master'
Remove feature flag for tablesample counts
See merge request gitlab-org/gitlab-ce!31048
Diffstat (limited to 'lib/gitlab/database/count.rb')
-rw-r--r-- | lib/gitlab/database/count.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/gitlab/database/count.rb b/lib/gitlab/database/count.rb index f3d37ccd72a..eac61254bdf 100644 --- a/lib/gitlab/database/count.rb +++ b/lib/gitlab/database/count.rb @@ -37,16 +37,14 @@ module Gitlab # @return [Hash] of Model -> count mapping def self.approximate_counts(models, strategies: [TablesampleCountStrategy, ReltuplesCountStrategy, ExactCountStrategy]) strategies.each_with_object({}) do |strategy, counts_by_model| - if strategy.enabled? - models_with_missing_counts = models - counts_by_model.keys + models_with_missing_counts = models - counts_by_model.keys - break counts_by_model if models_with_missing_counts.empty? + break counts_by_model if models_with_missing_counts.empty? - counts = strategy.new(models_with_missing_counts).count + counts = strategy.new(models_with_missing_counts).count - counts.each do |model, count| - counts_by_model[model] = count - end + counts.each do |model, count| + counts_by_model[model] = count end end end |