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

No replication support for Mariadb < 10.5.1 #335

Closed
kzinas-adv opened this issue Apr 14, 2022 · 6 comments · Fixed by #336
Closed

No replication support for Mariadb < 10.5.1 #335

kzinas-adv opened this issue Apr 14, 2022 · 6 comments · Fixed by #336

Comments

@kzinas-adv
Copy link

SUMMARY

You cannot set replication for older MariaDB releases using recent community.mysql (> 3.0.x).
with mysql_replication module using both slave_pos or replica_pos

ISSUE TYPE
  • Bug Report
COMPONENT NAME

mysql_replication

ANSIBLE VERSION
ansible [core 2.12.2]
  config file = /home/domas/source/ansible/ansible.cfg
  configured module search path = ['/home/domas/source/ansible/library', '/home/domas/source/ansible/library']
  ansible python module location = /home/domas/.local/lib64/python3.10/site-packages/ansible
  ansible collection location = /home/domas/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/domas/.local/bin/ansible
  python version = 3.10.4 (main, Mar 25 2022, 00:00:00) [GCC 11.2.1 20220127 (Red Hat 11.2.1-9)]
  jinja version = 2.11.3
  libyaml = True
community.mysql rel  3.1.2 
COLLECTION VERSION
(.local) [domas@x1 ansible]$ ansible-galaxy collection list community.mysql

# /home/domas/.ansible/collections/ansible_collections
Collection      Version
--------------- -------
community.mysql 3.1.2  

CONFIGURATION
(.local) [domas@x1 ~]$ ansible-config dump --only-changed
CACHE_PLUGIN(/home/domas/ansible.cfg) = jsonfile
CACHE_PLUGIN_CONNECTION(/home/domas/ansible.cfg) = ~/.cache/ansible-facts
CACHE_PLUGIN_TIMEOUT(/home/domas/ansible.cfg) = 86400
DEFAULT_ACTION_PLUGIN_PATH(/home/domas/ansible.cfg) = ['/home/domas/.local/lib/python3.*/*-packages/ara/plugins/action', '/usr/lib/python3.*/*-packages/ara/plugins/action', '/usr/local/lib/python*/*-packages/ara/plugins/action']
DEFAULT_CALLBACK_PLUGIN_PATH(/home/domas/ansible.cfg) = ['/home/domas/.local/lib/python3.*/*-packages/ara/plugins/callback', '/usr/lib/python3.*/*-packages/ara/plugins/callback', '/usr/local/lib/python*/*-packages/ara/plugins/callback']
DEFAULT_GATHERING(/home/domas/ansible.cfg) = smart
DEFAULT_HOST_LIST(/home/domas/ansible.cfg) = ['/home/domas/inventory/ops/hosts']
DEFAULT_LOOKUP_PLUGIN_PATH(/home/domas/ansible.cfg) = ['/home/domas/.local/lib/python3.*/*-packages/ara/plugins/lookup', '/usr/lib/python3.*/*-packages/ara/plugins/lookup', '/usr/local/lib/python*/*-packages/ara/plugins/lookup']
DEFAULT_MODULE_PATH(/home/domas/ansible.cfg) = ['/home/domas/library', '/home/domas/library']
DEFAULT_REMOTE_USER(/home/domas/ansible.cfg) = root
DEFAULT_ROLES_PATH(/home/domas/ansible.cfg) = ['/home/domas/roles']
DEFAULT_STDOUT_CALLBACK(/home/domas/ansible.cfg) = debug
DEFAULT_STRATEGY(/home/domas/ansible.cfg) = mitogen_linear
DEFAULT_STRATEGY_PLUGIN_PATH(/home/domas/ansible.cfg) = ['/home/domas/.local/lib/python3.10/site-packages/ansible_mitogen/plugins/strategy']
DISPLAY_SKIPPED_HOSTS(/home/domas/ansible.cfg) = False
HOST_KEY_CHECKING(env: ANSIBLE_HOST_KEY_CHECKING) = False
MAX_FILE_SIZE_FOR_DIFF(/home/domas/ansible.cfg) = 0


OS / ENVIRONMENT

Fedora release 35 (Thirty Five)

STEPS TO REPRODUCE

Set replication with mysql_replication module for Mariadb prior to 10.5.1 (which still does not support replica_pos)

- name: "Set replication config"
  mysql_replication:
    login_user: root
    login_unix_socket: "{{ mariadb_socket }}"
    mode: changeprimary
    primary_host: "{{ mariadb_slave_of }}"
    primary_user: slave
    primary_password: "{{ mariadb_master_password }}"
    primary_use_gtid: replica_pos
    primary_ssl: yes
    primary_ssl_ca: /etc/pki/tls/private/wsrep.ca.pem
    primary_ssl_cert: /etc/pki/tls/private/wsrep.client.pem
    primary_ssl_key: /etc/pki/tls/private/wsrep.client.key


EXPECTED RESULTS

Successfully set replication config

ACTUAL RESULTS

If I use slave_pos:

value of primary_use_gtid must be one of: current_pos, replica_pos, disabled, got: slave_pos

If I use replica_pos:

(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'replica_pos' at line 1")
MSG:

(1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'replica_pos' at line 1"). Query == CHANGE MASTER TO ["MASTER_HOST='server-name.local'", "MASTER_USER='slave'", "MASTER_PASSWORD='********'", 'MASTER_SSL=1', "MASTER_SSL_CA='/etc/pki/tls/private/wsrep.ca.pem'", "MASTER_SSL_CERT='/etc/pki/tls/private/wsrep.client.pem'", "MASTER_SSL_KEY='/etc/pki/tls/private/wsrep.client.key'", 'MASTER_USE_GTID=replica_pos']

@nerijus
Copy link

nerijus commented Apr 14, 2022

It seems #252 has broken mariadb versions < 10.5.1 support. Mariadb versions 10.2, 10.3 and 10.4 had releases this year, so IMHO they should be supported.

@Andersson007
Copy link
Collaborator

@kzinas-adv @nerijus hello, thanks for reporting this!
Sorry for the late reply, was on PTO, I'll take a look ASAP

@Andersson007
Copy link
Collaborator

i submitted a PR #336. @nerijus @kzinas-adv could you please add the lines i added in plugins/modules/mysql_replication.py and check, it would be great (we have testing against mariadb 10.3 but anyway).
I'm looking forward to your feedback, thanks!

@kzinas-adv
Copy link
Author

kzinas-adv commented Apr 21, 2022

Yes checked now it works with MariaDB-server-10.4.24-1.el8.x86_64.
Thanks!

@Andersson007
Copy link
Collaborator

@kzinas-adv thanks for checking! So once @rsicart reviews the code, we'll merge the PR and will backport and release

@Andersson007
Copy link
Collaborator

Thanks everyone for your contribution! We'll release 3.1.3 containing the fix ASAP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants