Bug #5466

onedb not deleting old_ tables after migration

Added by Mariano Guezuraga over 3 years ago. Updated over 3 years ago.

Status:PendingStart date:10/18/2017
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:CLI
Target version:-
Resolution: Pull request:
Affected Versions:OpenNebula 5.4.1

Description

[oneadmin@mguezuraga (devkvm) ~]$ onedb upgrade -v -S mydatabase.server -u oneadmin -d opennebula_testing
MySQL Password:
Version read:
Shared tables 5.2.0 : OpenNebula 5.2.1 daemon bootstrap
Local tables  4.90.0 : OpenNebula 5.2.1 daemon bootstrap

mysqldump: [Warning] Using a password on the command line interface can be insecure.
MySQL dump stored in /var/lib/one/mysql_mydatabase.server_opennebula_testing_2017-10-18_14:49:5.sql
Use 'onedb restore' or restore the DB using the mysql command:
mysql -u user -h server -P port db_name < backup_file

>>> Running migrators for shared tables
  > Running migrator /usr/lib/one/ruby/onedb/shared/5.2.0_to_5.3.80.rb
  > Done in 0.00s

  > Running migrator /usr/lib/one/ruby/onedb/shared/5.3.80_to_5.4.0.rb
  > Done in 0.00s

  > Running migrator /usr/lib/one/ruby/onedb/shared/5.4.0_to_5.4.1.rb
  > Done in 0.00s

Database migrated from 5.2.0 to 5.4.1 (OpenNebula 5.4.1) by onedb command.

>>> Running migrators for local tables
  > Running migrator /usr/lib/one/ruby/onedb/local/4.90.0_to_5.3.80.rb
  > Old EC2 file not found, skipping EC2 host migration
  > Done in 0.42s

  > Running migrator /usr/lib/one/ruby/onedb/local/5.3.80_to_5.4.0.rb
  > Done in 0.00s

  > Running migrator /usr/lib/one/ruby/onedb/local/5.4.0_to_5.4.1.rb
  > Done in 0.06s

Database migrated from 4.90.0 to 5.4.1 (OpenNebula 5.4.1) by onedb command.

Total time: 0.49s
[oneadmin@mguezuraga-base7-01 (devkvm) ~]$ onedb fsck -S mydatabase.server -u oneadmin -d opennebula_testing
MySQL Password:
mysqldump: [Warning] Using a password on the command line interface can be insecure.
MySQL dump stored in /var/lib/one/mysql_mydatabase.server_opennebula_testing_2017-10-18_14:49:59.sql
Use 'onedb restore' or restore the DB using the mysql command:
mysql -u user -h server -P port db_name < backup_file

Mysql2::Error: Table 'old_user_quotas' already exists
/usr/local/share/gems/gems/mysql2-0.4.9/lib/mysql2/client.rb:120:in `_query'
/usr/local/share/gems/gems/mysql2-0.4.9/lib/mysql2/client.rb:120:in `block in query'
/usr/local/share/gems/gems/mysql2-0.4.9/lib/mysql2/client.rb:119:in `handle_interrupt'
/usr/local/share/gems/gems/mysql2-0.4.9/lib/mysql2/client.rb:119:in `query'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/adapters/mysql2.rb:137:in `block in _execute'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/database/logging.rb:44:in `log_connection_yield'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/adapters/mysql2.rb:132:in `_execute'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/adapters/utils/mysql_mysql2.rb:36:in `block in execute'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/database/connecting.rb:251:in `block in synchronize'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/connection_pool/threaded.rb:107:in `hold'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/database/connecting.rb:251:in `synchronize'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/adapters/utils/mysql_mysql2.rb:36:in `execute'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/adapters/mysql2.rb:71:in `execute_dui'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/database/query.rb:45:in `execute_ddl'
/usr/local/share/gems/gems/sequel-4.38.0/lib/sequel/database/query.rb:78:in `run'
/usr/lib/one/ruby/onedb/fsck/quotas.rb:22:in `check_fix_user_quotas'
/usr/lib/one/ruby/onedb/fsck.rb:465:in `fsck'
/usr/lib/one/ruby/onedb/onedb.rb:280:in `fsck'
/bin/onedb:397:in `block (2 levels) in <main>'
/usr/lib/one/ruby/cli/command_parser.rb:449:in `call'
/usr/lib/one/ruby/cli/command_parser.rb:449:in `run'
/usr/lib/one/ruby/cli/command_parser.rb:76:in `initialize'
/bin/onedb:286:in `new'
/bin/onedb:286:in `<main>'

Error running fsck version 5.4.1
The database will be restored
mysql: [Warning] Using a password on the command line interface can be insecure.
MySQL DB opennebula_testing at mydatabase.server restored.

History

#1 Updated by Mariano Guezuraga over 3 years ago

As suggested by jfontan on IRC, manually deleting the old_ tables makes fsck happy again

#2 Updated by Mariano Guezuraga over 3 years ago

I upgraded other installation we have (it holds more VMs/Hosts) and this didn't happen:

oneadmin@mguezuraga-base7-01 (devkvm) ~]$ onedb upgrade -v -S mydatabase.server -u oneadmin -d opennebula
MySQL Password:
Version read:
Shared tables 5.2.0 : Database migrated from 4.90.0 to 5.2.0 (OpenNebula 5.2.0) by onedb command.
Local tables  4.90.0 : OpenNebula 5.1.80 daemon bootstrap

mysqldump: [Warning] Using a password on the command line interface can be insecure.
MySQL dump stored in /var/lib/one/mysql_mydatabase.server_opennebula_2017-10-27_13:24:54.sql
Use 'onedb restore' or restore the DB using the mysql command:
mysql -u user -h server -P port db_name < backup_file

>>> Running migrators for shared tables
  > Running migrator /usr/lib/one/ruby/onedb/shared/5.2.0_to_5.3.80.rb
  > Done in 0.00s

  > Running migrator /usr/lib/one/ruby/onedb/shared/5.3.80_to_5.4.0.rb
  > Done in 0.00s

  > Running migrator /usr/lib/one/ruby/onedb/shared/5.4.0_to_5.4.1.rb
  > Done in 0.00s

Database migrated from 5.2.0 to 5.4.1 (OpenNebula 5.4.1) by onedb command.

>>> Running migrators for local tables
  > Running migrator /usr/lib/one/ruby/onedb/local/4.90.0_to_5.3.80.rb
  > Old EC2 file not found, skipping EC2 host migration
  > Done in 2.80s

  > Running migrator /usr/lib/one/ruby/onedb/local/5.3.80_to_5.4.0.rb
  > Done in 0.00s

  > Running migrator /usr/lib/one/ruby/onedb/local/5.4.0_to_5.4.1.rb
  > Done in 0.07s

Database migrated from 4.90.0 to 5.4.1 (OpenNebula 5.4.1) by onedb command.

Total time: 2.89s
[oneadmin@mguezuraga-base7-01 (devkvm) ~]$ onedb fsck -S mydatabase.server -u oneadmin -d opennebula
MySQL Password:
mysqldump: [Warning] Using a password on the command line interface can be insecure.
MySQL dump stored in /var/lib/one/mysql_mydatabase.server_opennebula_2017-10-27_13:25:36.sql
Use 'onedb restore' or restore the DB using the mysql command:
mysql -u user -h server -P port db_name < backup_file

[...FSCK repairs removed for clarity...]

Total errors found: 210
Total errors repaired: 198
Total errors unrepaired: 12
A copy of this output was stored in /var/log/one/onedb-fsck.log

The only (big) difference is that in my original comment, the cluster didn't have any active VMs

Also available in: Atom PDF