From: Tom Hughes Date: Tue, 1 Jan 2019 08:54:39 +0000 (+0000) Subject: Make replication delay monitoring more reliable X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/35171e1e6bceb46b7d575de5dda768eb97f4bd49 Make replication delay monitoring more reliable --- diff --git a/cookbooks/munin/files/default/plugins/replication_delay b/cookbooks/munin/files/default/plugins/replication_delay index f6cd317a9..27dd10809 100755 --- a/cookbooks/munin/files/default/plugins/replication_delay +++ b/cookbooks/munin/files/default/plugins/replication_delay @@ -22,8 +22,7 @@ if [ "$1" = "config" ]; then exit 0 fi -latest_changes=$(ls /var/lib/replicate/changes-*.osc.gz | sort --version-sort | tail -1) -tstamp=$(osmium fileinfo --extended --get=data.timestamp.last ${latest_changes}) +tstamp=$(osmium fileinfo --extended --get=data.timestamp.last /var/lib/replicate/changes-latest.osc.gz) tstampsec=$(date --date=${tstamp} +%s) nowsec=$(date +%s) diff --git a/cookbooks/tile/templates/default/replicate.erb b/cookbooks/tile/templates/default/replicate.erb index 8ebfd94a5..81fc66419 100644 --- a/cookbooks/tile/templates/default/replicate.erb +++ b/cookbooks/tile/templates/default/replicate.erb @@ -60,8 +60,17 @@ do # No need to rollback now rm sequence-prev.txt + # Get buffer count + buffers=$(osmium fileinfo --extended --get=data.buffers.count ${file}) + + # If this diff has content mark it as the latest diff + if [ $buffers -gt 0 ] + then + ln -f ${file} changes-latest.osc.gz + fi + # Queue these changes for expiry processing - ln ${file} expire-queue/$file + ln ${file} expire-queue/${file} # Delete old downloads find . -name 'changes-*.gz' -mmin +300 -exec rm -f {} \;