From 4da64aa5ab3a849c2838c49aa0deb4a540fed3e0 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Wed, 3 May 2017 17:04:34 +0800 Subject: [PATCH] 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 --- src/common/LogClient.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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(); } -- 2.39.5