From 1bcee06fc34b0fe23f0e2698b75a6aa34b344d12 Mon Sep 17 00:00:00 2001 From: sage Date: Thu, 24 Aug 2006 22:08:23 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@812 29311d96-e01e-0410-9327-a35deaab8ce9 --- ceph/Makefile | 1 + ceph/messages/MMonElectionStatus.h | 2 +- ceph/mon/Elector.cc | 24 ++++++++++++------------ ceph/mon/Elector.h | 6 +++--- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/ceph/Makefile b/ceph/Makefile index d9b00dc066390..8d0c0ca9341b6 100644 --- a/ceph/Makefile +++ b/ceph/Makefile @@ -63,6 +63,7 @@ COMMON_OBJS= \ common/Clock.o\ common/Timer.o\ mon/Monitor.o\ + mon/Elector.o\ config.o diff --git a/ceph/messages/MMonElectionStatus.h b/ceph/messages/MMonElectionStatus.h index d3e861d0ffa76..510c27823ac81 100644 --- a/ceph/messages/MMonElectionStatus.h +++ b/ceph/messages/MMonElectionStatus.h @@ -26,7 +26,7 @@ class MMonElectionStatus : public Message { map registry; MMonElectionStatus() {} - MMonElectionStatus(int _q, int r, map reg) : + MMonElectionStatus(int _q, int r, map reg) : Message(MSG_MON_ELECTION_STATUS), q(_q), read_num(r), registry(reg) {} diff --git a/ceph/mon/Elector.cc b/ceph/mon/Elector.cc index f21a3e82b1736..03cc0da11ff43 100644 --- a/ceph/mon/Elector.cc +++ b/ceph/mon/Elector.cc @@ -56,9 +56,9 @@ void Elector::trip_timer() views[whoami].expired = true; registry[whoami].epoch.s_num++; dout(1) << "Process " << whoami - << " timed out (" << m->ackMsgCount << "/" << (m->f + 1) + << " timed out (" << ack_msg_count << "/" << (f + 1) << ") ... increasing epoch. Now epoch is " - << m->registry[whoami]->epoch->s_num + << registry[whoami].epoch.s_num << endl; } lock.Unlock(); @@ -87,8 +87,8 @@ void Elector::refresh_timer() } // Start the trip timer - round_trip_timer = new C_Elect_TripTimer(this); - g_timer.add_event_after(trip_delta, m->round_trip_timer); + //round_trip_timer = new C_Elect_TripTimer(this); + g_timer.add_event_after(trip_delta, new C_Elect_TripTimer(this)); } lock.Unlock(); }; @@ -141,18 +141,18 @@ void Elector::dispatch(Message *m) void Elector::handle_ack(MMonElectionAck* msg) { - assert(refresh_num >= msg->get_refresh_num()); + assert(refresh_num >= msg->refresh_num); - if (refresh_num > msg->get_refresh_num()) { + if (refresh_num > msg->refresh_num) { // we got the message too late... discard it return; } ack_msg_count++; if (ack_msg_count >= f + 1) { - dout(5) << "P" << p_id << ": Received _f+1 acks, increase freshness" << endl; - g_timer.cancel_event(round_trip_task); - round_trip_timer->cancel(); - registry[p_id]->freshness++; + dout(5) << "Received _f+1 acks, increase freshness" << endl; + //g_timer.cancel_event(round_trip_task); + //round_trip_timer->cancel(); + registry[whoami].freshness++; } delete msg; @@ -161,7 +161,7 @@ void Elector::handle_ack(MMonElectionAck* msg) void Elector::handle_collect(MMonElectionCollect* msg) { mon->messenger->send_message(new MMonElectionStatus(msg->get_source().num(), - msg->getReadNum(), + msg->read_num, registry), msg->get_source()); delete msg; @@ -186,7 +186,7 @@ void Elector::handle_refresh(MMonElectionRefresh* msg) void Elector::handle_status(MMonElectionStatus* msg) { if (read_num != msg->read_num) { - dout(1) << ":HANDLING:" << msg->getType() + dout(1) << "handle_status " << ":DISCARDED B/C OF READNUM(" << read_num << ":" << msg->read_num << ")" << endl; diff --git a/ceph/mon/Elector.h b/ceph/mon/Elector.h index b2b256cf2d5f0..004401a368acc 100644 --- a/ceph/mon/Elector.h +++ b/ceph/mon/Elector.h @@ -49,8 +49,8 @@ class Elector { Epoch epoch; int freshness; - State() {}; - State (Epoch& e, int f) : + State() : freshness(0) {}; + State(Epoch& e, int f) : epoch(e), freshness(f) {} }; @@ -84,7 +84,7 @@ class Elector { int f; // the processes that compose the group - // vector processes; + vector processes; // parameters for the process int main_delta; int trip_delta; -- 2.39.5