mirror of
https://github.com/ceph/ceph
synced 2025-04-11 04:02:04 +00:00
mon: use connection hook to resend mon requests
This commit is contained in:
parent
7e5d162edd
commit
df0c52a1d7
22
src/ceph.cc
22
src/ceph.cc
@ -231,26 +231,16 @@ static void send_observe_requests()
|
|||||||
|
|
||||||
bool sent = false;
|
bool sent = false;
|
||||||
for (int i=0; i<PAXOS_NUM; i++) {
|
for (int i=0; i<PAXOS_NUM; i++) {
|
||||||
if (registered.count(i))
|
|
||||||
continue;
|
|
||||||
MMonObserve *m = new MMonObserve(mc.monmap.fsid, i, map_ver[i]);
|
MMonObserve *m = new MMonObserve(mc.monmap.fsid, i, map_ver[i]);
|
||||||
dout(1) << "mon" << " <- observe " << get_paxos_name(i) << dendl;
|
dout(1) << "mon" << " <- observe " << get_paxos_name(i) << dendl;
|
||||||
mc.send_mon_message(m);
|
mc.send_mon_message(m);
|
||||||
sent = true;
|
sent = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
registered.clear();
|
||||||
float seconds = g_conf.paxos_observer_timeout/2;
|
float seconds = g_conf.paxos_observer_timeout/2;
|
||||||
float retry_seconds = 5.0;
|
dout(1) << " refresh after " << seconds << " with same mon" << dendl;
|
||||||
if (!sent) {
|
timer.add_event_after(seconds, new C_ObserverRefresh(false));
|
||||||
// success. clear for renewal.
|
|
||||||
registered.clear();
|
|
||||||
dout(1) << " refresh after " << seconds << " with same mon" << dendl;
|
|
||||||
timer.add_event_after(seconds, new C_ObserverRefresh(false));
|
|
||||||
} else {
|
|
||||||
//is_timeout = true;
|
|
||||||
dout(1) << " refresh after " << retry_seconds << " with new mon" << dendl;
|
|
||||||
timer.add_event_after(retry_seconds, new C_ObserverRefresh(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -369,7 +359,7 @@ class Admin : public Dispatcher {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ms_handle_reset(Connection *con) {
|
void ms_handle_connect(Connection *con) {
|
||||||
if (con->get_peer_type() == CEPH_ENTITY_TYPE_MON) {
|
if (con->get_peer_type() == CEPH_ENTITY_TYPE_MON) {
|
||||||
lock.Lock();
|
lock.Lock();
|
||||||
if (observe)
|
if (observe)
|
||||||
@ -377,11 +367,9 @@ class Admin : public Dispatcher {
|
|||||||
if (pending_cmd.size())
|
if (pending_cmd.size())
|
||||||
send_command();
|
send_command();
|
||||||
lock.Unlock();
|
lock.Unlock();
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
bool ms_handle_reset(Connection *con) { return false; }
|
||||||
void ms_handle_remote_reset(Connection *con) {}
|
void ms_handle_remote_reset(Connection *con) {}
|
||||||
|
|
||||||
} dispatcher;
|
} dispatcher;
|
||||||
|
@ -5934,6 +5934,13 @@ int Client::get_local_osd()
|
|||||||
|
|
||||||
// ===============================
|
// ===============================
|
||||||
|
|
||||||
|
void Client::ms_handle_connect(Connection *con)
|
||||||
|
{
|
||||||
|
dout(0) << "ms_handle_connect on " << con->get_peer_addr() << dendl;
|
||||||
|
Mutex::Locker l(client_lock);
|
||||||
|
objecter->ms_handle_connect(con);
|
||||||
|
}
|
||||||
|
|
||||||
bool Client::ms_handle_reset(Connection *con)
|
bool Client::ms_handle_reset(Connection *con)
|
||||||
{
|
{
|
||||||
dout(0) << "ms_handle_reset on " << con->get_peer_addr() << dendl;
|
dout(0) << "ms_handle_reset on " << con->get_peer_addr() << dendl;
|
||||||
|
@ -1093,6 +1093,7 @@ protected:
|
|||||||
friend class SyntheticClient;
|
friend class SyntheticClient;
|
||||||
bool ms_dispatch(Message *m);
|
bool ms_dispatch(Message *m);
|
||||||
|
|
||||||
|
void ms_handle_connect(Connection *con);
|
||||||
bool ms_handle_reset(Connection *con);
|
bool ms_handle_reset(Connection *con);
|
||||||
void ms_handle_remote_reset(Connection *con);
|
void ms_handle_remote_reset(Connection *con);
|
||||||
|
|
||||||
|
@ -116,11 +116,10 @@ bool LogClient::ms_dispatch(Message *m)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool LogClient::ms_handle_reset(Connection *con)
|
void LogClient::ms_handle_connect(Connection *con)
|
||||||
{
|
{
|
||||||
if (con->get_peer_type() == CEPH_ENTITY_TYPE_MON) {
|
if (con->get_peer_type() == CEPH_ENTITY_TYPE_MON) {
|
||||||
dout(10) << "ms_handle_reset on mon " << con->get_peer_addr() << ", resending pending log events" << dendl;
|
dout(10) << "ms_handle_connect on mon " << con->get_peer_addr() << ", resending pending log events" << dendl;
|
||||||
send_log();
|
send_log();
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,9 @@ class LogClient : public Dispatcher {
|
|||||||
bool is_synchronous;
|
bool is_synchronous;
|
||||||
void _send_log();
|
void _send_log();
|
||||||
|
|
||||||
bool ms_handle_reset(Connection *con);
|
void ms_handle_connect(Connection *con);
|
||||||
|
|
||||||
|
bool ms_handle_reset(Connection *con) { return false; }
|
||||||
void ms_handle_remote_reset(Connection *con) {}
|
void ms_handle_remote_reset(Connection *con) {}
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,6 +58,7 @@ class RadosClient : public Dispatcher
|
|||||||
bool _dispatch(Message *m);
|
bool _dispatch(Message *m);
|
||||||
bool ms_dispatch(Message *m);
|
bool ms_dispatch(Message *m);
|
||||||
|
|
||||||
|
void ms_handle_connect(Connection *con);
|
||||||
bool ms_handle_reset(Connection *con);
|
bool ms_handle_reset(Connection *con);
|
||||||
void ms_handle_remote_reset(Connection *con);
|
void ms_handle_remote_reset(Connection *con);
|
||||||
|
|
||||||
@ -341,6 +342,12 @@ bool RadosClient::ms_dispatch(Message *m)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RadosClient::ms_handle_connect(Connection *con)
|
||||||
|
{
|
||||||
|
Mutex::Locker l(lock);
|
||||||
|
objecter->ms_handle_connect(con);
|
||||||
|
}
|
||||||
|
|
||||||
bool RadosClient::ms_handle_reset(Connection *con)
|
bool RadosClient::ms_handle_reset(Connection *con)
|
||||||
{
|
{
|
||||||
Mutex::Locker l(lock);
|
Mutex::Locker l(lock);
|
||||||
|
@ -1388,6 +1388,13 @@ bool MDS::_dispatch(Message *m)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void MDS::ms_handle_connect(Connection *con)
|
||||||
|
{
|
||||||
|
Mutex::Locker l(mds_lock);
|
||||||
|
dout(0) << "ms_handle_connect on " << con->get_peer_addr() << dendl;
|
||||||
|
objecter->ms_handle_connect(con);
|
||||||
|
}
|
||||||
|
|
||||||
bool MDS::ms_handle_reset(Connection *con)
|
bool MDS::ms_handle_reset(Connection *con)
|
||||||
{
|
{
|
||||||
Mutex::Locker l(mds_lock);
|
Mutex::Locker l(mds_lock);
|
||||||
|
@ -361,6 +361,7 @@ class MDS : public Dispatcher {
|
|||||||
// messages
|
// messages
|
||||||
bool _dispatch(Message *m);
|
bool _dispatch(Message *m);
|
||||||
|
|
||||||
|
void ms_handle_connect(Connection *con);
|
||||||
bool ms_handle_reset(Connection *con);
|
bool ms_handle_reset(Connection *con);
|
||||||
void ms_handle_remote_reset(Connection *con);
|
void ms_handle_remote_reset(Connection *con);
|
||||||
|
|
||||||
|
@ -923,12 +923,18 @@ void Objecter::_sg_read_finish(vector<ObjectExtent>& extents, vector<bufferlist>
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Objecter::ms_handle_reset(Connection *con)
|
void Objecter::ms_handle_connect(Connection *con)
|
||||||
{
|
{
|
||||||
if (con->get_peer_type() == CEPH_ENTITY_TYPE_MON)
|
if (con->get_peer_type() == CEPH_ENTITY_TYPE_MON)
|
||||||
resend_mon_ops();
|
resend_mon_ops();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Objecter::ms_handle_reset(Connection *con)
|
||||||
|
{
|
||||||
|
if (con->get_peer_type() == CEPH_ENTITY_TYPE_OSD)
|
||||||
|
maybe_request_map();
|
||||||
|
}
|
||||||
|
|
||||||
void Objecter::ms_handle_remote_reset(Connection *con)
|
void Objecter::ms_handle_remote_reset(Connection *con)
|
||||||
{
|
{
|
||||||
if (con->get_peer_type() == CEPH_ENTITY_TYPE_OSD)
|
if (con->get_peer_type() == CEPH_ENTITY_TYPE_OSD)
|
||||||
|
@ -701,6 +701,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ms_handle_connect(Connection *con);
|
||||||
void ms_handle_reset(Connection *con);
|
void ms_handle_reset(Connection *con);
|
||||||
void ms_handle_remote_reset(Connection *con);
|
void ms_handle_remote_reset(Connection *con);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user