Commit be8e8905 authored by Leigh Stoller's avatar Leigh Stoller

Fix problem that David mentioned a few weeks back, that backup was not

compressing all the files in the mysql directory. Turns out that the
Mothership has passed some threshold and mysqld is creating about 6
updates files a day. Changed backup to look for them and compress them.
parent c1ba87c6
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2016 University of Utah and the Flux Group.
# Copyright (c) 2000-2017 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -70,6 +70,7 @@ my $SLOW = "slowqueries";
my $BACK = "tbdb";
my $BACKUPDAYS = "30";
my $extension;
my @updatefiles = ();
my $dohotcopy = 0;
my $dbname = "mysql";
my $dbuser = "root";
......@@ -207,9 +208,19 @@ open(IDX, "< $LOGDIR/update.index") or
fatal("Could not open $LOGDIR/update.index: $!");
while (<IDX>) {
if ($_ =~ /^.*\.([0-9]*)$/) {
my $file = $_;
chomp($file);
if ($file =~ /^.*\.([0-9]*)$/) {
$extension = $1;
}
#
# Watch for uncompressed update files, we now get more then one
# per day on super busy clusters.
#
if (-e $file) {
push(@updatefiles, $file);
}
}
close(IDX);
print "Extension: $extension\n";
......@@ -231,13 +242,11 @@ if ($dohotcopy) {
my $backname = "$BACK.$extension";
my $basename = "$BASE.$extension";
my $updname = "$UPD.$extension";
my $slowname = "$SLOW.$extension";
print "Backup file name: $backname\n"
if (!$opsmode);
print "Base file name: $basename\n";
print "Update file name: $updname\n";
print "Slow file name: $slowname\n";
#
......@@ -308,14 +317,16 @@ if (-e "$basename" && system("nice gzip $basename")) {
fatal("gzip $basename failed!");
}
if (-e "$updname" && system("nice gzip $updname")) {
fatal("gzip $updname failed!");
}
if (-e "$slowname" && system("nice gzip $slowname")) {
fatal("gzip $slowname failed!");
}
foreach my $updname (@updatefiles) {
if (-e "$updname" && system("nice gzip $updname")) {
fatal("gzip $updname failed!");
}
}
# Do this now that the backup is complete.
if ($dohotcopy && -e "$BACKUPDIR/tbdb") {
system("/bin/rm -r $BACKUPDIR/tbdb") == 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment