Bug #2394

After DB Upgrade (1.6.0 to 1.7.0) icinga_dbversion shows 1.6.0

Added by Frankstar almost 5 years ago. Updated about 2 years ago.

Status:ResolvedStart date:03/02/2012
Priority:NormalDue date:
Assignee:Tommi% Done:


Target version:Icinga 1.x - 1.7
Icinga Version:1.10.0 OS Version:any



#> mysql -u root -p icinga < /usr/src/icinga-core/module/idoutils/db/mysql/upgrade/mysql-upgrade-1.7.0.sql

upgrades DB succesfully but

 #> mysql -u root -p
 #> use icinga;

 #> select * from icinga_dbversion;


| dbversion_id | name     | version |
|            1 | idoutils | 1.6.0   |

Associated revisions

Revision 7de8a3e7
Added by Tommi almost 5 years ago

idoutils: increase dbversion string to 1.7.0 #2394
refs #2394

Revision 59645a8e
Added by mfriedrich over 4 years ago

fix pgsql upgrade script copy paste error on dbversion (thx ttyS1) #2394

refs #2394

Revision c149a8ea
Added by mfriedrich over 4 years ago

call to update-version-schema was missing ...

... don't do that manually.

refs #2394


#1 Updated by Tommi almost 5 years ago

  • Category set to 24
  • Status changed from New to Feedback
  • % Done changed from 0 to 100

Its from dev git, right? Its not an error. You stepped into work in progress.
Here only the naming of the file is wrong, because it was intend for 1.7. Later we delayed V1.7. and ido2db is still operating (and askin for) dbversion=1.6.0. The update script includes only 2 new indexes up to now, which are requested from the web guys, but no real structural changes which requires a version update. If the new release is finished, also the update for the dbversion will be included. Maybe you will get an error message when running the final script, because the indexes are already in your system and cannot added twice. Than you should remember this.

#2 Updated by mfriedrich almost 5 years ago

  • Target version set to 1.7
  • % Done changed from 100 to 0

well it is considered to be an "error" in regards of the update script - which will only touch the main sqls, but not the manual upgrade sqls.

i told him to create an issue and assign to you, because you created those (git log $file) and would know best how to proceed (fix now, fix on release, etc).

#3 Updated by Tommi almost 5 years ago

3 options
1. update ido2db and database version string to 1.7. But i understood this will be part of the release prozess
2. remove the patch from public access
3. rename the 1.7 files to somewhalt else

#4 Updated by mfriedrich almost 5 years ago

just look in the files... 1.6.0 is not correct and shoud not be forgotten. i don't care when this happens but it has to. keep cool ;-)

#5 Updated by Tommi almost 5 years ago

Its not forgotten. According to https://wiki.icinga.org/display/Dev/Releases this change is part of the release process.

./update-version-schema 1.5.0 2011-08-17

If its not true anymore, i can do this of course. But then you will need the updated ido2db binary as well after appliing the sql because of the version string check after connect. Otherwise ido2db will not write to the db.

#6 Updated by Tommi almost 5 years ago

  • % Done changed from 0 to 100

applied in changeset 7de8a3e7b9f96e77937ce4dd1a93f8eca1c150ce

#7 Updated by mfriedrich almost 5 years ago

Tommi wrote:

Its not forgotten. According to https://wiki.icinga.org/display/Dev/Releases this change is part of the release process.

no it is not. as said previously, the script only touches the mysql | pgsql | oracle.sql and not the upgrade$version.sql. that is developer responsibility and only for that reason i told our appreciated test padawan to create an issue for you.

the global schema update should be run during release preparations.

#8 Updated by Tommi almost 5 years ago

i cannot see the sense behind this seperation. the dbversion database field must match the entry in common.h, otherwise no data will be inserted. If i change only the value in upgrade.sql and leave common.h untouched ido2db will fail after running the upgrade script. If i change the common.h entry as well, ido2db will work after the update, but it will fail if the database has been build from scratch with mysql.sql.
Anyway, my last commit includes the dbversion update to 1.7.0 in all related files.

#9 Updated by mfriedrich almost 5 years ago

ok, booted the pc, cannot type on my mobile.

what are the steps when you change the db schema for a new version?

1) you change the main sql script (git diff mysql.sql e.g.)
1a) you change to tests on a fresh import
1b) you test the change with mysql, postgresql, oracle
2) you create the upgrade script. namely e.g. mysql-upgrade-$nextversion.sql
2a) you add the change needed to update from previous version to the next, as the fresh import would diff to the previous one
2b) you test that change on all rdbms
2c) you add the dbversion update hardcoded by yourself
3) after having finished, and verified all changes ok, you commit those changes
4) when other devs and testers test the git commit in the dev branch ok, you upgrade the main version in git as well for the next release version. the upgrade will affect
4a) common.h for the schema version
4b) the main sqls for mysql/pgsql/oracle

you may now ask, why you need to manually set the version in the e.g. mysql-upgrade-$nextversion.sql
this happens for various reasons

1) the upgrade script does not automatically know that you have created the upgrade scripts (could be enhanced, but adds complexity which should not happen)
2) if you change your mind and remove the upgrade script, no need to run the schema update script while developing. sometimes changes during development are dropped or rescheduled. a simple "git revert <commit>" is easier than grepping around for version mismatches
3) and last but not least such diversity strengthens the "four eyes" principle to let people recheck everything before a release. you haven't seen the days where such things were not checked, and lead into funny release errors.

so i am pretty happy that frankstar did the test (wow someone that tests!!!) and reported is straight here.

hope that resolves the question marks at your stage - if he wouldn't have created the issue, i would have as soon as testing proposed changes.

#10 Updated by Tommi almost 5 years ago

there is no problem with me to get a ticket and do the fix.

but as i already mentioned i am feeling nessesary to stress the process point. i see a problem in the chain you described between step 3) and 4). The change i commited with the increased dbversion in update sql can only be tested in dev in terms of sql working, but with this patch applied ido2db is not working anymore, because the mandantory update in common.h is not there in this stage. Usually, i also change the main sql together with the update sql which i need to test in parallel and there i need the same results. If i should do this later it can really be forgotten. This because i would vote not to distribute the point to increase the dbversion string over the stages, but at all together either to time of the the first change or to the time of release. Maybe this explains my concerns better.

#11 Updated by mfriedrich almost 5 years ago

ok, finally understood. you mean the application itsself is indicating 1.6.0 while the db is already thinking 1.7.0 which will lead into syslog entries with version mismatches.

anyhow, then it remains necessary to do

  • either run the update-schema-version when $dev adds the upgrade scripts
  • or let the upgrade-schema-version check if such upgrade files exist (warn the $dev if not) and if, check if they provide the correct dbversion to be set (warn the 4dev and correct automatically)

i sort of like the second option more, but it still requires manual tests by those willing to do so (like frankstar).

#12 Updated by Tommi over 4 years ago

  • Status changed from Feedback to Resolved

no more feedback within the last 4 weeks for the actual issue, assume resolved

#13 Updated by Frankstar over 4 years ago

Database changed
mysql> select * from icinga_dbversion;
| dbversion_id | name     | version |
|            1 | idoutils | 1.6.0   |
1 row in set (0.00 sec)

no update, still shows after upgrade 1.6.0
just to inform you

#14 Updated by mfriedrich over 4 years ago

oracle works fine, using merged tree from mfriedrich/ido currently.

#15 Updated by mfriedrich over 4 years ago

same goes for mysql.

i won't merge that tree though because of the recently introduced bug in #2342

check dev/ido for a current merge waiting for proper fix / revert.

#17 Updated by mfriedrich over 4 years ago

presumingly he does not use the correct git branch, as your commits did not hit master nor next currently.

this will help identify the cause

$ git log -1

#18 Updated by mfriedrich about 2 years ago

  • Project changed from 18 to Core, Classic UI, IDOUtils
  • Category changed from 24 to IDOUtils
  • Icinga Version set to 1.10.0
  • OS Version set to any

Also available in: Atom PDF