Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metabase Initialization Error with TiDB Cloud Serverless [Multiple primary key defined] #46534

Open
wph95 opened this issue Aug 30, 2023 · 1 comment
Labels
type/question The issue belongs to a question.

Comments

@wph95
Copy link

wph95 commented Aug 30, 2023

Bug Report

  1. Minimal reproduce step

Set up a TiDB Cloud Serverless instance.
Attempt to use Metabase with MySQL as the database.

    export MB_DB_TYPE=mysql
    export MB_DB_CONNECTION_URI="jdbc:mysql://xxxxx&trustServerCertificate=true"
    java -jar metabase.jar
  1. What did you expect to see?
    I expected Metabase to initialize successfully and use MySQL as the database without any issues.
  2. What did you see instead
    Metabase initialization failed with the following error:
    2023-08-30 16:08:48,936 ERROR metabase.core :: Metabase Initialization FAILED
    liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for change set migrations/000_migrations.yaml::v46.00-011::snoe:
         Reason: liquibase.exception.DatabaseException: (conn=100) Multiple primary key defined [Failed SQL: (1068) ALTER TABLE query_action DROP PRIMARY KEY, ADD PRIMARY KEY pk_query_action (action_id)]
    	at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:126)
    	at liquibase.Liquibase.lambda$null$0(Liquibase.java:265)
    	at liquibase.Scope.lambda$child$0(Scope.java:180)
    	at liquibase.Scope.child(Scope.java:189)
    	at liquibase.Scope.child(Scope.java:179)
    	at liquibase.Scope.child(Scope.java:158)
    	at liquibase.Scope.child(Scope.java:243)
    	at liquibase.Liquibase.lambda$update$1(Liquibase.java:264)
    	at liquibase.Scope.lambda$child$0(Scope.java:180)
    	at liquibase.Scope.child(Scope.java:189)
    	at liquibase.Scope.child(Scope.java:179)
    	at liquibase.Scope.child(Scope.java:158)
    	at liquibase.Liquibase.runInScope(Liquibase.java:2405)
    	at liquibase.Liquibase.update(Liquibase.java:211)
    	at liquibase.Liquibase.update(Liquibase.java:197)
    	at liquibase.Liquibase.update(Liquibase.java:193)
    	at metabase.db.liquibase$migrate_up_if_needed_BANG_.invokeStatic(liquibase.clj:156)
    	at metabase.db.liquibase$migrate_up_if_needed_BANG_.invoke(liquibase.clj:144)
    	at metabase.db.setup$fn__52038$migrate_BANG___52043$fn__52044$fn__52045.invoke(setup.clj:78)
    	at metabase.db.liquibase$fn__51707$do_with_liquibase__51712$fn__51713.invoke(liquibase.clj:66)
    	at metabase.db.liquibase$fn__51707$do_with_liquibase__51712.invoke(liquibase.clj:59)
    	at metabase.db.setup$fn__52038$migrate_BANG___52043$fn__52044.invoke(setup.clj:73)
    	at metabase.db.setup$fn__52038$migrate_BANG___52043.doInvoke(setup.clj:52)
    	at clojure.lang.RestFn.invoke(RestFn.java:445)
    	at metabase.db.setup$fn__52102$run_schema_migrations_BANG___52107$fn__52108.invoke(setup.clj:131)
    	at metabase.db.setup$fn__52102$run_schema_migrations_BANG___52107.invoke(setup.clj:125)
    	at metabase.db.setup$fn__52155$setup_db_BANG___52160$fn__52161$fn__52164$fn__52165.invoke(setup.clj:156)
    	at metabase.util.jvm$do_with_us_locale.invokeStatic(jvm.clj:239)
    	at metabase.util.jvm$do_with_us_locale.invoke(jvm.clj:225)
    	at metabase.db.setup$fn__52155$setup_db_BANG___52160$fn__52161$fn__52164.invoke(setup.clj:152)
    	at metabase.db.setup$fn__52155$setup_db_BANG___52160$fn__52161.invoke(setup.clj:151)
    	at metabase.db.setup$fn__52155$setup_db_BANG___52160.invoke(setup.clj:145)
    	at metabase.db$setup_db_BANG_$fn__52188.invoke(db.clj:66)
    	at metabase.db$setup_db_BANG_.invokeStatic(db.clj:61)
    	at metabase.db$setup_db_BANG_.invoke(db.clj:52)
    	at metabase.core$init_BANG__STAR_.invokeStatic(core.clj:113)
    	at metabase.core$init_BANG__STAR_.invoke(core.clj:99)
    	at metabase.core$init_BANG_.invokeStatic(core.clj:159)
    	at metabase.core$init_BANG_.invoke(core.clj:154)
    	at metabase.core$start_normally.invokeStatic(core.clj:171)
    	at metabase.core$start_normally.invoke(core.clj:165)
    	at metabase.core$_main.invokeStatic(core.clj:204)
    	at metabase.core$_main.doInvoke(core.clj:198)
    	at clojure.lang.RestFn.invoke(RestFn.java:397)
    	at clojure.lang.AFn.applyToHelper(AFn.java:152)
    	at clojure.lang.RestFn.applyTo(RestFn.java:132)
    	at clojure.lang.Var.applyTo(Var.java:705)
    	at clojure.core$apply.invokeStatic(core.clj:667)
    	at clojure.core$apply.invoke(core.clj:662)
    	at metabase.bootstrap$_main.invokeStatic(bootstrap.clj:31)
    	at metabase.bootstrap$_main.doInvoke(bootstrap.clj:28)
    	at clojure.lang.RestFn.invoke(RestFn.java:397)
    	at clojure.lang.AFn.applyToHelper(AFn.java:152)
    	at clojure.lang.RestFn.applyTo(RestFn.java:132)
    	at metabase.bootstrap.main(Unknown Source)
    Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set migrations/000_migrations.yaml::v46.00-011::snoe:
         Reason: liquibase.exception.DatabaseException: (conn=100) Multiple primary key defined [Failed SQL: (1068) ALTER TABLE query_action DROP PRIMARY KEY, ADD PRIMARY KEY pk_query_action (action_id)]
    	at liquibase.changelog.ChangeSet.execute(ChangeSet.java:696)
    	at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:56)
    	at liquibase.changelog.ChangeLogIterator$2.lambda$null$0(ChangeLogIterator.java:113)
    	at liquibase.Scope.lambda$child$0(Scope.java:180)
    	at liquibase.Scope.child(Scope.java:189)
    	at liquibase.Scope.child(Scope.java:179)
    	at liquibase.Scope.child(Scope.java:158)
    	at liquibase.changelog.ChangeLogIterator$2.lambda$run$1(ChangeLogIterator.java:112)
    	at liquibase.Scope.lambda$child$0(Scope.java:180)
    	at liquibase.Scope.child(Scope.java:189)
    	at liquibase.Scope.child(Scope.java:179)
    	at liquibase.Scope.child(Scope.java:158)
    	at liquibase.Scope.child(Scope.java:243)
    	at liquibase.changelog.ChangeLogIterator$2.run(ChangeLogIterator.java:93)
    	at liquibase.Scope.lambda$child$0(Scope.java:180)
    	at liquibase.Scope.child(Scope.java:189)
    	at liquibase.Scope.child(Scope.java:179)
    	at liquibase.Scope.child(Scope.java:158)
    	at liquibase.Scope.child(Scope.java:243)
    	at liquibase.Scope.child(Scope.java:247)
    	at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:65)
    	... 54 more
    Caused by: liquibase.exception.DatabaseException: (conn=100) Multiple primary key defined [Failed SQL: (1068) ALTER TABLE query_action DROP PRIMARY KEY, ADD PRIMARY KEY pk_query_action (action_id)]
    	at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:397)
    	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:83)
    	at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:151)
    	at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1279)
    	at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1261)
    	at liquibase.changelog.ChangeSet.execute(ChangeSet.java:661)
    	... 74 more
    Caused by: java.sql.SQLSyntaxErrorException: (conn=100) Multiple primary key defined
    	at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.createException(ExceptionFactory.java:62)
    	at org.mariadb.jdbc.internal.util.exceptions.ExceptionFactory.create(ExceptionFactory.java:158)
    	at org.mariadb.jdbc.MariaDbStatement.executeExceptionEpilogue(MariaDbStatement.java:262)
    	at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:362)
    	at org.mariadb.jdbc.MariaDbStatement.execute(MariaDbStatement.java:500)
    	at com.mchange.v2.c3p0.impl.NewProxyStatement.execute(NewProxyStatement.java:75)
    	at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:393)
    	... 79 more
    Caused by: org.mariadb.jdbc.internal.util.exceptions.MariaDbSqlException: Multiple primary key defined
    	at org.mariadb.jdbc.internal.util.exceptions.MariaDbSqlException.of(MariaDbSqlException.java:34)
    	at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.exceptionWithQuery(AbstractQueryProtocol.java:194)
    	at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:262)
    	at org.mariadb.jdbc.MariaDbStatement.executeInternal(MariaDbStatement.java:356)
    	... 82 more
    Caused by: java.sql.SQLException: Multiple primary key defined
    	at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readErrorPacket(AbstractQueryProtocol.java:1695)
    	at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.readPacket(AbstractQueryProtocol.java:1557)
    	at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.getResult(AbstractQueryProtocol.java:1520)
    	at org.mariadb.jdbc.internal.protocol.AbstractQueryProtocol.executeQuery(AbstractQueryProtocol.java:256)
    	... 83 more
    2023-08-30 16:08:48,947 INFO metabase.core :: Metabase Shutting Down ...
    2023-08-30 16:08:48,948 INFO metabase.server :: Shutting Down Embedded Jetty Webserver
    2023-08-30 16:08:48,956 INFO metabase.core :: Metabase Shutdown COMPLETE
    
  1. What is your TiDB version?
    TiDB Cloud Serverless
@wph95 wph95 added the type/bug The issue is confirmed as a bug. label Aug 30, 2023
@tiancaiamao tiancaiamao added the type/question The issue belongs to a question. label Aug 31, 2023
@tiancaiamao
Copy link
Contributor

ALTER TABLE query_action DROP PRIMARY KEY

Drop primary key is not supported in TiDB, ref #18090

@jebter jebter removed the type/bug The issue is confirmed as a bug. label Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/question The issue belongs to a question.
Projects
None yet
Development

No branches or pull requests

3 participants