]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
AsyncMessenger: remove reap time wake since it's not safe 7158/head
authorHaomai Wang <haomai@xsky.com>
Wed, 13 Jan 2016 15:50:39 +0000 (23:50 +0800)
committerHaomai Wang <haomai@xsky.com>
Wed, 13 Jan 2016 15:55:05 +0000 (23:55 +0800)
Signed-off-by: Haomai Wang <haomai@xsky.com>
src/msg/async/AsyncMessenger.cc
src/msg/async/AsyncMessenger.h
src/msg/async/Event.cc

index 489aa3b409caef2d53014c5ac7d74bbd10f24d00..31158a4d27c8b28544f4061617073785a7056cb3 100644 (file)
@@ -378,7 +378,7 @@ AsyncMessenger::AsyncMessenger(CephContext *cct, entity_name_t name,
     processor(this, cct, _nonce),
     lock("AsyncMessenger::lock"),
     nonce(_nonce), need_addr(true), listen_sd(-1), did_bind(false),
-    global_seq(0), deleted_lock("AsyncMessenger::deleted_lock"), reap_time_fd(0),
+    global_seq(0), deleted_lock("AsyncMessenger::deleted_lock"),
     cluster_protocol(0), stopped(true)
 {
   ceph_spin_init(&global_seq_lock);
@@ -396,8 +396,6 @@ AsyncMessenger::AsyncMessenger(CephContext *cct, entity_name_t name,
  */
 AsyncMessenger::~AsyncMessenger()
 {
-  if (reap_time_fd)
-    local_worker->center.delete_time_event(reap_time_fd);
   delete reap_handler;
   assert(!did_bind); // either we didn't bind or we shut down the Processor
   local_connection->mark_down();
@@ -741,7 +739,7 @@ void AsyncMessenger::learned_addr(const entity_addr_t &peer_addr_for_me)
   lock.Unlock();
 }
 
-int AsyncMessenger::reap_dead(bool is_timer)
+int AsyncMessenger::reap_dead()
 {
   int num = 0;
 
@@ -760,8 +758,5 @@ int AsyncMessenger::reap_dead(bool is_timer)
     ++num;
   }
 
-  if (is_timer)
-    reap_time_fd = 0;
-
   return num;
 }
index 812d2ee478fe59407ef691873d67a929484ee3b9..5206a81f77678e7a148721e76075d24719a38f80 100644 (file)
@@ -321,8 +321,7 @@ private:
   int _send_message(Message *m, const entity_inst_t& dest);
 
  private:
-  static const uint64_t ReapDeadConnectionThreshold = 10;
-  static const uint64_t ReapDeadConnectionMaxPeriod = 30*1000*1000;
+  static const uint64_t ReapDeadConnectionThreshold = 5;
 
   WorkerPool *pool;
 
@@ -336,7 +335,7 @@ private:
     C_handle_reap(AsyncMessenger *m): msgr(m) {}
     void do_request(int id) {
       // judge whether is a time event
-      msgr->reap_dead(id ? id : 0);
+      msgr->reap_dead();
     }
   };
   // the worker run messenger's cron jobs
@@ -398,7 +397,6 @@ private:
   set<AsyncConnectionRef> deleted_conns;
 
   EventCallbackRef reap_handler;
-  uint64_t reap_time_fd;
 
   /// internal cluster protocol version, if any, for talking to entities of the same type.
   int cluster_protocol;
@@ -530,9 +528,6 @@ public:
 
     if (deleted_conns.size() >= ReapDeadConnectionThreshold) {
       local_worker->center.dispatch_event_external(reap_handler);
-    } else if (!reap_time_fd) {
-      reap_time_fd = local_worker->center.create_time_event(
-          ReapDeadConnectionMaxPeriod, reap_handler);
     }
   }
 
@@ -543,7 +538,7 @@ public:
    *
    * See "deleted_conns"
    */
-  int reap_dead(bool is_timer);
+  int reap_dead();
 
   /**
    * @} // AsyncMessenger Internals
index d51f66af1ceac673f247329296dffe7214f24646..04887b874d7bdf74aa2bffed5a022155d5f3ee87 100644 (file)
@@ -248,7 +248,6 @@ void EventCenter::delete_time_event(uint64_t id)
   if (id >= time_event_next_id)
     return ;
 
-
   for (map<utime_t, list<TimeEvent> >::iterator it = time_events.begin();
        it != time_events.end(); ++it) {
     for (list<TimeEvent>::iterator j = it->second.begin();