mirror of
https://github.com/ceph/ceph
synced 2025-01-31 15:32:38 +00:00
LogClient: Add a mon data member and mon selection code.
Replaces removed MonMap::pick_mon
This commit is contained in:
parent
d3ebec388e
commit
afa15782c4
@ -79,11 +79,12 @@ void LogClient::_send_log()
|
||||
return;
|
||||
MLog *log = new MLog(monmap->get_fsid(), log_queue);
|
||||
|
||||
int mon;
|
||||
if (messenger->get_myname().is_mon())
|
||||
mon = messenger->get_myname().num(); // if we are a monitor, queue for ourselves
|
||||
else
|
||||
mon = monmap->pick_mon();
|
||||
if (mon < 0) {
|
||||
if (messenger->get_myname().is_mon())
|
||||
mon = messenger->get_myname().num(); // if we are a monitor, queue for ourselves
|
||||
else
|
||||
mon = rand() % monmap->mon_inst.size();
|
||||
}
|
||||
|
||||
dout(10) << "send_log to mon" << mon << dendl;
|
||||
messenger->send_message(log, monmap->get_inst(mon));
|
||||
|
@ -31,6 +31,7 @@ class MonMap;
|
||||
class LogClient : public Dispatcher {
|
||||
Messenger *messenger;
|
||||
MonMap *monmap;
|
||||
int mon;
|
||||
|
||||
bool ms_dispatch(Message *m);
|
||||
bool is_synchronous;
|
||||
@ -56,7 +57,7 @@ class LogClient : public Dispatcher {
|
||||
void set_synchronous(bool sync) { is_synchronous = sync; }
|
||||
|
||||
LogClient(Messenger *m, MonMap *mm) :
|
||||
messenger(m), monmap(mm), is_synchronous(false),
|
||||
messenger(m), monmap(mm), mon(-1), is_synchronous(false),
|
||||
log_lock("LogClient::log_lock"), last_log(0) { }
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user