[sql.pp][wip] : Orchestration issue prevent mysql from starting

Current log when mysql start to boot from the first time :

    InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
    InnoDB: than specified in the .cnf file 0 268435456 bytes!

Run steps :

    [...]
    Info: /Stage[main]/Mysql::Config/File[/etc/mysql/my.cnf]: Filebucketed /etc/mysql/my.cnf to puppet with sum 1452aab3bef03ec49095a3229fca9f6c
    Notice: /Stage[main]/Mysql::Config/File[/etc/mysql/my.cnf]/content: content changed '{md5}1452aab3bef03ec49095a3229fca9f6c' to '{md5}a33fae5c74d28e2ed3c0fd351583cc67'
    Info: /Stage[main]/Mysql::Config/File[/etc/mysql/my.cnf]: Scheduling refresh of Exec[mysqld-restart]
    Notice: /Stage[main]/Cloud::Database::Sql/Mysql::Server::Config[basic_config]/File[/etc/mysql/conf.d/basic_config.cnf]/ensure: defined content as '{md5}70f11e839260b7866e64cf90544e4fa6'
    Notice: /Stage[main]/Mysql::Config/Exec[set_mysql_rootpw]/returns: executed successfully
    Info: /Stage[main]/Mysql::Config/Exec[set_mysql_rootpw]: Scheduling refresh of Exec[mysqld-restart]
    [...]

What happens :

The mysql process try to restart (event triggered by a previous change) before the exec{'clean-mysql-binlog'} is run,
so the ib_logfile* are not removed and are still 5M when they are specified 256M in the mysql configuration file.
Hence the mysql process refusing to start.

Solution :

The following commit is a WIP, mainly to try to explain a patch idea.
We should make sure that if the ib_logfile does not match the configuration server should be stopped, files removed and server restarted.

close #9
This commit is contained in:
Yanis Guenane
2014-01-15 15:42:16 -05:00
parent 8c65ee7c02
commit a8a3c98bd7

View File

@@ -175,12 +175,14 @@ class cloud::database::sql (
exec{'clean-mysql-binlog':
# first sync take a long time
command => '/bin/bash -c "/usr/bin/mysqladmin --defaults-file=/root/.my.cnf shutdown ; killall -9 nc ; /bin/rm -f /var/lib/mysql/ib_logfile* || { true ; sleep 60 ; }"',
command => "/bin/bash -c '/usr/bin/mysqladmin --defaults-file=/root/.my.cnf shutdown ; /bin/rm ${::mysql::params::datadir}/ib_logfile*'",
require => [
File['/root/.my.cnf'],
Service['mysqld'],
],
unless => 'test `du -sh /var/lib/mysql/ib_logfile0 | cut -f1` = "256M"',
notify => Exec['mysqld-restart'],
refreshonly => true,
onlyif => "stat ${::mysql::params::datadir}/ib_logfile0 && test `du -sh ${::mysql::params::datadir}/ib_logfile0 | cut -f1` != '256M'",
}
@@ -208,8 +210,8 @@ basedir = /usr
# TODO/WARNING(Gonéri): template changes do not trigger configuration changes
mysql::server::config{'basic_config':
notify_service => true,
settings => template('cloud/database/mysql.conf.erb'),
require => Exec['clean-mysql-binlog'];
notify => Exec['clean-mysql-binlog'],
settings => template('cloud/database/mysql.conf.erb')
}
@@haproxy::balancermember{$::fqdn: