From 3a2570be8e85ef917b88cc732676b488e04f9cbd Mon Sep 17 00:00:00 2001 From: hjp Date: Thu, 2 Sep 2010 11:41:21 +0000 Subject: [PATCH] fixed some typos --- lib/Simba/CA.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/Simba/CA.pm b/lib/Simba/CA.pm index 20bc78b..e3ac2b1 100644 --- a/lib/Simba/CA.pm +++ b/lib/Simba/CA.pm @@ -155,9 +155,11 @@ sub backup2disk { # XXX - lock fileset here, we don't want to backup the same fileset twice concurrently. # theoretically something like - $self->{dbh}->selectall_arrayref(q{select * from filesets where id = ?}, {}, $target->{id}); + $self->{dbh}->selectall_arrayref(q{select * from filesets where id = ? for update}, {}, $target->{id}); # should suffice, but I'm not sure if that blocks too much (does that block reads? block the whole table?) # Just try it and we will see ... + # According to the manual this only works if autocommit is off, so it probably doesn't work on MyISAM + # anyway. $self->log(3, "starting backup for target host " . $target->{host} . " dir " . $target->{dir}); $self->{target} = $target; @@ -591,13 +593,13 @@ sub linkdup { unless ($self->{sessions_on_same_device}) { my $st = stat($backup_filename); my $my_dev = defined $st ? $st->dev : ""; # can this happen? - my $sth = $self->{dbh}->prepare("select * sessions oder yb order by id desc"); + my $sth = $self->{dbh}->prepare("select * from sessions order by id desc"); $sth->execute(); while (my $r = $sth->fetchrow_hashref()) { my $st = lstat $r->{prefix}; my $dev = defined $st ? $st->dev : "";; - next unless $dev ne $my_dev; - last if @{ $self->{sessions_on_same_device} } > 30; + next unless $dev eq $my_dev; + last if $self->{sessions_on_same_device} && @{ $self->{sessions_on_same_device} } > 30; push @{ $self->{sessions_on_same_device} }, $r; }