Skip to content

Conversation

sinclert-canonical
Copy link
Contributor

This PR implements the set of predefined roles proposed in this specification.

In addition to the predefined roles proposed to be on sync with PostgreSQL 16 operators, there is an additional one in order to solve a long time standing time debt: mysqlrouter. This predefined role is proposed in order to stop treating mysqlrouter as a magic word used to assign ALL PRIVILEGES to the created users whose extra-user-roles config argument contained such word. That exact name has been chosen to preserve backwards compatibility.

Additional changes:

  • Implemented MySQL lib function to fully support the usage of extra-user-roles config argument.
  • Harmonized MySQL config arguments to all user underscore (_) instead of mixing dashes and underscores.
  • Removed unused MySQL config dictionary in the unit tests.

@sinclert-canonical sinclert-canonical added the enhancement New feature, UI change, or workload upgrade label Jul 7, 2025
@sinclert-canonical sinclert-canonical force-pushed the sinclert/7322/predefined-roles branch 17 times, most recently from 350dc94 to 90bb3c8 Compare July 14, 2025 08:39
@sinclert-canonical sinclert-canonical force-pushed the sinclert/7322/predefined-roles branch 2 times, most recently from 2bb4cdc to ef8e039 Compare July 15, 2025 12:11
@sinclert-canonical sinclert-canonical force-pushed the sinclert/7322/predefined-roles branch 3 times, most recently from d6ef3e2 to 0d020f4 Compare July 28, 2025 09:10
@sinclert-canonical sinclert-canonical force-pushed the sinclert/7322/predefined-roles branch 6 times, most recently from e9ba0fb to 8000b34 Compare August 6, 2025 14:27
@sinclert-canonical sinclert-canonical force-pushed the sinclert/7322/predefined-roles branch 2 times, most recently from 2c8e14b to bd05e71 Compare August 11, 2025 10:24
Comment on lines +1516 to +1518
if len(role_name) >= ROLE_MAX_LENGTH:
logger.warning(f"Pruning application database role name {role_name}")
role_name = role_name[:ROLE_MAX_LENGTH]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This snippet is here to decouple this PR from changes that will be proposed on the MySQL Test app.

In short: there is a length limit on how roles can be named in MySQL (32 characters). MySQL Test app default database name is continuous_writes_database, which in addition to the charmed_dba prefix surpasses the limit. I would suggest shorten the default database name to just continuous_writes.

Copy link
Contributor

@taurus-forever taurus-forever left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! Easy to read!

Copy link
Contributor

@paulomach paulomach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work. Tests are solid

@sinclert-canonical sinclert-canonical force-pushed the sinclert/7322/predefined-roles branch from bd05e71 to 77207f7 Compare September 1, 2025 08:14
@sinclert-canonical
Copy link
Contributor Author

PR branch rebased from main branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature, UI change, or workload upgrade Libraries: Out of sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants