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

Templating: Only use wsrep_provider_options when galera_extra_wsrep_p… #230

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

andanotheruser
Copy link
Contributor

…rovider_options is defined

Description

Only use wsrep_provider_options when galera_extra_wsrep_provider_options is defined :)

Related Issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly. (No change required)
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@eRadical
Copy link
Collaborator

LGTM - @elcomtik thoughts?

@eRadical eRadical self-assigned this Nov 12, 2024
@elcomtik
Copy link
Collaborator

I think it brings no improvement, this variable is defined in defaults, so this condition will be always evaluated to true.

@andanotheruser
Copy link
Contributor Author

defined in defaults, so this condition will be always evaluated to true.

Except if you don't use the defaults and define something else.

@elcomtik
Copy link
Collaborator

How is it possible to undefine defaults?

@andanotheruser
Copy link
Contributor Author

How is it possible to undefine defaults?

You'd just set a different value for the play. For example as part of host vars or groups vars or for the playbook itself.

Those have higher precedence: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable

Defaults are just that, after all: Defaults. Sometimes there's a need to differ from the defaults. :D

@elcomtik
Copy link
Collaborator

Ofc I didn't mean this, however that you added condition which checks if variable is defined. But I'm not aware you can undefine variable by hostvars, grouvars or extra vars

@eRadical
Copy link
Collaborator

I now see some things in here:

  • galera_extra_wsrep_provider_options is anyway populated in setup_cluster.yml
  • this is already in templates/etc/mysql/conf.d/galera.cnf.temp.j2 - @andanotheruser is just bringing this is the non-temp file but
  • this is present in another 2 files and if we decide on this we should add to all

Note (learned the hard way): wsrep_provider_options is a special case of setting. You cannot set it multiple times and it ads up... we need to set this in one line only.

@eRadical
Copy link
Collaborator

  • galera_extra_wsrep_provider_options

Yeah... I think the check should be on it having at least 1 element.

@andanotheruser
Copy link
Contributor Author

This line is a bit broken. What do you want to say?

@eRadical
Copy link
Collaborator

@andanotheruser - read the last 2 bullet points in one sentence

@eRadical
Copy link
Collaborator

I was just saying that if we change, we should change it in everywhere.

@eRadical
Copy link
Collaborator

But to go back to @elcomtik points... in defaults we define an empty galera_extra_wsrep_provider_options then in setup_cluster.yml we add things in there anyway.

If we want to add your patch we need to make sure every set_fact from https://github.com/mrlesmithjr/ansible-mariadb-galera-cluster/blob/master/tasks/setup_cluster.yml#L44-L78 have a when: clause. Currently the 1st does not. And if we add stuff in the future we need to make sure we add a when clause.

@andanotheruser
Copy link
Contributor Author

If we want to add your patch we need to make sure every set_fact from https://github.com/mrlesmithjr/ansible-mariadb-galera-cluster/blob/master/tasks/setup_cluster.yml#L44-L78 have a when: clause. Currently the 1st does not. And if we add stuff in the future we need to make sure we add a when clause.

What sort of condition would you like to see in there?

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.

3 participants