Changeset 353
- Timestamp:
- 08/16/06 01:03:00 (2 years ago)
- Files:
-
- branches/server-newrepl/lib/MogileFS/ProcManager.pm (modified) (2 diffs)
- branches/server-newrepl/lib/MogileFS/Worker.pm (modified) (4 diffs)
- branches/server-newrepl/lib/MogileFS/Worker/Monitor.pm (modified) (1 diff)
- branches/server-newrepl/lib/MogileFS/Worker/Replicate.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/server-newrepl/lib/MogileFS/ProcManager.pm
r338 r353 549 549 550 550 } elsif ($cmd eq ":still_alive") { 551 552 551 # a no-op 552 553 } elsif ($cmd eq ":monitor_just_ran") { 554 send_monitor_has_run($child); 553 555 554 556 } elsif ($cmd =~ /^:invalidate_meta (\w+)/) { … … 646 648 } 647 649 650 sub send_monitor_has_run { 651 my $child = shift; 652 for my $type (qw(replicate)) { 653 MogileFS::ProcManager->ImmediateSendToChildrenByJob($type, ":monitor_has_run", $child); 654 } 655 } 656 648 657 1; 649 658 branches/server-newrepl/lib/MogileFS/Worker.pm
r338 r353 4 4 'last_bcast_state', # "{device|host}-$devid" => [$time, {alive|dead}] 5 5 'readbuf', # unparsed data from parent 6 'monitor_has_run', # true once we've heard of the monitor job being alive 6 7 ); 7 8 … … 19 20 $self->{readbuf} = ''; 20 21 $self->{last_bcast_state} = {}; 22 $self->{monitor_has_run} = 0; 21 23 22 24 IO::Handle::blocking($psock, 0); … … 30 32 sub get_dbh { 31 33 return Mgd::get_dbh(); 34 } 35 36 sub monitor_has_run { 37 my $self = shift; 38 return $self->{monitor_has_run} ? 1 : 0; 32 39 } 33 40 … … 184 191 } 185 192 193 if ($$lineref =~ /^:monitor_has_run/) { 194 $self->{monitor_has_run} = 1; 195 return 1; 196 } 197 186 198 # TODO: warn on unknown commands? 187 199 branches/server-newrepl/lib/MogileFS/Worker/Monitor.pm
r342 r353 126 126 } 127 127 } 128 129 # announce to the parent that we've run 130 $self->send_to_parent(":monitor_just_ran"); 128 131 }); 129 132 branches/server-newrepl/lib/MogileFS/Worker/Replicate.pm
r352 r353 50 50 every(2.0, sub { 51 51 $self->parent_ping; 52 53 # replication doesn't go well if the monitor job hasn't actively started 54 # marking things as being available 55 unless ($self->monitor_has_run) { 56 error("waiting for monitor job to complete a cycle before beginning replication"); 57 return; 58 } 52 59 53 60 $self->validate_dbh;
