Project

General

Profile

Actions

Bug #11044

closed

rake fix_cached_counters fails "undefined method `counter_cache_column' for nil:NilClass"

Added by Byron Miller over 8 years ago. Updated over 8 years ago.

Status:
Duplicate
Priority:
Normal
Assignee:
-
Category:
Rake tasks
Target version:
-
Difficulty:
Triaged:
Fixed in Releases:
Found in Releases:

Description

My "Domains" page is showing counters that are about 100 to 1000 times off real counts, so i checked out how this may be cleared up/repaired and i'm trying to run "foreman-rake fix_cached_counters" and it fails.

foreman-rake fix_cached_counters --trace
  • Invoke fix_cached_counters (first_time)
  • Invoke environment (first_time)
  • Execute environment
  • Execute fix_cached_counters
    Correcting cached counters: (this may take a few minutes)
    Architecture corrected
    Environment corrected
    Operatingsystem corrected
    rake aborted!
    undefined method `counter_cache_column' for nil:NilClass
    /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/counter_cache.rb:32:in `block in reset_counters'
    /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/counter_cache.rb:19:in `each'
    /opt/rh/ruby193/root/usr/share/gems/gems/activerecord-3.2.8/lib/active_record/counter_cache.rb:19:in `reset_counters'
    /usr/share/foreman/lib/tasks/fix_cached_counters.rake:5:in `block (3 levels) in <top (required)>'
    /usr/share/foreman/lib/tasks/fix_cached_counters.rake:5:in `each'
    /usr/share/foreman/lib/tasks/fix_cached_counters.rake:5:in `block (2 levels) in <top (required)>'
    /usr/share/foreman/lib/tasks/fix_cached_counters.rake:4:in `each'
    /usr/share/foreman/lib/tasks/fix_cached_counters.rake:4:in `block in <top (required)>'
    /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:205:in `call'
    /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:205:in `block in execute'
    /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:200:in `each'
    /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:200:in `execute'
    /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:158:in `block in invoke_with_call_chain'
    /opt/rh/ruby193/root/usr/share/ruby/monitor.rb:211:in `mon_synchronize'
    /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:151:in `invoke_with_call_chain'
    /opt/rh/ruby193/root/usr/share/ruby/rake/task.rb:144:in `invoke'
    /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:116:in `invoke_task'
    /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in `block (2 levels) in top_level'
    /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in `each'
    /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:94:in `block in top_level'
    /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:in `standard_exception_handling'
    /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:88:in `top_level'
    /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:66:in `block in run'
    /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:133:in `standard_exception_handling'
    /opt/rh/ruby193/root/usr/share/ruby/rake/application.rb:63:in `run'
    /opt/rh/ruby193/root/usr/bin/rake:32:in `<main>'
    Tasks: TOP => fix_cached_counters

Related issues 2 (0 open2 closed)

Related to Foreman - Bug #7247: Create migration to fix incorrect counts caused by #5692 and related bugsClosedTomer Brisker08/25/2014Actions
Related to Foreman - Bug #11444: Domains page shows negative number of hostsClosedTomer Brisker08/21/2015Actions
Actions #1

Updated by Dominic Cleal over 8 years ago

  • Related to Bug #7247: Create migration to fix incorrect counts caused by #5692 and related bugs added
Actions #2

Updated by Dominic Cleal over 8 years ago

  • Category set to Rake tasks

Looks like it's failing on Domain.

Actions #3

Updated by Brandon Weeks over 8 years ago

  • translation missing: en.field_release set to 63

+1 still present in 1.10

Actions #4

Updated by Brandon Weeks over 8 years ago

  • Related to Bug #11444: Domains page shows negative number of hosts added
Actions #5

Updated by Brandon Weeks over 8 years ago

  • Status changed from New to Duplicate

This is actually a duplicate of #11444 and fixed in a152a1b207cad3ae86e6c6384b1179b19c40578f.

Actions #6

Updated by Dominic Cleal over 8 years ago

  • translation missing: en.field_release deleted (63)
Actions #7

Updated by Jason Ashby over 8 years ago

I'm hitting this issue when upgrading from 1.9.2 to 1.9.3, preventing me from running db:migration and db:seed. Is there a patch I can apply to 1.9.3? Let me know if you want some tracebacks; didn't want to clog up this issue (I can open another if needed).

Actions #8

Updated by Dominic Cleal over 8 years ago

You shouldn't need to run this task to perform a DB migration, it's separate.

Actions

Also available in: Atom PDF