Update from 3.1.2 to 4.5.1a fails

I am currently running TeamCity Version 3.1.2 (build 6881) and want to upgrade to the newest version (which is 4.5.1a right now, but I tried with 4.5 and 4.0.2 and had the same problems).

I am using the war version of TeamCity (runs in a tomcat 6 instance), configured against a MySQL database. The upgrade goes wrong for me, even though I have been following the documentation (http://www.jetbrains.net/confluence/display/TCD4/Upgrade) carefully.

What I get in the logs is looking like that:

[2009-05-11 06:51:44,273]   INFO - Side.versioning.VersionManager - ---------------> Start applying converters
[2009-05-11 06:51:44,274]   INFO - Side.versioning.VersionManager - Start applying converter BuildStateTableConverter
[2009-05-11 06:51:44,357]  ERROR -   jetbrains.buildServer.SERVER - Failed to initialize TeamCity server, due to error (enable debug to see the whole stacktrace):
org.springframework.jdbc.UncategorizedSQLException: Error executing query with params:[]; uncategorized SQLException for SQL [CREATE TABLE build_state (ID BIGINT, BUILD_TYPE_ID VARCHAR(30),MODIFICATION_ID BIGINT, PRIMARY KEY (ID))]; SQL state [42S01]; error code [1050]; Table 'build_state' already exists;
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Table 'build_state' already exists

I tried to delete this table, then got a similar error telling me that the build_queue table is crashed (I run a repair on the table but it does not help, I still run in other errors).

Can someone please help me with this one, I have not been able to find the information I need to fix it.

And by the way, my .BuildServer/system/version.dat is:

#Mon May 04 10:06:28 CEST 2009

Comment actions Permalink

Hello Florent,

  I'd recommend you to restore your database and .BuildServer from backup and try the upgrade procedure once more (don't forget to put mysql driver to the new version of TeamCity).

  If it fails, please attach full TeamCity/logs/teamcity-server.log file (I hope you run your server with options which enable TeamCity logging).

  Hope this helps,

Comment actions Permalink

Hi Kirill,
Actually the problem was MySQL related. I´m going to document this a bit in case someone else has the same issue later on, and close the thread.

The MySQL server version is 5.1.32 on redhat and was updated from a 4.x version for some months ago. We were already running teamcity back then and it appears that some of the tables were not upgraded correctly when we ran the mysql update, among which our TeamCity tables.

The annoying thing here is that running REPAIR TABLE ´table_name´; does not manage to fix the table, only a myisamchk -r of the .MYI files manages to repair the damaged tables.

After doing repairing the damaged tables (many were) and restarting tomcat/teamcity the upgrade process went well, and I´m now able to run TeamCity 4.5.1a. TeamCity tables in MySQL still get damaged after a while though, but it seems to mostly work. It probably is another MySQL thing that has to be fixed, but I´ve had more than DB admin work for today

Comment actions Permalink

Hello Florent,

   I'd suggest you to make sure that you tables are in consistent state. I'm slightly afraid of 'mostly work' part. I'd recommend you to either create fresh DB installation for TC or to make sure that upgrade went smoothly and there are no glitches.

  BTW, if you recreate database, you won't have to recreate your build configurations - only build history will be lost, as well as current user settings. You can go this way if this is not a problem for you.

  Good luck,

Comment actions Permalink

I am not considering stopping there concerning the mysql databases that still need repair, I was just planning on finishing some other activity first.  I will try to delete the database and create it again as you indicated.


Please sign in to leave a comment.