/[rserv]/share/RServ.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /share/RServ.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by dpavlin, Wed Aug 6 00:28:29 2003 UTC revision 1.5 by dpavlin, Sun Oct 26 23:43:54 2003 UTC
# Line 43  sub GetSlaveId Line 43  sub GetSlaveId
43    
44  sub PrepareSnapshot  sub PrepareSnapshot
45  {  {
46      my ($conn, $sconn, $outf, $server) = @_; # (@_[0], @_[1], @_[2], $_[3]);      my ($conn, $sconn, $outf, $server, $onlytables) = @_;
47    
48      # first, we must know for wich tables the slave subscribed      # first, we must know for wich tables the slave subscribed
49      my $result = $sconn->exec("SELECT tname FROM _RSERV_SLAVE_TABLES_");      my $result = $sconn->exec("SELECT tname FROM _RSERV_SLAVE_TABLES_");
# Line 89  sub PrepareSnapshot Line 89  sub PrepareSnapshot
89      while (@row = $result->fetchrow)      while (@row = $result->fetchrow)
90      {      {
91          #       printf "$row[0], $row[1], $row[2]\n";          #       printf "$row[0], $row[1], $row[2]\n";
92                    if (ref($onlytables) eq 'HASH') {
93                            next unless (exists $onlytables->{$row[1]});
94                            $onlytables->{$row[1]} = $row[0] unless ($onlytables->{$row[1]});
95                    }
96          push @{$Mtables{$row[0]}}, $row[1], $row[2], $row[3];          push @{$Mtables{$row[0]}}, $row[1], $row[2], $row[3];
97      }      }
98            
# Line 330  sub GetSYNCID Line 334  sub GetSYNCID
334    
335  sub CleanLog  sub CleanLog
336  {  {
337      my ($conn, $howold) = @_; # (@_[0], @_[1]);      my ($conn, $howold, $onlytables) = @_; # (@_[0], @_[1]);
338            
339      my $result = $conn->exec("BEGIN");      my $result = $conn->exec("BEGIN");
340      if ($result->resultStatus ne PGRES_COMMAND_OK)      if ($result->resultStatus ne PGRES_COMMAND_OK)
# Line 372  sub CleanLog Line 376  sub CleanLog
376      my $alist = join(',', keys %active);      my $alist = join(',', keys %active);
377      my $sinfo = "logid < $maxid";      my $sinfo = "logid < $maxid";
378      $sinfo .= " AND logid not in ($alist)" if $alist ne '';      $sinfo .= " AND logid not in ($alist)" if $alist ne '';
379            #if (ref($onlytables) eq 'HASH') {
380        #   foreach my $onlytable (keys %{$onlytables}) {
381        #           $sinfo
382        #   }
383        #}
384      $sql = "delete from _RSERV_LOG_ where " .      $sql = "delete from _RSERV_LOG_ where " .
385          "logtime < now() - '$howold second'::interval AND $sinfo";          "logtime < now() - '$howold second'::interval AND $sinfo";
386            
# Line 400  sub CleanLog Line 408  sub CleanLog
408    
409  sub ApplySnapshot  sub ApplySnapshot
410  {  {
411      my ($conn, $inpf) = @_; # (@_[0], @_[1]);      my ($conn, $inpf, $onlytables) = @_; # (@_[0], @_[1]);
412            
413      my $result = $conn->exec("BEGIN");      my $result = $conn->exec("BEGIN");
414      if ($result->resultStatus ne PGRES_COMMAND_OK)      if ($result->resultStatus ne PGRES_COMMAND_OK)
# Line 435  sub ApplySnapshot Line 443  sub ApplySnapshot
443      while (my @row = $result->fetchrow)      while (my @row = $result->fetchrow)
444      {      {
445          #       printf "\t%s\t%s\t%s\t\n", $row[1], $row[0], $row[2], $row[3];          #       printf "\t%s\t%s\t%s\t\n", $row[1], $row[0], $row[2], $row[3];
446                    if (ref($onlytables) eq 'HASH') {
447                            next unless (exists $onlytables->{$row[1]});
448                            $onlytables->{$row[1]} = $row[0] unless ($onlytables->{$row[1]});
449                    }
450          push @{$Stables{$row[1]}}, $row[0], $row[2], $row[3];          push @{$Stables{$row[1]}}, $row[0], $row[2], $row[3];
451      }      }
452    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.26