This fix applies to OAR 2.5.2 and OAR 2.5.3, and must be taken into account if upgrading to any later version of OAR (i.e. starting from OAR 2.5.4)

Description of the issue

With OAR 2.5.2 and OAR 2.5.3, OAR's database schema version must be 2.5.2 but is actually 2.5.0 in case of a fresh database setup with oar-database.

This unfortunately causes the upgrade of the database to a later version of OAR (e.g. OAR 2.5.4) to report an error:

root@server:~# oar-database --check
[Failed] OAR database version mismatch. Current version is 2.5.0 while 2.5.4 is required.
root@server:~# oar-database --upgrade
WARNING: Please make sure to stop oar-server service before upgrading.
         Please consider backing up the database before upgrading.
Continue? [y/N]: y
The current schema version is 2.5.0. Upgrading to 2.5.4.
Uprgading from '2.5.0' to '2.5.2'...
ERROR:  column "array_index" of relation "jobs" already exists
Uprgading from '2.5.2' to '2.5.4'...

Description of the fix procedure

First check that your are actually using OAR 2.5.2 or OAR 2.5.3, e.g:

$ /usr/sbin/oarnotify -V
OAR version : 2.5.3 (Frog Master)

It the reported version is indeed 2.5.2 or 2.5.3, follow the procedure adapted to your database backend.

Mysql database

Check your database schema version:

# adapat the following to your configuration:
$ echo 'select * from `schema`;' | mysql -t -u$OARDBUSER -p$OARDBPASSWD $OARDBNAME
| version | name |
| 2.5.0   |      |

Check that your jobs table already has a “array_index” column.

$ echo 'select array_index from jobs limit 1;' | mysql -t -u$OARDBUSER -p$OARDBPASSWD $OARDBNAME
| array_index |
| .....       |

If yes, that confirms that the current version of your OAR database is 2.5.2 already and that the schema version is wrong.

Please apply the following command to fix the version:

$ echo 'update `schema` set version = "2.5.2";' | mysql -u$OARDBUSER -p$OARDBPASSWD $OARDBNAME
# Then, check the version again:
$ echo 'select * from `schema`;' | mysql -t -u$OARDBUSER -p$OARDBPASSWD $OARDBNAME
| version | name |
| 2.5.2   |      |
Postgresql database

Same as with MySQL, but use the psql command instead of the mysql command, e.g.:

$ echo 'update schema set version = "2.5.2";' | psql -h $SERVER oar oar -W
wiki/fix_for_database_schema_version_2.5.0.txt · Last modified: 2014/10/31 19:35 by neyron
Recent changes RSS feed GNU Free Documentation License 1.3 Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki