8000 Keycloak fails to start on MySQL Cluster due to missing primary key in databasechangelog · Issue #38602 · keycloak/keycloak · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Keycloak fails to start on MySQL Cluster due to missing primary key in databasechangelog #38602
Closed
@sguilhen

Description

@sguilhen

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

storage

Describe the bug

When starting Keycloak connected to a MySQL cluster that has replication enabled, the process fails with the following error:

2025-03-26 14:16:32,759 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: liquibase.exception.LiquibaseException: liquibase.exception.DatabaseException: liquibase.exception.DatabaseException: The table does not comply with the requirements by an external plugin. [Failed SQL: (3098) INSERT INTO keycloak.DATABASECHANGELOG (ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, MD5SUM, `DESCRIPTION`, COMMENTS, EXECTYPE, CONTEXTS, LABELS, LIQUIBASE, DEPLOYMENT_ID) VALUES ('1.0.0.Final-KEYCLOAK-5461', 'sthorger@redhat.com', 'META-INF/jpa-changelog-1.0.0.Final.xml', NOW(), 1, '9:6f1016664e21e16d26517a4418f5e3df', 'createTable tableName=APPLICATION_DEFAULT_ROLES; createTable tableName=CLIENT; createTable tableName=CLIENT_SESSION; createTable tableName=CLIENT_SESSION_ROLE; createTable tableName=COMPOSITE_ROLE; createTable tableName=CREDENTIAL; createTable tab...', '', 'EXECUTED', NULL, NULL, 'DEV', '2998578512')]
...
 2025-03-26 14:16:32,760 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: The table does not comply with the requirements by an external plugin.

On MySQL cluster side, we have:

8d57f27ed7f9 2025-03-26T14:23:25.062245Z 2387 [ERROR] [MY-011542] [Repl] Plugin group_replication reported: 'Table DATABASECHANGELOG does not have any PRIMARY KEY. This is not compatible with Group Replication.'

Disabling the primary key restriction in MySQL does not affect the results, error persists.

The Liquibase DATABASECHANGELOG documentation explicitly says there is no primary key on the DATABASECHANGELOG, apparently to avoid any database-specific restrictions on key lengths. Also, it says that The composite of id, author, and filename is unique across all rows of the table.

MySQL documentation also tells that tables need to have primary keys.

Version

26.1.4

Regression

  • The issue is a regression

Expected behavior

Keycloak should successfully start with a MySQL cluster.

Actual behavior

Keycloak fails to start due to DATABASECHANGELOG missing a primary key.

How to Reproduce?

Start keycloak with a MySQL cluster (connection url should list all nodes like db-url=jdbc:mysql://192.168.10.108:3306,192.168.10.108:3307,192.168.10.108:3308/keycloak?autoReconnect=true&failOverReadOnly=false&maxReconnects=10)

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0