nuodb / migration-tools

Migration tools for NuoDB
http://nuodb.github.com/migration-tools/
BSD 3-Clause "New" or "Revised" License
27 stars 10 forks source link

MySQL Duplicate Index Bug #24

Open rnavarro opened 11 years ago

rnavarro commented 11 years ago

Hello,

It appears that the migrator is getting confused on some indexes I have setup in MySQL:

bin/nuodb-migrator schema --source.driver=com.mysql.jdbc.Driver --source.url=jdbc:mysql://127.0.0.1:3306/dbname --source.username=sdfsdf --source.password=sdfsdf --target.url=jdbc:com.nuodb://localhost:48004/dbname --target.username=rnavarro --target.password=passw0rd --target.schema=test
17-07-2013 01:29:17 (ERROR) (com.nuodb.migrator.jdbc.metadata.generator.ScriptExporterBase.exportScript(ScriptExporterBase.java:61)) - Failed exporting script CREATE INDEX "IDX_connector_purchase_order_line_item_connector_id" ON "test"."connector_purchase_order_line_item" ("connector_id")
Jul 17, 2013 1:29:17 AM com.nuodb.migrator.bootstrap.Bootstrap main
SEVERE: Execution failed
com.nuodb.migrator.cli.run.CliRunException: java.sql.SQLException: index IDX_connector_purchase_order_line_item_connector_id already exists on table test.CONNECTOR_PURCHASE_ORDER_LINE_ITEM
    at com.nuodb.migrator.cli.run.CliRunJob.run(CliRunJob.java:63)
    at com.nuodb.migrator.cli.run.CliRunJob.run(CliRunJob.java:50)
    at com.nuodb.migrator.cli.CliHandler.handleRun(CliHandler.java:200)
    at com.nuodb.migrator.cli.CliHandler.handleOptionSet(CliHandler.java:148)
    at com.nuodb.migrator.cli.CliHandler.boot(CliHandler.java:74)
    at com.nuodb.migrator.bootstrap.Bootstrap.boot(Bootstrap.java:74)
    at com.nuodb.migrator.bootstrap.Bootstrap.main(Bootstrap.java:109)
Caused by: java.sql.SQLException: index IDX_connector_purchase_order_line_item_connector_id already exists on table test.CONNECTOR_PURCHASE_ORDER_LINE_ITEM
    at com.nuodb.jdbc.RemConnection.sendAndReceive(RemConnection.java:837)
    at com.nuodb.jdbc.RemStatement.executeUpdate(RemStatement.java:270)
    at com.nuodb.jdbc.RemStatement.executeUpdate(RemStatement.java:260)
    at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228)
    at org.apache.commons.dbcp.DelegatingStatement.executeUpdate(DelegatingStatement.java:228)
    at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at com.nuodb.migrator.utils.ReflectionUtils.invokeMethod(ReflectionUtils.java:111)
    at com.nuodb.migrator.utils.ReflectionInvocationHandler.invokeTarget(ReflectionInvocationHandler.java:57)
    at com.nuodb.migrator.jdbc.connection.QueryLoggingConnectionProvider$ConnectionAwareStatementHandler.invokeExecute(QueryLoggingConnectionProvider.java:212)
    at com.nuodb.migrator.jdbc.connection.QueryLoggingConnectionProvider$ConnectionAwareStatementHandler.invoke(QueryLoggingConnectionProvider.java:204)
    at sun.proxy.$Proxy3.executeUpdate(Unknown Source)
    at com.nuodb.migrator.jdbc.metadata.generator.ConnectionScriptExporter.doExportScript(ConnectionScriptExporter.java:61)
    at com.nuodb.migrator.jdbc.metadata.generator.ScriptExporterBase.exportScript(ScriptExporterBase.java:58)
    at com.nuodb.migrator.jdbc.metadata.generator.CompositeScriptExporter.exportScript(CompositeScriptExporter.java:63)
    at com.nuodb.migrator.jdbc.metadata.generator.CompositeScriptExporter.exportScripts(CompositeScriptExporter.java:70)
    at com.nuodb.migrator.schema.SchemaJob.doExecute(SchemaJob.java:83)
    at com.nuodb.migrator.schema.SchemaJob.doExecute(SchemaJob.java:50)
    at com.nuodb.migrator.job.decorate.DecoratingJobBase.execute(DecoratingJobBase.java:50)
    at com.nuodb.migrator.job.SimpleJobExecutor.execute(SimpleJobExecutor.java:105)
    at com.nuodb.migrator.cli.run.CliRunJob.run(CliRunJob.java:57)
    ... 6 more
tazija commented 11 years ago

Hello Robert, I see two possible reasons for the issue. Have you previously loaded the table/index either manually or using the NuoDB Migrator? Also, you may have several indexes on the same column/columns with different names/types in source MySQL database - can you share complete DDL for the table, please.

Thank you, Sergey.