Lets time the super long migrations we have to run

Sometimes the subunit2sql DB migrations can take a *really* long time
it'd kinda be nice to know exactly how long. In an effort to actually
know the duration this commit simple runs the DB migrations under
time to record how much time we're actually spending on running these
migrations. That way it'll be logged in case anyone wants to bother to
check. (which is admittedly unlikely)

Change-Id: I31fe204f0544e9b7b58158a578552f907aa18543
This commit is contained in:
Matthew Treinish 2015-11-16 18:52:31 -05:00
parent 8b8b088640
commit c38d9d37d4
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
2 changed files with 14 additions and 3 deletions

3
files/run_migrations.sh Normal file
View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
(time subunit2sql-db-manage --config-file /etc/subunit2sql.conf upgrade head) > /var/log/subunit2sql_migration.log 2>&1 &

View File

@ -40,10 +40,18 @@ class subunit2sql::server (
content => template('subunit2sql/subunit2sql-my.cnf.erb'),
}
file {'/usr/local/bin/run_migrations.sh':
ensure => present,
owner => 'root',
group => 'root',
mode => '0555',
source => 'puppet:///modules/subunit2sql/run_migrations.sh',
require => File['/etc/subunit2sql.conf']
}
exec { 'upgrade_subunit2sql_db':
command => 'subunit2sql-db-manage --config-file /etc/subunit2sql.conf upgrade head > /var/log/subunit2sql_migration.log 2>&1 &',
path => '/usr/local/bin:/usr/bin:/bin/',
require => File['/etc/subunit2sql-my.cnf'],
command => '/usr/local/bin/run_migrations.sh',
require => File['/usr/local/bin/run_migrations.sh'],
subscribe => Package['subunit2sql'],
refreshonly => true,
timeout => 0,