From: Kefu Chai Date: Wed, 3 May 2017 09:04:34 +0000 (+0800) Subject: logclient: use the seq id of the 1st log entry when resetting session X-Git-Tag: v12.0.3~78^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=4da64aa5ab3a849c2838c49aa0deb4a540fed3e0;p=ceph-ci.git logclient: use the seq id of the 1st log entry when resetting session because do_log() does not update last_log (see LogClient::get_next_seq()) and log_queue atomically, and log_queue is updated *after* last_log, so we can not use them to figure out the number of log entries to be sent. so, we choose to trust log_queue in this change. Fixes: http://tracker.ceph.com/issues/19427 Signed-off-by: Kefu Chai --- diff --git a/src/common/LogClient.cc b/src/common/LogClient.cc index c0e4a7bf5ae..b99a8a2462c 100644 --- a/src/common/LogClient.cc +++ b/src/common/LogClient.cc @@ -268,8 +268,10 @@ Message *LogClient::get_mon_log_message(bool flush) { Mutex::Locker l(log_lock); if (flush) { + if (log_queue.empty()) + return nullptr; // reset session - last_log_sent = last_log - log_queue.size(); + last_log_sent = log_queue.front().seq; } return _get_mon_log_message(); }