# \[onedb\] Upgrade error 5.10 -\> 5.12

**URL:** <https://forum.opennebula.io/t/onedb-upgrade-error-5-10-5-12/10205>\
**Category:** Installation & Configuration\
**Created:** [December 22, 2021, 10:33am UTC](https://forum.opennebula.io/t/onedb-upgrade-error-5-10-5-12/10205 "2021-12-22T10:33:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Flo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/flo/32/7201_2.png) [@Flo](https://forum.opennebula.io/u/Flo)\
**Post date:** [December 22, 2021, 10:33am UTC](https://forum.opennebula.io/t/onedb-upgrade-error-5-10-5-12/10205/1 "2021-12-22T10:33:06Z")

</div>

Hello,  
I’m planning to use version 6, and want to prepare and upgrade to 5.12.  
I followed upgrade procedure, and i have a problem with onedb upgrade, for 5.10 to 5.12.

The stdout :

```auto

Version read:
Shared tables 5.10.0 : Database migrated from 5.6.0 to 5.10.0 (OpenNebula 5.9.80) by onedb command.
Local tables 5.10.0 : Database migrated from 5.8.0 to 5.10.0 (OpenNebula 5.9.80) by onedb command.

MySQL dump stored in /var/lib/one/mysql_localhost_opennebula_2021-12-22_11:29:55.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.10.0_to_5.12.0.rb

undefined method `+' for nil:NilClass
/usr/lib/one/ruby/onedb/shared/5.10.0_to_5.12.0.rb:60:in `block (2 levels) in feature_4089'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/dataset/actions.rb:152:in `block in each'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/adapters/mysql2.rb:238:in `block (2 levels) in fetch_rows'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/adapters/mysql2.rb:238:in `each'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/adapters/mysql2.rb:238:in `block in fetch_rows'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/adapters/mysql2.rb:151:in `_execute'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/adapters/utils/mysql_mysql2.rb:39:in `block in execute'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/connection_pool/threaded.rb:88:in `hold'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/database/connecting.rb:270:in `synchronize'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/adapters/utils/mysql_mysql2.rb:39:in `execute'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/dataset/actions.rb:1089:in `execute'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/adapters/mysql2.rb:276:in `execute'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/adapters/mysql2.rb:236:in `fetch_rows'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/dataset/actions.rb:152:in `each'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/database/dataset.rb:51:in `fetch'
/usr/lib/one/ruby/onedb/shared/5.10.0_to_5.12.0.rb:59:in `block in feature_4089'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/database/transactions.rb:254:in `_transaction'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/database/transactions.rb:229:in `block in transaction'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/connection_pool/threaded.rb:92:in `hold'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/database/connecting.rb:270:in `synchronize'
/usr/share/one/gems-dist/gems/sequel-5.31.0/lib/sequel/database/transactions.rb:195:in `transaction'
/usr/lib/one/ruby/onedb/shared/5.10.0_to_5.12.0.rb:58:in `feature_4089'
/usr/lib/one/ruby/onedb/shared/5.10.0_to_5.12.0.rb:32:in `up'
/usr/lib/one/ruby/onedb/onedb.rb:393:in `apply_migrators'
/usr/lib/one/ruby/onedb/onedb.rb:270:in `upgrade'
/usr/bin/onedb:439: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:336:in `new'
/usr/bin/onedb:336:in `<main>'

The database will be restored

```

---

<div class="post-metadata">

**Author:** ![Flo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/flo/32/7201_2.png) [@Flo](https://forum.opennebula.io/u/Flo)\
**Post date:** [December 22, 2021, 10:46am UTC](https://forum.opennebula.io/t/onedb-upgrade-error-5-10-5-12/10205/2 "2021-12-22T10:46:49Z")

</div>

I found a solution.

```auto
/usr/lib/one/ruby/onedb/shared/5.10.0_to_5.12.0.rb:58

    # Add DockerHub marketplace
    def feature_4089
        @db.transaction do
            @db.fetch('SELECT max(oid) as maxid FROM marketplace_pool') do |row|
                next_oid = row[:maxid] + 1

```

I figured that there was no record in DB, so oid is NULL and there is no checks.  
Fixed with :

```auto
insert into marketplace_pool(oid,name,body) values('1','Dummy fix','fix bug in migration..');

```

---

<div class="post-metadata">

**Author:** ![Flo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/flo/32/7201_2.png) [@Flo](https://forum.opennebula.io/u/Flo)\
**Post date:** [December 22, 2021, 11:01am UTC](https://forum.opennebula.io/t/onedb-upgrade-error-5-10-5-12/10205/3 "2021-12-22T11:01:22Z")

</div>

Note : Once upgrade is OK, need to delete the dummy entry to pass fsck.

---

<div class="post-metadata">

**Author:** ![pczerny](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/pczerny/32/6224_2.png) [@pczerny](https://forum.opennebula.io/u/pczerny)\
**Post date:** [January 19, 2022, 11:32am UTC](https://forum.opennebula.io/t/onedb-upgrade-error-5-10-5-12/10205/4 "2022-01-19T11:32:31Z")

</div>

Hello,  
thanks for the message. You are right, we didn’t covered the empty Marketplace in the migrator. I fixed it, so in next release it should work.

You can also manually fix: line 60 in `/usr/lib/one/ruby/onedb/shared/5.10.0_to_5.12.0.rb` replace

```auto
                next_oid = row[:maxid] + 1

```

with

```auto
                next_oid = 0
                next_oid = row[:maxid] + 1 unless row[:maxid].nil?

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/opennebula/original/2X/1/14d66f1130b9cd292905f575da9b68a9f574dd03.png) [@system](https://forum.opennebula.io/u/system)\
**Post date:** [July 8, 2025, 3:53pm UTC](https://forum.opennebula.io/t/onedb-upgrade-error-5-10-5-12/10205/5 "2025-07-08T15:53:48Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
