Puppet Class: profile::wmcs::db::wikireplicas::kill_long_running_queries

Defined in:
modules/profile/manifests/wmcs/db/wikireplicas/kill_long_running_queries.pp

Overview

patched version of pt-kill and configuration

This profile installs the config file for wmf-kill-wmf as well the wmf-pt-kill contains the systemd service and the patched script itself

Parameters:

  • victims (Any) (defaults to: lookup(profile::wmcs::db::wikireplicas::kill_long_running_queries::pt_kill_victims,))
  • interval (Any) (defaults to: lookup(profile::wmcs::db::wikireplicas::kill_long_running_queries::pt_kill_interval,))
  • busy_time (Any) (defaults to: lookup(profile::wmcs::db::wikireplicas::kill_long_running_queries::pt_kill_busy_time,))
  • match_command (Any) (defaults to: lookup(profile::wmcs::db::wikireplicas::kill_long_running_queries::pt_kill_match_command,))
  • match_user (Any) (defaults to: lookup(profile::wmcs::db::wikireplicas::kill_long_running_queries::pt_kill_match_user,))
  • log (Any) (defaults to: lookup(profile::wmcs::db::wikireplicas::kill_long_running_queries::pt_kill_log,))
  • socket (Any) (defaults to: lookup(profile::wmcs::db::wikireplicas::kill_long_running_queries::pt_kill_socket,))
  • instances (Optional[Hash[String, Stdlib::Datasize]]) (defaults to: lookup('profile::wmcs::db::wikireplicas::mariadb_multiinstance::instances', {default_value => undef}))


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'modules/profile/manifests/wmcs/db/wikireplicas/kill_long_running_queries.pp', line 7

class profile::wmcs::db::wikireplicas::kill_long_running_queries (
    $victims        = lookup(profile::wmcs::db::wikireplicas::kill_long_running_queries::pt_kill_victims,),
    $interval       = lookup(profile::wmcs::db::wikireplicas::kill_long_running_queries::pt_kill_interval,),
    $busy_time      = lookup(profile::wmcs::db::wikireplicas::kill_long_running_queries::pt_kill_busy_time,),
    $match_command  = lookup(profile::wmcs::db::wikireplicas::kill_long_running_queries::pt_kill_match_command,),
    $match_user     = lookup(profile::wmcs::db::wikireplicas::kill_long_running_queries::pt_kill_match_user,),
    $log            = lookup(profile::wmcs::db::wikireplicas::kill_long_running_queries::pt_kill_log,),
    $socket         = lookup(profile::wmcs::db::wikireplicas::kill_long_running_queries::pt_kill_socket,),
    Optional[Hash[String, Stdlib::Datasize]] $instances = lookup('profile::wmcs::db::wikireplicas::mariadb_multiinstance::instances', {default_value => undef}),
){
    require ::profile::wmcs::db::scriptconfig

    file { '/etc/default/wmf-pt-kill':
        ensure  => file,
        content => template('role/mariadb/wmf-pt-kill.erb'),
        owner   => 'root',
        group   => 'root',
        mode    => '0644',
    }
    package { 'wmf-pt-kill':
        ensure => present,
    }
    if $instances {
        service { 'wmf-pt-kill':
            ensure => stopped,
            enable => 'mask',
        }
        file { '/etc/logrotate.d/wmf-pt-kill':
            ensure => absent,
        }

        $instances.each |$section, $buffer_pool| {
            $logfile = "/var/log/wmf-pt-kill/wmf-pt-kill-${section}.log"
            $instance_socket = "/var/run/mysqld/mysqld.${section}.sock"
            systemd::service { "wmf-pt-kill@${section}":
                ensure  => present,
                restart => true,
                content => systemd_template('wmcs/db/wikireplicas/wmf-pt-kill@'),
            }
            logrotate::rule { "wmf-pt-kill-${section}":
                ensure        => present,
                file_glob     => $logfile,
                frequency     => 'weekly',
                copy_truncate => true,
                missing_ok    => true,
                not_if_empty  => true,
                rotate        => 4,
                create        => '640 wmf-pt-kill wmf-pt-kill'
            }
        }
    } else {
        service { 'wmf-pt-kill':
            ensure => running,
        }
    }
}