From f979ae1f8ee182a8bc6fde4b23b95a460cb81488 Mon Sep 17 00:00:00 2001 From: Mark Goddard Date: Thu, 7 Nov 2019 10:01:14 +0000 Subject: [PATCH] Fix restart policy after MariaDB recovery After performing a recovery of MariaDB, the mariadb containers are left without a restart policy. This leaves them unable to recover from the crash of a single galera node. There is another issue, in that the 'master' node is left in a bootstrap configuration, with the --wsrep-new-cluster argument configured as BOOTSTRAP_ARGS. This change fixes these issues by removing the restart policy of 'no' from the 'slave' containers, and recreating the master container without the restart policy or bootstrap arguments. Change-Id: I36c875611931163ca2c29ae93b71d3af64cb197c Closes-Bug: #1851594 --- .../roles/mariadb/tasks/recover_cluster.yml | 37 +++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/ansible/roles/mariadb/tasks/recover_cluster.yml b/ansible/roles/mariadb/tasks/recover_cluster.yml index cba5272eae..0887281f13 100644 --- a/ansible/roles/mariadb/tasks/recover_cluster.yml +++ b/ansible/roles/mariadb/tasks/recover_cluster.yml @@ -186,15 +186,10 @@ kolla_docker: action: "start_container" common_options: "{{ docker_common_options }}" - environment: - KOLLA_CONFIG_STRATEGY: "{{ config_strategy }}" - BOOTSTRAP_ARGS: " " - image: "{{ mariadb_service.image }}" - labels: - BOOTSTRAP: name: "{{ mariadb_service.container_name }}" - restart_policy: no + image: "{{ mariadb_service.image }}" volumes: "{{ mariadb_service.volumes }}" + dimensions: "{{ mariadb_service.dimensions }}" when: - bootstrap_host is defined - bootstrap_host != inventory_hostname @@ -214,4 +209,32 @@ - bootstrap_host is defined - bootstrap_host != inventory_hostname +- name: Restart master MariaDB container + become: true + kolla_docker: + action: "recreate_or_restart_container" + common_options: "{{ docker_common_options }}" + name: "{{ mariadb_service.container_name }}" + image: "{{ mariadb_service.image }}" + volumes: "{{ mariadb_service.volumes }}" + dimensions: "{{ mariadb_service.dimensions }}" + when: + - bootstrap_host is defined + - bootstrap_host == inventory_hostname + +- name: Wait for master mariadb + wait_for: + host: "{{ api_interface_address }}" + port: "{{ mariadb_port }}" + connect_timeout: 1 + timeout: 60 + search_regex: "MariaDB" + register: check_mariadb_port + until: check_mariadb_port is success + retries: 10 + delay: 6 + when: + - bootstrap_host is defined + - bootstrap_host == inventory_hostname + - import_tasks: wait_for_loadbalancer.yml