Skip to content

Conversation

@EricWittmann
Copy link
Member

Summary

Adds composite primary keys to three label tables (group_labels, artifact_labels, and version_labels) across all database types (MySQL, PostgreSQL, H2, and MSSQL) to enable MySQL InnoDB Cluster compatibility.

Changes

  • group_labels: Added PK on (groupId, labelKey)
  • artifact_labels: Added PK on (groupId, artifactId, labelKey)
  • version_labels: Added PK on (globalId, labelKey)

Rationale

MySQL InnoDB Cluster requires all tables to have primary keys defined. The missing primary keys on these three label tables prevented cluster initialization from completing successfully.

The chosen composite keys are based on the natural keys of each table - the foreign key column(s) plus labelKey - which prevents duplicate label keys for the same entity (group/artifact/version) as expected by the application logic.

Impact

  • New installations: Will automatically have primary keys defined on these tables
  • Existing installations: Will continue to work without issues (PKs are not functionally required by the application)
  • MySQL InnoDB Cluster: Will now initialize successfully with new deployments
  • No breaking changes: Application logic remains unchanged

Testing

The primary keys enforce the existing application behavior where each entity can only have one value per label key, which is already enforced by the DELETE + INSERT pattern used in the code.

Fixes #6865

…ibility

Adds composite primary keys to three label tables (group_labels,
artifact_labels, and version_labels) across all database types (MySQL,
PostgreSQL, H2, and MSSQL).

MySQL InnoDB Cluster requires all tables to have primary keys defined.
The missing primary keys prevented cluster initialization from completing.

The primary keys are based on the natural keys of each table:
- group_labels: (groupId, labelKey)
- artifact_labels: (groupId, artifactId, labelKey)
- version_labels: (globalId, labelKey)

This change only affects new installations. Existing deployments will
continue to function without these primary keys, as they are not
functionally required by the application logic.

Fixes #6865

Co-Authored-By: Claude <[email protected]>
@EricWittmann EricWittmann merged commit 042e88a into main Nov 13, 2025
18 checks passed
@EricWittmann EricWittmann deleted the issues/6865 branch November 13, 2025 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing Primary Keys in Apicurio Registry SQL tables cause MySQL Cluster initialization failure

2 participants