From b6b7401c0d71298ac32b1437c3a309c6957ef5c0 Mon Sep 17 00:00:00 2001 From: Michal Nasiadka Date: Mon, 18 Oct 2021 12:09:03 +0200 Subject: [PATCH] mariadb: Remove wsrep-notify.sh Closes-Bug: #1947534 Change-Id: I08be074c3633cc4fb0a0bc6c9cb8d03eb5226d89 --- ansible/roles/mariadb/defaults/main.yml | 6 +- ansible/roles/mariadb/tasks/config.yml | 20 ----- ansible/roles/mariadb/templates/galera.cnf.j2 | 3 - .../roles/mariadb/templates/mariadb.json.j2 | 8 +- .../mariadb/templates/wsrep-notify.sh.j2 | 79 ------------------- .../notes/bug-1947534-bf3b5ed19473015f.yaml | 5 ++ .../remove-wsrep-notify-dbb5ef5f700b06b1.yaml | 5 ++ 7 files changed, 14 insertions(+), 112 deletions(-) delete mode 100644 ansible/roles/mariadb/templates/wsrep-notify.sh.j2 create mode 100644 releasenotes/notes/bug-1947534-bf3b5ed19473015f.yaml create mode 100644 releasenotes/notes/remove-wsrep-notify-dbb5ef5f700b06b1.yaml diff --git a/ansible/roles/mariadb/defaults/main.yml b/ansible/roles/mariadb/defaults/main.yml index b4803c0ba0..b208219d63 100644 --- a/ansible/roles/mariadb/defaults/main.yml +++ b/ansible/roles/mariadb/defaults/main.yml @@ -21,7 +21,7 @@ mariadb_services: backend_tcp_extra: - "option srvtcpka" - "timeout server 3600s" - - "option {% if enable_mariadb_clustercheck | bool %}httpchk{% else %}mysql-check user haproxy post-41{% endif %}" + - "{% if enable_mariadb_clustercheck | bool %}option httpchk{% endif %}" custom_member_list: "{{ internal_haproxy_members.split(';') }}" mariadb_external_lb: enabled: "{{ enable_external_mariadb_load_balancer|bool }}" @@ -57,8 +57,8 @@ database_max_timeout: 120 #################### # HAProxy #################### -internal_haproxy_members: "{% for host in mariadb_default_database_shard_hosts %} server {{ hostvars[host].ansible_facts.hostname }} {{ 'api' | kolla_address(host) }}:{{ mariadb_port }} check {% if enable_mariadb_clustercheck | bool %}port {{ mariadb_clustercheck_port }}{% endif %} inter 2000 rise 2 fall 5{% if not loop.first %} backup{% endif %};{% endfor %}" -external_haproxy_members: "{% for host in mariadb_default_database_shard_hosts %} server {{ host }} {{ host }}:{{ mariadb_port }} check {% if enable_mariadb_clustercheck | bool %}port {{ mariadb_clustercheck_port }}{% endif %} inter 2000 rise 2 fall 5{% if not loop.first %} backup{% endif %};{% endfor %}" +internal_haproxy_members: "{% for host in mariadb_default_database_shard_hosts %} server {{ hostvars[host].ansible_facts.hostname }} {{ 'api' | kolla_address(host) }}:{{ mariadb_port }} check port {% if enable_mariadb_clustercheck | bool %}{{ mariadb_clustercheck_port }}{% else %}{{ mariadb_port }}{% endif %} inter 2000 rise 2 fall 5{% if not loop.first %} backup{% endif %};{% endfor %}" +external_haproxy_members: "{% for host in mariadb_default_database_shard_hosts %} server {{ host }} {{ host }}:{{ mariadb_port }} check port {% if enable_mariadb_clustercheck | bool %}{{ mariadb_clustercheck_port }}{% else %}{{ mariadb_port }}{% endif %} inter 2000 rise 2 fall 5{% if not loop.first %} backup{% endif %};{% endfor %}" #################### # Docker diff --git a/ansible/roles/mariadb/tasks/config.yml b/ansible/roles/mariadb/tasks/config.yml index ffe7403866..9b5365e3dd 100644 --- a/ansible/roles/mariadb/tasks/config.yml +++ b/ansible/roles/mariadb/tasks/config.yml @@ -82,26 +82,6 @@ notify: - restart mariadb -- name: Warn about deprecation - debug: - msg: > - wsrep-notify.sh script is deprecated and will be removed in Xena - when: not enable_mariadb_clustercheck | bool - -- name: Copying over wsrep-notify.sh - template: - src: "{{ role_path }}/templates/wsrep-notify.sh.j2" - dest: "{{ node_config_directory }}/{{ item.key }}/wsrep-notify.sh" - mode: "0770" - become: true - when: - - inventory_hostname in groups[item.value.group] - - item.value.enabled | bool - - not enable_mariadb_clustercheck | bool - with_dict: "{{ mariadb_services }}" - notify: - - restart mariadb - - name: Copying over xinetd clustercheck.conf vars: service_name: "mariadb-clustercheck" diff --git a/ansible/roles/mariadb/templates/galera.cnf.j2 b/ansible/roles/mariadb/templates/galera.cnf.j2 index f0a0474f59..245e01ee08 100644 --- a/ansible/roles/mariadb/templates/galera.cnf.j2 +++ b/ansible/roles/mariadb/templates/galera.cnf.j2 @@ -40,9 +40,6 @@ wsrep_node_name={{ ansible_facts.hostname }} wsrep_sst_method={{ sst_method }} wsrep_sst_auth={{ database_user }}:{{ database_password }} wsrep_slave_threads=4 -{% if not enable_mariadb_clustercheck | bool %} -wsrep_notify_cmd=/usr/local/bin/wsrep-notify.sh -{% endif %} wsrep_on = ON max_connections=10000 diff --git a/ansible/roles/mariadb/templates/mariadb.json.j2 b/ansible/roles/mariadb/templates/mariadb.json.j2 index e9003a0dfe..ac1b5bf27d 100644 --- a/ansible/roles/mariadb/templates/mariadb.json.j2 +++ b/ansible/roles/mariadb/templates/mariadb.json.j2 @@ -7,13 +7,7 @@ "dest": "/etc/{{ mysql_dir }}/my.cnf", "owner": "mysql", "perm": "0600" - }{% if not enable_mariadb_clustercheck | bool %}, - { - "source": "{{ container_config_directory }}/wsrep-notify.sh", - "dest": "/usr/local/bin/wsrep-notify.sh", - "owner": "mysql", - "perm": "0700" - }{% endif %} + } ], "permissions": [ { diff --git a/ansible/roles/mariadb/templates/wsrep-notify.sh.j2 b/ansible/roles/mariadb/templates/wsrep-notify.sh.j2 deleted file mode 100644 index f5096e9246..0000000000 --- a/ansible/roles/mariadb/templates/wsrep-notify.sh.j2 +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/bash -e - -# Edit parameters below to specify the address and login to server. -USER={{ database_user }} -PSWD={{ database_password }} -HOST={{ api_interface_address }} -PORT={{ mariadb_port }} -LB_USER={{ mariadb_monitor_user }} - -ENABLE_LB="UPDATE mysql.user SET User='${LB_USER}' WHERE User='${LB_USER}_blocked';" -DISABLE_LB="UPDATE mysql.user SET User='${LB_USER}_blocked' WHERE User='${LB_USER}';" -MYSQL_CMD="`type -p mysql` -B -u$USER -p$PSWD -h$HOST -P$PORT" - -status_update() -{ - echo "SET SESSION wsrep_on=off;" - echo "$@" - echo "FLUSH PRIVILEGES;" -} - -get_sst_method() -{ - $MYSQL_CMD -s -N -e "SHOW VARIABLES LIKE 'wsrep_sst_method';" | awk '{ print $2 }' -} - -while [ $# -gt 0 ] -do - case $1 in - --status) - STATUS=$2 - shift - ;; - --uuid) - CLUSTER_UUID=$2 - shift - ;; - --primary) - [ "$2" = "yes" ] && PRIMARY="1" || PRIMARY="0" - shift - ;; - --index) - INDEX=$2 - shift - ;; - --members) - MEMBERS=$2 - shift - ;; - esac - shift -done - -case $STATUS in -Synced) - CMD=$ENABLE_LB - ;; -Donor) - # enabling donor only if xtrabackup configured - SST_METHOD=`get_sst_method` - if [[ $SST_METHOD =~ (mariabackup|xtrabackup) ]]; then - CMD=$ENABLE_LB - else - CMD=$DISABLE_LB - fi - ;; -Undefined) - # shutting down database: do nothing - ;; -*) - CMD=$DISABLE_LB - ;; -esac - -if [ -n "$CMD" ] -then - status_update "$CMD" | $MYSQL_CMD -fi - -exit 0 diff --git a/releasenotes/notes/bug-1947534-bf3b5ed19473015f.yaml b/releasenotes/notes/bug-1947534-bf3b5ed19473015f.yaml new file mode 100644 index 0000000000..9c78f4d075 --- /dev/null +++ b/releasenotes/notes/bug-1947534-bf3b5ed19473015f.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Fixes an issue with single node MariaDB deployments with HAProxy disabled. + See `bug 1947534 `__ for details. diff --git a/releasenotes/notes/remove-wsrep-notify-dbb5ef5f700b06b1.yaml b/releasenotes/notes/remove-wsrep-notify-dbb5ef5f700b06b1.yaml new file mode 100644 index 0000000000..9e35d2a752 --- /dev/null +++ b/releasenotes/notes/remove-wsrep-notify-dbb5ef5f700b06b1.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - | + The ``wsrep-notify.sh`` script has been removed (following deprecation + in Wallaby).