Skip to content

Completely redesign the MySQL module. #258

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

Merged
merged 12 commits into from
Sep 23, 2013
Merged

Completely redesign the MySQL module. #258

merged 12 commits into from
Sep 23, 2013

Conversation

apenney
Copy link
Contributor

@apenney apenney commented Sep 13, 2013

This work completely overhauls the MySQL module.

image

Warning

I've been working on this for a week now, testing in a local vagrant instance. I don't have large scale MySQL environments to test upgrades from, I don't have clusters, I don't have sophisicated use cases for MySQL. This rewrite is currently LIGHTLY tested and the goal of merging it into master is to increase the pool of people who can help me test it, find the design flaws, add features, and generally get this into shape for a release. It is NOT ready to be released yet and I know that and need help to get it there.

Overview

In an attempt to improve this module, make it easier to extend in future, and provide a better foundation for feature development I have attempted to refactor it completely.

Pretty much every API and class has been modified in some way. The heart of this proposed refactor is the idea that "It is impossible to adequately represent my.cnf through parameters." Previously we allowed you to set parameters like max_connections but then used that value in all my.cnf sections, and as experienced mysql users will tell you that can be unhelpful. You want different settings in mysqldump than in mysqld and this work supports that.

If you wish to customize my.cnf in this work you do:

class { 'mysql::globals':
  override_options => {
    'mysqld' => {
      'max_connections' => '255'
    },
    'mysqldump' => {
      'max_connections' => '10',
    }
  }
}

include 'mysql::server'

As you can see the hash for options is basically a bunch of top level sections as keys, then subhashes which contain the values under those sections.

mysql::server changes

  • Functionality broken into subclasses so we can apply ordering easier.
  • The restart on changing root@localhost password is -removed-.
  • We change the root@localhost password by mysql_user{} like everything else.
  • $enabled and $manage_service are deprecated and renamed to $service_enabled and $service_manage.
  • remove_default_accounts added as a parameter to automatically include mysql::server::account_security{}
  • mysql::backup becomes mysql::server::backup and gets a few cleanups (and grows a $time parameter).
  • mysql::server::config was previously a define for adding conf.d options - the define is gone and this is now the thing that manages the conf file.
  • mysql::server::mysqltuner now writes the script to /usr/local/bin instead of /usr/bin.

Other Changes

  • mysql::bindings and subclasses get cleanups and all get switched to using distribution packages by default instead of gem. Also added php like all the others.
  • mysql::client will let you pass in enable_bindings to automatically get -all- the bindings if you're feeling lazy.

Ashley Penney added 11 commits September 9, 2013 11:34
This initial round of work focuses on adding the concept of
mysql::globals to the module.  This is a shared place to provide all the
data the module needs, and then clients, servers, and providers can all
rely on this information to set things up.

This is being primarily used at first to allow a default_options hash
that contains all the previous parameters and takes a overrides_options
that allows you to then further customize any of the options in my.cnf.
This work adds a new mysql::globals class which contains a hash used to
build my.cnf from.  It's used to share this data across multiple classes
so that the client and server can share this data.

End users can modify content in my.cnf by including mysql::globals and
passing in override_options as a hash that looks like:

override_options = { 'mysqld' => { 'max_connections' => '120' } }

This completely replaces the mess of parameters that existed in the main
mysql class before.

Completely refactor mysql::server and rework the API.  This changes
ordering, changes from execs{} to mysql_user for the root password,
removes some functionality (like the etc_root_password), and generally
makes some tough decisions about how mysql::server should be built.
This is used in the backwards compatibility code in init.pp.
This removes all the internal class parameters and shrinks these classes
to be more straightforward, relying on the values set in bindings.pp.
Handful of changes here, such as removing flush (so that mysql_user
can be used for root password changes) and other tweaks here.

Add time option to mysql::backup.
@razorsedge
Copy link
Contributor

Not sure if I have made this request before, but can we get a 1.0.0 release before these API changes? Dependent module authors will sing your praises.

@apenney
Copy link
Contributor Author

apenney commented Sep 14, 2013

Yeah we definitely can, I want this to be handled carefully as it's such a nightmarishly large change. It won't even go in unless the community decides it's an improvement. I'll probably release a 1.0.0, AND create a 1.0.0 branch so that we can continue to bugfix off that branch.

@razorsedge
Copy link
Contributor

+1 for a 1.0.0 branch for dependent module rspec tests.
I will try and find time to review this PR some time in the coming week.

Add a backwards compatibility section and a conf.d section.
apenney pushed a commit that referenced this pull request Sep 23, 2013
Completely redesign the MySQL module.
@apenney apenney merged commit a972e4d into puppetlabs:master Sep 23, 2013
@apenney apenney deleted the refactor branch September 23, 2013 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants