Project

General

Profile

Actions

Bug #33936

closed

Upgrade fails with PG::NotNullViolation: ERROR: column "subscription_id" contains null values

Added by Jonathon Turel about 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Category:
Upgrades
Target version:
Fixed in Releases:
Found in Releases:

Description

How reproducible:
- When running foreman-rake db:migrate

foreman=# select id,subscription_id from katello_pools where subscription_id IS null;
- returns 63 rows with subscription_id that has a null value

Full trace: ###########
[root@satellite6:/root]# foreman-rake db:migrate --trace
'ErbParser' is ignored.
'RubyParser' is ignored.
  • Invoke db:migrate (first_time)
  • Invoke db:load_config (first_time)
  • Invoke environment (first_time)
  • Execute environment
    API controllers newer than Apipie cache! Run apipie:cache rake task to regenerate cache.
  • Execute db:load_config
  • Invoke plugin:refresh_migrations (first_time)
  • Invoke environment
  • Execute plugin:refresh_migrations
  • Execute db:migrate
    20210331180353 KatelloPoolOrganizationIdNotNullable: migrating ===========
    -- change_column(:katello_pools, :organization_id, :integer, {:null=>false})
    > 0.0023s
    -
    change_column(:katello_pools, :subscription_id, :integer, {:null=>false})
    rake aborted!
    StandardError: An error has occurred, this and all later migrations canceled:
PG::NotNullViolation: ERROR:  column "subscription_id" contains null values
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql/database_statements.rb:92:in `async_exec'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql/database_statements.rb:92:in `block (2 levels) in execute'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql/database_statements.rb:91:in `block in execute'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract_adapter.rb:722:in `block (2 levels) in log'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract_adapter.rb:721:in `block in log'
/opt/theforeman/tfm/root/usr/share/gems/gems/activesupport-6.0.3.7/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/abstract_adapter.rb:712:in `log'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql/database_statements.rb:90:in `execute'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/connection_adapters/postgresql/schema_statements.rb:402:in `change_column'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:890:in `block in method_missing'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:858:in `block in say_with_time'
/opt/rh/rh-ruby27/root/usr/share/ruby/benchmark.rb:293:in `measure'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:858:in `say_with_time'
/opt/theforeman/tfm/root/usr/share/gems/gems/activerecord-6.0.3.7/lib/active_record/migration.rb:879:in `method_missing'
/opt/theforeman/tfm/root/usr/share/gems/gems/katello-4.1.1.35/db/migrate/20210331180353_katello_pool_organization_id_not_nullable.rb:5:in `up'
Actions #1

Updated by Jonathon Turel about 3 years ago

  • Subject changed from Upgrade fails with PG::NotNullViolation: ERROR: column "subscription_id" contains null values to Upgrade fails with PG::NotNullViolation: ERROR: column "subscription_id" contains null values
  • Target version changed from Katello 4.4.0 to Katello 4.3.0
Actions #2

Updated by The Foreman Bot about 3 years ago

  • Status changed from New to Ready For Testing
  • Assignee set to Jonathon Turel
  • Pull request https://github.com/Katello/katello/pull/9791 added
Actions #3

Updated by James Jeffers about 3 years ago

  • Target version changed from Katello 4.3.0 to Katello 4.2.2
Actions #4

Updated by James Jeffers about 3 years ago

  • Triaged changed from No to Yes
Actions #5

Updated by The Foreman Bot about 3 years ago

  • Fixed in Releases Katello 4.4.0 added
Actions #6

Updated by Jonathon Turel about 3 years ago

  • Status changed from Ready For Testing to Closed
Actions #7

Updated by The Foreman Bot almost 3 years ago

  • Pull request https://github.com/Katello/katello/pull/9890 added
Actions

Also available in: Atom PDF