Skip to content
Snippets Groups Projects
Commit f420e759 authored by Andreas Kusalananda Kähäri's avatar Andreas Kusalananda Kähäri
Browse files

Now even scarier...

Conserver space by keeping at most two databases locally.  Might
still not be good enough to create deltas for mart.
parent df6d069e
No related branches found
No related tags found
No related merge requests found
......@@ -39,29 +39,40 @@ while (defined(my $line = <>)) {
}
foreach my $db (keys %thing) {
foreach my $v (@{ $thing{$db} }) {
print <<EOT;
if [ ! -f databases/${db}_$v.done ]; then
scp -c none -r ecs3:/mysqla/current/var/${db}_$v databases/
fi
my @pair;
print <<EOT;
# DATABASE: $db
EOT
}
foreach my $v (@{ $thing{$db} }) {
shift(@pair) if (scalar @pair == 2);
push(@pair, [ $db, $v ]);
next if (scalar @pair != 2);
for (my $i = 0; $i < scalar @{ $thing{$db} } - 1; ++$i) {
my $p0 = $pair[0][0] . '_' . $pair[0][1];
my $p1 = $pair[1][0] . '_' . $pair[1][1];
my $d = $p0 . '_delta_' . $pair[1][1];
print <<EOT;
if [ ! -f deltas/${db}_$thing{$db}[$i]_delta_$thing{$db}[$i + 1].txt ]; then
/usr/bin/time perl ./build.pl -c ./xdelta.osf -s databases -d deltas \\
$db $thing{$db}[$i] $thing{$db}[$i + 1] 2>&1 | \\
tee deltas/${db}_$thing{$db}[$i]_delta_$thing{$db}[$i + 1].txt
# DELTA: $pair[0][1] -> $pair[1][1]
if [ ! -d databases/$p0 -a ! -f databases/$p0.done ]; then
scp -c none -r ecs3:/mysqla/current/var/$p0 databases/
fi
if [ ! -d databases/$p1 -a ! -f databases/$p1.done ]; then
scp -c none -r ecs3:/mysqla/current/var/$p1 databases/
fi
if [ ! -f deltas/$d.txt ]; then
/usr/bin/time ./build.pl -c ./xdelta.osf -s databases -d deltas \\
$pair[0][0] $pair[0][1] $pair[1][1] 2>&1 | \\
tee deltas/$d.txt
rm -rf databases/$p0
touch databases/$p0.done
fi
EOT
}
foreach my $v (@{ $thing{$db} }) {
if (defined $pair[1]) {
print <<EOT;
if [ ! -f databases/${db}_$v.done ]; then
rm -rf databases/${db}_$v
touch databases/${db}_$v.done
if [ -d databases/$pair[1][0]_$pair[1][1] ]; then
rm -rf databases/$pair[1][0]_$pair[1][1]
touch databases/$pair[1][0]_$pair[1][1].done
fi
EOT
}
......
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