From 5413116c235a0dcb429a8a9d40c7cb99da52b995 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 8 Jun 2021 20:32:13 +0900 Subject: [PATCH] Allow tuning timeouts for mysql pacemaker resource This change introduces several timeout parameters so that users can tune operation timeouts about mysql resource in pacemaker. Change-Id: Ib1e0e687e2f8dd5dba53a37f6d4e5f149b933fd4 --- manifests/profile/pacemaker/database/mysql.pp | 48 ++++++++++++++++++- .../pacemaker/database/mysql_bundle.pp | 48 ++++++++++++++++++- 2 files changed, 94 insertions(+), 2 deletions(-) diff --git a/manifests/profile/pacemaker/database/mysql.pp b/manifests/profile/pacemaker/database/mysql.pp index f2eedfa39..039ce0995 100644 --- a/manifests/profile/pacemaker/database/mysql.pp +++ b/manifests/profile/pacemaker/database/mysql.pp @@ -97,11 +97,31 @@ # (Optional) Maximum value for open-files-limit # Defaults to 16384 # +# [*start_timeout*] +# (Optional) Maximum time in second for initializing a galera server +# before pacemaker considers the operation timed out. +# Defaults to undef (use the default value in resource agent) +# # [*promote_timeout*] # (Optional) Maximum time in second for starting up a galera server # before pacemaker considers the operation timed out. # Defaults to 300 # +# [*monitor_timeout*] +# (Optional) Maximum time in second for monitoring a galera server +# before pacemaker considers the operation timed out. +# Defaults to undef (use the default value in resource agent) +# +# [*demote_timeout*] +# (Optional) Maximum time in second for stopping a galera server +# before pacemaker considers the operation timed out. +# Defaults to undef (use the default value in resource agent) +# +# [*stop_timeout*] +# (Optional) Maximum time in second for ensuring a galera server is stopped +# before pacemaker considers the operation timed out. +# Defaults to undef (use the default value in resource agent) +# class tripleo::profile::pacemaker::database::mysql ( $bootstrap_node = hiera('mysql_short_bootstrap_node_name'), $bind_address = $::hostname, @@ -118,7 +138,11 @@ class tripleo::profile::pacemaker::database::mysql ( $step = Integer(hiera('step')), $pcs_tries = hiera('pcs_tries', 20), $open_files_limit = 16384, + $start_timeout = undef, $promote_timeout = 300, + $monitor_timeout = undef, + $demote_timeout = undef, + $stop_timeout = undef, ) { if $bootstrap_node and $::hostname == downcase($bootstrap_node) { $pacemaker_master = true @@ -257,9 +281,31 @@ class tripleo::profile::pacemaker::database::mysql ( node => $::hostname, } if $pacemaker_master { + $op_start_params = $start_timeout ? { + undef => undef, + default => "start timeout=${start_timeout}s" + } + $op_promote_params = $promote_timeout ? { + undef => 'promote on-fail=block', + default => "promote timeout=${promote_timeout}s on-fail=block" + } + $op_monitor_params = $monitor_timeout ? { + undef => undef, + default => "monitor timeout=${monitor_timeout}s" + } + $op_demote_params = $demote_timeout ? { + undef => undef, + default => "demote timeout=${demote_timeout}s" + } + $op_stop_params = $stop_timeout ? { + undef => undef, + default => "stop timeout=${stop_timeout}s" + } + $op_params = join(delete_undef_values([$op_start_params, $op_promote_params, $op_monitor_params, $op_demote_params, $op_stop_params]), ' ') + pacemaker::resource::ocf { 'galera' : ocf_agent_name => 'heartbeat:galera', - op_params => "promote timeout=${promote_timeout}s on-fail=block", + op_params => $op_params, master_params => '', meta_params => "master-max=${galera_nodes_count} ordered=true", resource_params => "additional_parameters='--open-files-limit=${open_files_limit}' enable_creation=true wsrep_cluster_address='gcomm://${galera_nodes}' cluster_host_map='${cluster_host_map}'", diff --git a/manifests/profile/pacemaker/database/mysql_bundle.pp b/manifests/profile/pacemaker/database/mysql_bundle.pp index b459d2432..31f2f1591 100644 --- a/manifests/profile/pacemaker/database/mysql_bundle.pp +++ b/manifests/profile/pacemaker/database/mysql_bundle.pp @@ -150,11 +150,31 @@ # (Optional) Maximum value for open-files-limit # Defaults to 16384 # +# [*start_timeout*] +# (Optional) Maximum time in second for initializing a galera server +# before pacemaker considers the operation timed out. +# Defaults to undef (use the default value in resource agent) +# # [*promote_timeout*] # (Optional) Maximum time in second for starting up a galera server # before pacemaker considers the operation timed out. # Defaults to 300 # +# [*monitor_timeout*] +# (Optional) Maximum time in second for monitoring a galera server +# before pacemaker considers the operation timed out. +# Defaults to undef (use the default value in resource agent) +# +# [*demote_timeout*] +# (Optional) Maximum time in second for stopping a galera server +# before pacemaker considers the operation timed out. +# Defaults to undef (use the default value in resource agent) +# +# [*stop_timeout*] +# (Optional) Maximum time in second for ensuring a galera server is stopped +# before pacemaker considers the operation timed out. +# Defaults to undef (use the default value in resource agent) +# # [*force_ocf*] # (optional) Use --force when creating the ocf resource via pcs # Defaults to false @@ -187,7 +207,11 @@ class tripleo::profile::pacemaker::database::mysql_bundle ( $pcs_tries = hiera('pcs_tries', 20), $step = Integer(hiera('step')), $open_files_limit = 16384, + $start_timeout = undef, $promote_timeout = 300, + $monitor_timeout = undef, + $demote_timeout = undef, + $stop_timeout = undef, $force_ocf = false, ) { if $bootstrap_node and $::hostname == downcase($bootstrap_node) { @@ -499,11 +523,33 @@ MYSQL_HOST=localhost\n", before => Exec['galera-ready'], } + $op_start_params = $start_timeout ? { + undef => undef, + default => "start timeout=${start_timeout}s" + } + $op_promote_params = $promote_timeout ? { + undef => 'promote on-fail=block', + default => "promote timeout=${promote_timeout}s on-fail=block" + } + $op_monitor_params = $monitor_timeout ? { + undef => undef, + default => "monitor timeout=${monitor_timeout}s" + } + $op_demote_params = $demote_timeout ? { + undef => undef, + default => "demote timeout=${demote_timeout}s" + } + $op_stop_params = $stop_timeout ? { + undef => undef, + default => "stop timeout=${stop_timeout}s" + } + $op_params = join(delete_undef_values([$op_start_params, $op_promote_params, $op_monitor_params, $op_demote_params, $op_stop_params]), ' ') + pacemaker::resource::ocf { 'galera': ocf_agent_name => 'heartbeat:galera', master_params => '', meta_params => "master-max=${galera_nodes_count} ordered=true container-attribute-target=host", - op_params => "promote timeout=${promote_timeout}s on-fail=block", + op_params => $op_params, resource_params => "log='/var/log/mysql/mysqld.log' additional_parameters='--open-files-limit=${open_files_limit}' enable_creation=true wsrep_cluster_address='gcomm://${galera_nodes}' cluster_host_map='${cluster_host_map_string}'${two_node_mode_opt}", tries => $pcs_tries, location_rule => {