Changeset 379
- Timestamp:
- 08/25/06 01:39:52 (2 years ago)
- Files:
-
- branches/server-newrepl/lib/MogileFS/Worker.pm (modified) (3 diffs)
- branches/server-newrepl/lib/MogileFS/Worker/Replicate.pm (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/server-newrepl/lib/MogileFS/Worker.pm
r353 r379 5 5 'readbuf', # unparsed data from parent 6 6 'monitor_has_run', # true once we've heard of the monitor job being alive 7 'last_ping', # time we last said we're alive 7 8 ); 8 9 … … 21 22 $self->{last_bcast_state} = {}; 22 23 $self->{monitor_has_run} = 0; 24 $self->{last_ping} = 0; 23 25 24 26 IO::Handle::blocking($psock, 0); … … 43 45 sub still_alive { 44 46 my $self = shift; 45 $self->send_to_parent(":still_alive"); # a no-op, just for the watchdog 47 my $now = time(); 48 if ($now > $self->{last_ping}) { 49 $self->send_to_parent(":still_alive"); # a no-op, just for the watchdog 50 $self->{last_ping} = $now; 51 } 46 52 } 47 53 branches/server-newrepl/lib/MogileFS/Worker/Replicate.pm
r378 r379 38 38 return 0; 39 39 } 40 41 # replicator wants 42 sub watchdog_timeout { 30; } 40 43 41 44 # { fid => lastcheck }; instructs us not to replicate this fid... we will clear … … 223 226 while ($fixed < $LIMIT && $devcount < $min) { 224 227 my $now = time(); 228 $self->still_alive; 229 225 230 my $fids = $dbh->selectcol_arrayref("SELECT fid FROM file WHERE dmid=? AND classid=? ". 226 231 "AND devcount = ? AND length IS NOT NULL ". … … 258 263 259 264 $self->read_from_parent; 265 $self->still_alive; 260 266 261 267 if (my $status = replicate($dbh, $fid, class => $mclass)) { … … 422 428 my $rv = undef; 423 429 if (MogileFS::Config->http_mode) { 424 my $lastping = time();425 430 my $worker = MogileFS::ProcManager->is_child or die; 426 431 $rv = http_copy( … … 430 435 expected_len => undef, # FIXME: get this info to pass along 431 436 errref => \$copy_err, 432 callback => sub { 433 my $now = time(); 434 return if $now == $lastping; # ping once per second 435 $worker->still_alive; 436 $lastping = $now; 437 }, 437 callback => sub { $worker->still_alive; }, 438 438 ); 439 439 die "Bogus error code" if !$rv && $copy_err !~ /^(?:src|dest)_error$/;
