./migrate.sh migrate throws OutOfMemoryError

I am trying to migrate the database of our teamcity 3.1.1 installation (enterprise license) from hsqldb to mysql. The problem is that whenever I run the migrate.sh script it throws an error: java.lang.OutOfMemoryError: Java heap space.

I have tried increasing -Xmx512m to -Xmx1300m for example, or even more and variations thereof. This is a 64 bit debian stable server with about 16 GB of memory, of which at least 9GB is readily available. I have a java_pidXXX.hprof file using -XX:+HeapDumpOnOutOfMemoryError which I tried to upload to ftp://ftp.intellij.net/.uploads/java_pid8803.hprof. It is rather large, so I aborted it, since I am unsure if anyone actually needs it.

Thank you

15 comments

Hello,

You may try to launch hsqldb as a standalone process as described at the bottom of the page.

Please note that on 64-bit systems the Java process will need twice as much memory comparing to 32 bit systems.

What is the size of your .BuildServer\system\buildserver.data file?
What is the greatest amount of memory you tried to specify to the hsqldb process?

--
Best regards,

Yegor Yarko
Project Manager
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0

"You may try to launch hsqldb as a standalone process as described at the bottom of the page."
I did try that a number of times, with the same result.

"What is the size of your .BuildServer\system\buildserver.data file?"
It is 399 MB.

"What is the greatest amount of memory you tried to specify to the hsqldb process?"
Since the machine had 9 GB free, out of 16 GB I tried several amounts up to 9 GB. They all threw the same error.

Thank you

0

Can you also provide a full copy of console output of migration script
and directory listing (with file sizes) of migration temporary directory?

kroshka wrote:

"You may try to launch hsqldb as a standalone process as described at the bottom of the page."
I did try that a number of times, with the same result.

"What is the size of your .BuildServer\system\buildserver.data file?"
It is 399 MB.

"What is the greatest amount of memory you tried to specify to the hsqldb process?"
Since the machine had 9 GB free, out of 16 GB I tried several amounts up to 9 GB. They all threw the same error.

Thank you



--
Alexey Gopachenko
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

I created a database called teamcity with utf8 character set. I am using mysql-connector-java-5.1.6-bin.jar.


/root/.BuildServer/config/database.properties:

driverName=com.mysql.jdbc.Driver
connectionUrl=jdbc:mysql://127.0.0.1/teamcity
connectionProperties.user=teamcity
connectionProperties.password=******

maxConnections=50
poolPreparedStatements=true

connectionProperties.useLocalSessionState=true
connectionProperties.elideSetAutoCommits=true
connectionProperties.alwaysSendSetIsolation=false

  1. uncomment if your database uses utf8 character set

connectionProperties.characterEncoding=UTF-8


dbMigration.properties:

  1. Internal TeamCity database running in standalone mode

  2. Starting HSQLDB in standalone mode: java -Xmx512M -cp <path_to_TeamCity_application_folder>\WEB-INF\lib\hsqldb.jar org.hsqldb.Server -database.0 <path_to_.BuildServer/system>\buildserver -dbname.0 buildserver

sourceDriver=org.hsqldb.jdbcDriver
sourceURL=jdbc:hsqldb:hsql://127.0.0.1/buildserver
sourceUser=sa
sourcePassword=''

  1. MySQL

  2. do not forget to place MySQL driver (mysql-connector-java-*.jar) into <path to TeamCity application folder>\WEB-INF\lib directory

targetDriver=com.mysql.jdbc.Driver
targetURL=jdbc:mysql://127.0.0.1:3306/teamcity
targetUser=teamcity
targetPassword=******


Starting hsqldb standalone:

build1:/opt/TeamCity/bin# /opt/java/bin/java -Xmx4000M -cp /opt/TeamCity/webapps/ROOT/WEB-INF/lib/hsqldb.jar org.hsqldb.Server -database.0 /root/.BuildServer/system/buildserver -dbname.0 buildserver &
build1:/opt/TeamCity/bin# : [Thread[main,5,main]]: checkRunning(false) entered
: [Thread[main,5,main]]: checkRunning(false) exited
: Startup sequence initiated from main() method
: Loaded properties from
: Initiating startup sequence...
: Server socket opened successfully in 6 ms.
: Database opened sucessfully in 20564 ms.
: Startup sequence completed in 20571 ms.
: 2008-06-27 12:33:56.496 HSQLDB server 1.8.0 is online
: To close normally, connect and execute SHUTDOWN SQL
: From command line, use + to abort abruptly


Running the migration tool:

build1:/opt/TeamCity/bin# ./migrateDB.sh migrate Using propeties file 'dbMigration.properties'.
Fri Jun 27 12:34:16 PDT 2008 Connecting to the source database jdbc:hsqldb:hsql://127.0.0.1/buildserver
Fri Jun 27 12:34:16 PDT 2008 Connecting to the target database jdbc:mysql://127.0.0.1:3306/teamcity
Fri Jun 27 12:34:16 PDT 2008 Initializing schema...
TABLES to be converted: (42) [[agent, agent_build_type_access, agent_sources_version, build_checkout_rules, build_labels, build_queue, build_revisions, build_runtime_info, build_type_vcs_change, canceled_info, comments, compiler_output, deleted_build_types, downloaded_artifacts, failed_tests_output, history, ignored_tests, light_history, paused_build_types, personal_vcs_changes, personal_vcs_history, remember_me, remote_run_build_types, run_configuration_policy, running, server, server_property, stats, tc_build_tags, test_info, test_names, user_blocks, user_notification_events, user_projects_order, user_projects_visibility, user_property, user_roles, user_watch_type, users, vcs_changes, vcs_history, vcs_root_versions]]
Fri Jun 27 12:34:18 PDT 2008 Exporting /opt/TeamCity/bin/TC-export-1214595256357/targetSchema.sql
Fri Jun 27 12:34:18 PDT 2008 Exporting data to TC-export-1214595256357
Fri Jun 27 12:34:18 PDT 2008 Exporting /opt/TeamCity/bin/TC-export-1214595256357/sourceSchema.sql
Error processing source data. Original error: java.sql.SQLException: Connection is broken: java.lang.OutOfMemoryError: Java heap space
An error has occured during migration. Could not proceed.


Migration temp directory:

build1:/opt/TeamCity/bin# ls -al TC-export-1214595256357
total 7532
drwxr-xr-x 2 root root 4096 2008-06-27 12:34 .
drwxr-xr-x 5 root root 4096 2008-06-27 12:34 ..
-rw-rr 1 root root 24 2008-06-27 12:34 AGENT_BUILD_TYPE_ACCESS.csv
-rw-rr 1 root root 364 2008-06-27 12:34 AGENT.csv
-rw-rr 1 root root 20139 2008-06-27 12:34 AGENT_SOURCES_VERSION.csv
-rw-rr 1 root root 517393 2008-06-27 12:34 BUILD_CHECKOUT_RULES.csv
-rw-rr 1 root root 70 2008-06-27 12:34 BUILD_LABELS.csv
-rw-rr 1 root root 605 2008-06-27 12:34 BUILD_QUEUE.csv
-rw-rr 1 root root 710366 2008-06-27 12:34 BUILD_REVISIONS.csv
-rw-rr 1 root root 757 2008-06-27 12:34 BUILD_RUNTIME_INFO.csv
-rw-rr 1 root root 3493805 2008-06-27 12:34 BUILD_TYPE_VCS_CHANGE.csv
-rw-rr 1 root root 988 2008-06-27 12:34 CANCELED_INFO.csv
-rw-rr 1 root root 355 2008-06-27 12:34 COMMENTS.csv
-rw-rr 1 root root 2870057 2008-06-27 12:34 COMPILER_OUTPUT.csv
-rw-rr 1 root root 14 2008-06-27 12:34 DELETED_BUILD_TYPES.csv
-rw-rr 1 root root 68 2008-06-27 12:34 DOWNLOADED_ARTIFACTS.csv
-rw-rr 1 root root 16347 2008-06-27 12:34 sourceSchema.sql
-rw-rr 1 root root 13503 2008-06-27 12:34 targetSchema.sql


I hope that's enough information. If you need more please let me know.

Thanks

0

Thanks, I'm investigating your problem now.

One more question:
when you are trying to use migration tool with standalone HSQL - which
process throws OOM - HSQL's or DBMTool's one?

kroshka wrote:

I created a database called teamcity with utf8 character set. I am using mysql-connector-java-5.1.6-bin.jar.


/root/.BuildServer/config/database.properties:

driverName=com.mysql.jdbc.Driver
connectionUrl=jdbc:mysql://127.0.0.1/teamcity
connectionProperties.user=teamcity
connectionProperties.password=******

maxConnections=50
poolPreparedStatements=true

connectionProperties.useLocalSessionState=true
connectionProperties.elideSetAutoCommits=true
connectionProperties.alwaysSendSetIsolation=false

  1. uncomment if your database uses utf8 character set

connectionProperties.characterEncoding=UTF-8


dbMigration.properties:

  1. Internal TeamCity database running in standalone mode

  2. Starting HSQLDB in standalone mode: java -Xmx512M -cp <path_to_TeamCity_application_folder>\WEB-INF\lib\hsqldb.jar org.hsqldb.Server -database.0 <path_to_.BuildServer/system>\buildserver -dbname.0 buildserver

sourceDriver=org.hsqldb.jdbcDriver
sourceURL=jdbc:hsqldb:hsql://127.0.0.1/buildserver
sourceUser=sa
sourcePassword=''

  1. MySQL

  2. do not forget to place MySQL driver (mysql-connector-java-*.jar) into <path to TeamCity application folder>\WEB-INF\lib directory

targetDriver=com.mysql.jdbc.Driver
targetURL=jdbc:mysql://127.0.0.1:3306/teamcity
targetUser=teamcity
targetPassword=******


Starting hsqldb standalone:

build1:/opt/TeamCity/bin# /opt/java/bin/java -Xmx4000M -cp /opt/TeamCity/webapps/ROOT/WEB-INF/lib/hsqldb.jar org.hsqldb.Server -database.0 /root/.BuildServer/system/buildserver -dbname.0 buildserver &
build1:/opt/TeamCity/bin# : [Thread[main,5,main]]: checkRunning(false) entered
: [Thread[main,5,main]]: checkRunning(false) exited
: Startup sequence initiated from main() method
: Loaded properties from
: Initiating startup sequence...
: Server socket opened successfully in 6 ms.
: Database opened sucessfully in 20564 ms.
: Startup sequence completed in 20571 ms.
: 2008-06-27 12:33:56.496 HSQLDB server 1.8.0 is online
: To close normally, connect and execute SHUTDOWN SQL
: From command line, use + to abort abruptly


Running the migration tool:

build1:/opt/TeamCity/bin# ./migrateDB.sh migrate Using propeties file 'dbMigration.properties'.
Fri Jun 27 12:34:16 PDT 2008 Connecting to the source database jdbc:hsqldb:hsql://127.0.0.1/buildserver
Fri Jun 27 12:34:16 PDT 2008 Connecting to the target database jdbc:mysql://127.0.0.1:3306/teamcity
Fri Jun 27 12:34:16 PDT 2008 Initializing schema...
TABLES to be converted: (42) [[agent, agent_build_type_access, agent_sources_version, build_checkout_rules, build_labels, build_queue, build_revisions, build_runtime_info, build_type_vcs_change, canceled_info, comments, compiler_output, deleted_build_types, downloaded_artifacts, failed_tests_output, history, ignored_tests, light_history, paused_build_types, personal_vcs_changes, personal_vcs_history, remember_me, remote_run_build_types, run_configuration_policy, running, server, server_property, stats, tc_build_tags, test_info, test_names, user_blocks, user_notification_events, user_projects_order, user_projects_visibility, user_property, user_roles, user_watch_type, users, vcs_changes, vcs_history, vcs_root_versions]]
Fri Jun 27 12:34:18 PDT 2008 Exporting /opt/TeamCity/bin/TC-export-1214595256357/targetSchema.sql
Fri Jun 27 12:34:18 PDT 2008 Exporting data to TC-export-1214595256357
Fri Jun 27 12:34:18 PDT 2008 Exporting /opt/TeamCity/bin/TC-export-1214595256357/sourceSchema.sql
Error processing source data. Original error: java.sql.SQLException: Connection is broken: java.lang.OutOfMemoryError: Java heap space
An error has occured during migration. Could not proceed.


Migration temp directory:

build1:/opt/TeamCity/bin# ls -al TC-export-1214595256357
total 7532
drwxr-xr-x 2 root root 4096 2008-06-27 12:34 .
drwxr-xr-x 5 root root 4096 2008-06-27 12:34 ..
-rw-rr 1 root root 24 2008-06-27 12:34 AGENT_BUILD_TYPE_ACCESS.csv
-rw-rr 1 root root 364 2008-06-27 12:34 AGENT.csv
-rw-rr 1 root root 20139 2008-06-27 12:34 AGENT_SOURCES_VERSION.csv
-rw-rr 1 root root 517393 2008-06-27 12:34 BUILD_CHECKOUT_RULES.csv
-rw-rr 1 root root 70 2008-06-27 12:34 BUILD_LABELS.csv
-rw-rr 1 root root 605 2008-06-27 12:34 BUILD_QUEUE.csv
-rw-rr 1 root root 710366 2008-06-27 12:34 BUILD_REVISIONS.csv
-rw-rr 1 root root 757 2008-06-27 12:34 BUILD_RUNTIME_INFO.csv
-rw-rr 1 root root 3493805 2008-06-27 12:34 BUILD_TYPE_VCS_CHANGE.csv
-rw-rr 1 root root 988 2008-06-27 12:34 CANCELED_INFO.csv
-rw-rr 1 root root 355 2008-06-27 12:34 COMMENTS.csv
-rw-rr 1 root root 2870057 2008-06-27 12:34 COMPILER_OUTPUT.csv
-rw-rr 1 root root 14 2008-06-27 12:34 DELETED_BUILD_TYPES.csv
-rw-rr 1 root root 68 2008-06-27 12:34 DOWNLOADED_ARTIFACTS.csv
-rw-rr 1 root root 16347 2008-06-27 12:34 sourceSchema.sql
-rw-rr 1 root root 13503 2008-06-27 12:34 targetSchema.sql


I hope that's enough information. If you need more please let me know.

Thanks



--
Alexey Gopachenko
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Next TC 4.0 EAP will contain significantly improved version of migration
tool specifically refactored to reduce memory consumption.

--
Alexey Gopachenko
JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

This is a very late reply, sorry. I decided to put this one to rest until some newer version of TC.

I am currently working on moving TC to a new server and as part of that I thought I'd try to migrate the database from the internal engine to mysql. I keep running in similar problems as before. System is Debian Lenny amd64, 32 GB, 2 CPUs, 8 cores. I even tried setting the memory to ~32 GB which ofcourse is rather excessive. Teamcity version is TeamCity        Enterprise Version 4.5.3 (build 9035).

To reply to your earlier question "
One more question:
when you are trying to use migration tool with standalone HSQL - which
process throws OOM - HSQL's or DBMTool's one?"

I would think it's the DBMTool because the standalone HSQL is still running afterwards.

Any insights are greatly appreciated, thank you.

# java -Xmx16384m -cp ../webapps/ROOT/WEB-INF/lib/hsqldb.jar org.hsqldb.Server -database.0 /root/.BuildServer/system/buildserver -dbname.0 buildserver &

# ./migrateDB.sh migrate
Log4J configuraiton file /opt/TeamCity/bin/../conf/teamcity-server-log4j.xml will be monitored with interval 10 seconds.
Using propeties file: dbMigration.properties
Connecting to the source database: jdbc:hsqldb:hsql://localhost/buildserver
Connecting to the target database: jdbc:mysql://localhost:3306/build
Initializing schema...
Saving /opt/TeamCity/bin/TC-export-1267139643988/targetSchema.sql
Tables to be converted (58): [[action_history, agent, agent_build_type_access, agent_sources_version, build_checkout_rules, build_data_storage, build_dependency, build_labels, build_queue, build_revisions, build_runtime_info, build_state, build_type_vcs_change, canceled_info, comments, compiler_output, default_build_parameters, deleted_build_types, downloaded_artifacts, failed_tests_output, history, ignored_tests, light_history, paused_build_types, personal_build_relative_path, personal_vcs_changes, personal_vcs_history, projects, remember_me, remote_run_build_types, run_configuration_policy, running, server, server_property, stats, tc_build_tags, test_failure_rate, test_info, test_info_trunk, test_names, user_blocks, user_build_parameters, user_notification_events, user_projects_order, user_projects_visibility, user_property, user_roles, user_watch_type, usergroup_notification_events, usergroup_roles, usergroup_subgroups, usergroup_users, usergroup_watch_type, usergroups, users, vcs_changes, vcs_history, vcs_root_versions]]
Exporting to /opt/TeamCity/bin/TC-export-1267139643988
Saving /opt/TeamCity/bin/TC-export-1267139643988/sourceSchema.sql

Thu Feb 25 15:14:13 PST 2010                                   table :      rows : progress

Thu Feb 25 15:14:13 PST 2010                          action_history :        26 : 30% 50% 80% 100%
Thu Feb 25 15:14:13 PST 2010                                   agent :         3 : 100%
Thu Feb 25 15:14:13 PST 2010                 agent_build_type_access :         0 :
Thu Feb 25 15:14:13 PST 2010                   agent_sources_version :      1534 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Thu Feb 25 15:14:14 PST 2010                    build_checkout_rules :     31540 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Thu Feb 25 15:14:15 PST 2010                      build_data_storage :     96074 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Thu Feb 25 15:14:17 PST 2010                        build_dependency :       434 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Thu Feb 25 15:14:17 PST 2010                            build_labels :         0 :
Thu Feb 25 15:14:17 PST 2010                             build_queue :         1 : 100%
Thu Feb 25 15:14:17 PST 2010                         build_revisions :     31666 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Thu Feb 25 15:14:18 PST 2010                      build_runtime_info :        21 : 80% 90% 100%
Thu Feb 25 15:14:18 PST 2010                             build_state :      6783 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Thu Feb 25 15:14:20 PST 2010                   build_type_vcs_change :    603921 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Thu Feb 25 15:14:26 PST 2010                           canceled_info :        45 : 20% 40% 60% 80% 100%
Thu Feb 25 15:14:26 PST 2010                                comments :        32 : 40% 50% 90% 100%
Thu Feb 25 15:14:26 PST 2010                         compiler_output :     18861 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Thu Feb 25 15:14:27 PST 2010                default_build_parameters :     49938 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Thu Feb 25 15:14:27 PST 2010                     deleted_build_types :         0 :
Thu Feb 25 15:14:27 PST 2010                    downloaded_artifacts :         0 :
java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid347.hprof ...
Heap dump file created [526902060 bytes in 1.754 secs]
[2010-02-25 15:14:45,975]  ERROR -     jetbrains.buildServer.dbmt - Failed to export source database

See error details in the: ../logs/teamcity-dbmt.log
Closing source database connection...
Closing target database connection...
Done.

From the log:
(..)
[2010-02-25 15:36:13,006]   INFO [           main] -     jetbrains.buildServer.dbmt - Exporting table: downloaded_artifacts, rows number: 0
[2010-02-25 15:36:31,882]  ERROR [           main] -     jetbrains.buildServer.dbmt - Failed to export source database

[2010-02-25 15:36:31,883]  DEBUG [           main] -     jetbrains.buildServer.dbmt - org.dbunit.dataset.DataSetException: java.sql.SQLException: Connection is broken: java.lang.OutOfMemoryError: Java heap space
org.dbunit.dataset.DataSetException: java.sql.SQLException: Connection is broken: java.lang.OutOfMemoryError: Java heap space
        at org.dbunit.database.DatabaseDataSet.getTable(DatabaseDataSet.java:265)
        at org.dbunit.database.DatabaseTableIterator.getTable(DatabaseTableIterator.java:85)
        at org.dbunit.dataset.filter.AbstractTableFilter$FilterIterator.getTable(AbstractTableFilter.java:137)
        at org.dbunit.dataset.stream.DataSetProducerAdapter.produce(DataSetProducerAdapter.java:74)
        at org.dbunit.dataset.csv.CsvDataSetWriter.write(CsvDataSetWriter.java:87)
        at jetbrains.buildServer.serverSide.DBMTool.exportSourceDatabase(DBMTool.java:14)
        at jetbrains.buildServer.serverSide.DBMTool.main(DBMTool.java:295)
java.sql.SQLException: Connection is broken: java.lang.OutOfMemoryError: Java heap space
        at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
        at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
        at org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source)
        at org.dbunit.database.AbstractResultSetTable.<init>(AbstractResultSetTable.java:100)
        at org.dbunit.database.ForwardOnlyResultSetTable.<init>(ForwardOnlyResultSetTable.java:59)
        at org.dbunit.database.ForwardOnlyResultSetTableFactory.createTable(ForwardOnlyResultSetTableFactory.java:59)
        at org.dbunit.database.DatabaseDataSet.getTable(DatabaseDataSet.java:261)
        at org.dbunit.database.DatabaseTableIterator.getTable(DatabaseTableIterator.java:85)
        at org.dbunit.dataset.filter.AbstractTableFilter$FilterIterator.getTable(AbstractTableFilter.java:137)
        at org.dbunit.dataset.stream.DataSetProducerAdapter.produce(DataSetProducerAdapter.java:74)
        at org.dbunit.dataset.csv.CsvDataSetWriter.write(CsvDataSetWriter.java:87)
        at jetbrains.buildServer.serverSide.DBMTool.exportSourceDatabase(DBMTool.java:14)
        at jetbrains.buildServer.serverSide.DBMTool.main(DBMTool.java:295)
[2010-02-25 15:36:31,899]   INFO [           main] -     jetbrains.buildServer.dbmt - Closing source database connection...
[2010-02-25 15:36:31,900]   INFO [           main] -     jetbrains.buildServer.dbmt - Closing target database connection...
[2010-02-25 15:36:31,900]   INFO [           main] -     jetbrains.buildServer.dbmt - Done.

0

Hello,

thank you for so detailed description.

Your database looks grown too large for HSQL...

1. Specify more memory for the migration tool. In order to do it, please modify the "migrateDB.sh" file - find the -Xmx512m option and increase the memory limit, up to one you're specifying for HSQL (16384m) for instance. And try to migrate.

2. If the first step don't help, please use any SQL console tool for removing data from the 'failed_tests_output' table. I hope it will help.

Please let me know did it help.


BTW, I can recommend you to upgrade your TeamCity software up to 4.5.6 (you can download it from gere: http://confluence.jetbrains.net/display/TW/Latest+4.5.x+Release).
Don't forget to backup your data before upgrading (right whole the <TeamCity_data> directory, see http://confluence.jetbrains.net/display/TCD4/TeamCity+Data+Backup#TeamCityDataBackup-ServerBackup for details).
Upgrade details are described here: http://confluence.jetbrains.net/display/TCD4/Upgrade#Upgrade-dist
When upgrading, ensure that the old installation is removed (or moved to another directory) to avoid Tomcat starting both installations simultaneously.


Best regards,
Leonid

0

Thanks for the suggestion, increasing the memory allocation in migrateDB.sh does seem to work. I gave it ~8 GB. But it's stuck for more than 30 minutes on:

Fri Feb 26 17:12:10 PST 2010                       vcs_root_versions :       131 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Importing from /opt/TeamCity/bin/TC-export-1267233045118

Fri Feb 26 17:12:10 PST 2010                                   table :      rows : progress

Fri Feb 26 17:12:10 PST 2010                          action_history :        26 : 30% 50% 80% 100%
Fri Feb 26 17:12:10 PST 2010                                   agent :         3 : 100%
Fri Feb 26 17:12:10 PST 2010                 agent_build_type_access :         0 :
Fri Feb 26 17:12:10 PST 2010                   agent_sources_version :      1534 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Fri Feb 26 17:12:11 PST 2010                    build_checkout_rules :     31950 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Fri Feb 26 17:12:19 PST 2010                      build_data_storage :     96533 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Fri Feb 26 17:12:38 PST 2010                        build_dependency :       438 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Fri Feb 26 17:12:38 PST 2010                            build_labels :         0 :
Fri Feb 26 17:12:38 PST 2010                             build_queue :         1 : 100%
Fri Feb 26 17:12:38 PST 2010                         build_revisions :     32076 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Fri Feb 26 17:12:48 PST 2010                      build_runtime_info :        21 : 80% 90% 100%
Fri Feb 26 17:12:48 PST 2010                             build_state :      6865 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Fri Feb 26 17:12:50 PST 2010                   build_type_vcs_change :    606517 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Fri Feb 26 17:14:00 PST 2010                           canceled_info :        51 : 50% 60% 70% 80% 90% 100%
Fri Feb 26 17:14:00 PST 2010                                comments :        32 : 40% 50% 90% 100%
Fri Feb 26 17:14:00 PST 2010                         compiler_output :     18961 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Fri Feb 26 17:14:03 PST 2010                default_build_parameters :     50670 : 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%
Fri Feb 26 17:14:15 PST 2010                     deleted_build_types :         0 :
Fri Feb 26 17:14:15 PST 2010                    downloaded_artifacts :         0 :
Fri Feb 26 17:14:15 PST 2010                     failed_tests_output :     64564 :

I am not sure how long this normally should take.

Would deleting data from the failed_tests_output work? I assume if I would delete all data I will lose all logs of failed tests? In that case I probably should delete everything before 2009 or something.

Yes I will be upgrading.

0

Hi,

> Would deleting data from the failed_tests_output work?
> I assume if I would delete all data I will lose all logs of failed tests?

Yes. If you delete these data you'll lost only failure info recorded in version TeamCity 3.x or early. Test failure info since 4.0 is recorded into other tables and files. So, the data that are in the 'failed_tests_output' are really very old.

> I am not sure how long this normally should take.

It depends on the database size; for large databases one hour per table is normal (for big tables like this one).

> Yes I will be upgrading.

In this case it might be reasonable first to upgrade software up to 5.x version and then to migrate to the other database - the new migration tool (maintainDB) works better with large tables. But, in case of HSQL, opening a database in-process might save memory: when you're querying a trivial SQL query ("select * from mytable", for instance) using HSQL DB that is out of process, HSQL DB requires double amount of memory - for holding whole table on the server side and for holding result of the query (really a copy of this table) on the client side (inside JDBC driver). So, after upgrade, before running the maintainDB tool, I recommend you to modify the 'database.properties' file to open HSQL DB in-process.

Best regards,
Leonid

0

> Yes. If you delete these data you'll lost only failure info recorded in version TeamCity 3.x or early. Test failure info since 4.0 is recorded into other tables and files. So, the data that are in the
> 'failed_tests_output' are really very old.

Ok, I will just go ahead and delete that table, since that data isn't important anymore.

> In this case it might be reasonable first to upgrade software up to 5.x version and then to migrate to the other database - the new migration tool

I believe our license only allows for 4.x versions, we're at 4.5.3 right now and I believe the newest 4.x is 4.5.6.

> So, after upgrade, before running the maintainDB tool, I recommend you to modify the 'database.properties' file to open HSQL DB in-process.

You mean starting HSQL DB as a stdnadlone process? Right now it's not.

0

> You mean starting HSQL DB as a stdnadlone process?

No, just in process, not as a standalone process. In case of a standalone HSQL requires doubled amount of memory when doing 'select'.

Best regards,

--
Leonid

0

I tried to run migration.sh without standalone HSQL. It still seemed to get stuck at the same point.
I went ahead and dropped table failed_tests_output but now the migration tool complains it doesn't exist. Do I need to update something to tell teamcity the table is gone? Teamcity seems to run fine without the table.

[2010-03-15 13:37:09,454]   INFO [           main] -     jetbrains.buildServer.dbmt - Connecting to the target database: jdbc:mysql://localhost:3306/build
[2010-03-15 13:37:09,694]   INFO [           main] -     jetbrains.buildServer.dbmt - Initializing schema...
[2010-03-15 13:37:13,198]   INFO [           main] -     jetbrains.buildServer.dbmt - Saving /opt/TeamCity/bin/TC-export-1268689032975/targetSchema.sql
[2010-03-15 13:37:13,202]   INFO [           main] -     jetbrains.buildServer.dbmt - Tables to be converted (58): [[action_history, agent, agent_build_type_access, agent_sources_version, build_checkout_rules, build_data_storage, build_dependency, build_labels, build_queue, build_revisions, build_runtime_info, build_state, build_type_vcs_change, canceled_info, comments, compiler_output, default_build_parameters, deleted_build_types, downloaded_artifacts, failed_tests_output, history, ignored_tests, light_history, paused_build_types, personal_build_relative_path, personal_vcs_changes, personal_vcs_history, projects, remember_me, remote_run_build_types, run_configuration_policy, running, server, server_property, stats, tc_build_tags, test_failure_rate, test_info, test_info_trunk, test_names, user_blocks, user_build_parameters, user_notification_events, user_projects_order, user_projects_visibility, user_property, user_roles, user_watch_type, usergroup_notification_events, usergroup_roles, usergroup_subgroups, usergroup_users, usergroup_watch_type, usergroups, users, vcs_changes, vcs_history, vcs_root_versions]]
[2010-03-15 13:37:13,202]   INFO [           main] -     jetbrains.buildServer.dbmt - Exporting to /opt/TeamCity/bin/TC-export-1268689032975
[2010-03-15 13:37:13,333]   INFO [           main] -     jetbrains.buildServer.dbmt - Saving /opt/TeamCity/bin/TC-export-1268689032975/sourceSchema.sql
[2010-03-15 13:37:16,668]  ERROR [           main] -     jetbrains.buildServer.dbmt - Failed to export source database

[2010-03-15 13:37:16,669]  DEBUG [           main] -     jetbrains.buildServer.dbmt - java.sql.SQLException: Table not found in statement [SELECT COUNT(*) FROM failed_tests_output]
java.sql.SQLException: Table not found in statement [SELECT COUNT(*) FROM failed_tests_output]
        at org.hsqldb.jdbc.Util.sqlException(Unknown Source)
        at org.hsqldb.jdbc.jdbcStatement.fetchResult(Unknown Source)
        at org.hsqldb.jdbc.jdbcStatement.executeQuery(Unknown Source)
        at jetbrains.buildServer.serverSide.DBMTool.dumpSizes(DBMTool.java:212)
        at jetbrains.buildServer.serverSide.DBMTool.exportSourceDatabase(DBMTool.java:40)
        at jetbrains.buildServer.serverSide.DBMTool.main(DBMTool.java:295)
[2010-03-15 13:37:16,670]   INFO [           main] -     jetbrains.buildServer.dbmt - Closing source database connection...
[2010-03-15 13:37:16,671]   INFO [           main] -     jetbrains.buildServer.dbmt - Closing connection...
[2010-03-15 13:37:24,391]   INFO [           main] -     jetbrains.buildServer.dbmt - Closing target database connection...
[2010-03-15 13:37:24,391]   INFO [           main] -     jetbrains.buildServer.dbmt - Done.

0

Hi,

the migrateDB tool expected the 'failed_tests_output' table from your database but could not find it.

Now, you can restore the database files from backup, and delete data from the 'failed_tests_output' table but leave an empty table (not to drop whole table),
or you can create this table in the current database:

create table failed_tests_output

(  

  build_id bigint not null,   

  test_id integer not null,   

  problem_description varchar(256),   

  std_output varchar(40960),   

  error_output varchar(40960),   

  stacktrace varchar(40960),   

  expected varchar(40960),   

  actual varchar(40960)

)

and then try again.

Best regards,
Leonid

0

I did have the idea to recreate the table, but couldn't figure out the right statement. Thanks for that, I was able to recreate the table and the migration completed successfully with an empty failed_tests_output table.  

0

Please sign in to leave a comment.