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

Add support for Mariadb 11.x #1645

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

Marc-DRI
Copy link
Contributor

Summary

Add support for Mariadb 11.x and use its mariadb and mariadbd binaries.

Additional Context

From Mariadb 11.0, mysql* names are deprecated in favor of mariadb* (cf. https://jira.mariadb.org/browse/MDEV-29582).
This pull request is:

  • including commits from @OxCom, determining which binaries to use, depending on the mysqld_version facter
  • fixing facters for mysql_version and mysqld_version whithin the MariaDB>11 context
  • updating/adding tests for this new context

The initial PR #1626 causes an infinite loop in our case of fresh deployment, because facter is not properly initialized.

Related Issues

This pull request manages to fix #1580 .

@@ -7,3 +7,11 @@
mysql_ver.match(%r{\d+\.\d+\.\d+})[0] if mysql_ver
end
end

Facter.add('mysql_version') do
Copy link
Collaborator

Choose a reason for hiding this comment

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

now we've two blocks for the same fact. Doesn't it make sense to unify it? What if mysql and mariadb is installed on the same server?

Choose a reason for hiding this comment

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

Before MariaDB 11.0, using both mysql and mariadb was not supported by this module.
With this MariaDB 11.x support, it still dont work with both used at the same time but yes the facts collect can produce unexpected behavior.

As the two blocks contains de confine, I though that was the way to proceed.
https://www.puppet.com/docs/puppet/7/fact_overview.html#writing_facts_simple_resolutions-examples

Do you have some recommendation if you want to merge them?

Copy link
Contributor

@smortex smortex Sep 13, 2024

Choose a reason for hiding this comment

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

This documentation feels weird. Inspecting various facts in the puppetlabs organization repositories, I don't see usage of confine with different prerequisites for the same facts, but a single fact with confinement that checks multiple conditions, e.g. https://github.com/puppetlabs/puppetlabs-java/blob/6319799bb310f824b18d9077905c46409535c977/lib/facter/java_default_home.rb#L16

It feels more natural for me to have a single Facter.add('mysql_version'), where the setcode logic attempts to get the expected value and return nil if none was found. A confinement does not even provide a short-circuit in this case, so we can probably go without it, i.e.

Facter.add('mysql_version') do
  setcode do
    mysql_ver = if Facter::Core::Execution.which('mysql')
                  Facter::Core::Execution.execute('mysql --version')
                elsif Facter::Core::Execution.which('mariadb')
                  Facter::Core::Execution.execute('mariadb --version')
                end
    mysql_ver.match(%r{\d+\.\d+\.\d+})[0] if mysql_ver
  end
end

So merging may make sense IMHO.

But beyond this consideration (and speaking as someone who does not use mysql nor mariadb), if mariadb and mysql are diverging one from the other and could be installed side by side on a single system, maybe it make sense to "fork" the puppetlabs-mysql module (puppet(labs)?-mariadb) just like mariadb forked mysql so that each module can track what the software they configure implement and provide a consistent interface and not some weak abstraction that may or may not work depending on the package you manage with the module?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Facters reworked and correctly working.
Thank you @smortex , code is much nicer !

@smortex
Copy link
Contributor

smortex commented Sep 25, 2024

Rubocop report some style issues, check the "Files changed" tab for details.

@Marc-DRI Marc-DRI force-pushed the mariadb_11 branch 2 times, most recently from 5bd4bce to 9afaf88 Compare September 25, 2024 14:21
@Marc-DRI
Copy link
Contributor Author

Should be better now...

@neomilium
Copy link

But beyond this consideration (and speaking as someone who does not use mysql nor mariadb), if mariadb and mysql are diverging one from the other and could be installed side by side on a single system, maybe it make sense to "fork" the puppetlabs-mysql module (puppet(labs)?-mariadb) just like mariadb forked mysql so that each module can track what the software they configure implement and provide a consistent interface and not some weak abstraction that may or may not work depending on the package you manage with the module?

@smortex I agree. It could be the right moment to split modules : mariadb and mysql.

@bastelfreak : What is your through about this split?

@neomilium
Copy link

Thinking it twice, there is no much interest to fork and no sufficient divergence to need a fork, so IMHO this PR could be accepted as is.

Copy link
Contributor

@smortex smortex left a comment

Choose a reason for hiding this comment

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

Looks good to me. I am not a member of this project so cannot trigger a CI run, @bastelfreak @alexjfisher can you please trigger it? Thanks!

OxCom and others added 2 commits November 5, 2024 13:07
From MariaDB 11.x, mysql* names are deprecated
(cf. https://jira.mariadb.org/browse/MDEV-29582).

Use mariadb* names instead, to set factors accordingly.
Use these factors to return the proper client binary.

Co-authored-by: Sylvain Luce <[email protected]>
Co-authored-by: Nicolas Le Gaillart <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Providers broken with MariaDB 11
5 participants