Skip to content

onedb fsck crash on MarketPlaceApp in Federated environment #6793

@paczerny

Description

@paczerny

Description
In Federation environment the onedb fsck may fail:

$ onedb fsck
MySQL dump stored in /var/lib/one/mysql_localhost_opennebula_2024-11-15_6:24:29.sql
Use 'onedb restore' or restore the DB using the mysql command:
mysql -u user -h server -P port db_name < backup_file

undefined method `[]' for nil:NilClass
/usr/lib/one/ruby/onedb/fsck/marketplaceapp.rb:39:in `block in check_marketplaceapp'
/usr/share/one/gems-dist/gems/sequel-5.55.0/lib/sequel/dataset/actions.rb:152:in `block in each'
/usr/share/one/gems-dist/gems/sequel-5.55.0/lib/sequel/adapters/mysql2.rb:243:in `block (2 levels) in fetch_rows'
/usr/share/one/gems-dist/gems/sequel-5.55.0/lib/sequel/adapters/mysql2.rb:243:in `each'
/usr/share/one/gems-dist/gems/sequel-5.55.0/lib/sequel/adapters/mysql2.rb:243:in `block in fetch_rows'
/usr/share/one/gems-dist/gems/sequel-5.55.0/lib/sequel/adapters/mysql2.rb:157:in `_execute'
/usr/share/one/gems-dist/gems/sequel-5.55.0/lib/sequel/adapters/utils/mysql_mysql2.rb:40:in `block in execute'
/usr/share/one/gems-dist/gems/sequel-5.55.0/lib/sequel/connection_pool/threaded.rb:92:in `hold'
/usr/share/one/gems-dist/gems/sequel-5.55.0/lib/sequel/database/connecting.rb:269:in `synchronize'
/usr/share/one/gems-dist/gems/sequel-5.55.0/lib/sequel/adapters/utils/mysql_mysql2.rb:40:in `execute'
/usr/share/one/gems-dist/gems/sequel-5.55.0/lib/sequel/dataset/actions.rb:1093:in `execute'
/usr/share/one/gems-dist/gems/sequel-5.55.0/lib/sequel/adapters/mysql2.rb:281:in `execute'
/usr/share/one/gems-dist/gems/sequel-5.55.0/lib/sequel/adapters/mysql2.rb:241:in `fetch_rows'
/usr/share/one/gems-dist/gems/sequel-5.55.0/lib/sequel/dataset/actions.rb:152:in `each'
/usr/share/one/gems-dist/gems/sequel-5.55.0/lib/sequel/database/dataset.rb:51:in `fetch'
/usr/lib/one/ruby/onedb/fsck/marketplaceapp.rb:24:in `check_marketplaceapp'
/usr/lib/one/ruby/onedb/fsck.rb:438:in `fsck'
/usr/lib/one/ruby/onedb/onedb.rb:486:in `fsck'
/usr/bin/onedb:494:in `block (2 levels) in <main>'
/usr/lib/one/ruby/cli/command_parser.rb:482:in `run'
/usr/lib/one/ruby/cli/command_parser.rb:84:in `initialize'
/usr/bin/onedb:364:in `new'
/usr/bin/onedb:364:in `<main>'

Error running fsck version 6.4.0

To Reproduce

  • On one zone create an MarketPlaceApp by command onemarketapp vm-template import
  • While the import operation is in progress, stop second zone and run onedb fsck

There are two options:

  • The Image with MarketPlaceApp->origin_id doesn't exist on second zone, the onedb fsck crashes with above error
  • The Image with MarketPlaceApp->origin_id exists on second zone, but it's different image -> we need to investigate this case, check if we can detect it and skip this check. But we maybe don't have enough info.

Expected behavior
onedb fsck should not crash and if possible it should fix MarketPlaceApp inconsistencies

Details

  • Affected Component: Core (onedb fsck)
  • Version: 6.4, 6.10, ...

Additional context
Ideally we should detect in onedb fsck that the import process was started on other federation and skip check of the cloning ids.

In case of standalone environment the MarketPlaceApp is in locked state, but because we run onedb fsck the OpenNebula is not running (consider --dry mode), so the import can't finish and the MarketPlaceApp is probably corrupted, we should warn about this.

Progress Status

  • Code committed
  • Testing - QA
  • Documentation (Release notes - resolved issues, compatibility, known issues)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions