int lvl = (prio == CLOG_ERROR ? -1 : 0);
ldout(cct,lvl) << "log " << prio << " : " << s << dendl;
LogEntry e;
- // who will be set when we queue the entry on LogClient
- //e.who = messenger->get_myinst();
e.stamp = ceph_clock_now(cct);
- // seq will be set when we queue the entry on LogClient
- // e.seq = ++last_log;
+ // seq and who should be set for syslog/graylog/log_to_mon
+ e.who = parent->get_myinst();
+ e.seq = parent->get_next_seq();
e.prio = prio;
e.msg = s;
e.channel = get_log_channel();
version_t LogClient::queue(LogEntry &entry)
{
Mutex::Locker l(log_lock);
- entry.seq = ++last_log;
- entry.who = messenger->get_myinst();
log_queue.push_back(entry);
if (is_mon) {
return entry.seq;
}
+uint64_t LogClient::get_next_seq()
+{
+ return ++last_log;
+}
+
+const entity_inst_t& LogClient::get_myinst()
+{
+ return messenger->get_myinst();
+}
+
bool LogClient::handle_log_ack(MLogAck *m)
{
Mutex::Locker l(log_lock);
#include <iosfwd>
#include <sstream>
+#include <atomic>
class LogClient;
class MLog;
channels.clear();
}
+ uint64_t get_next_seq();
+ const entity_inst_t& get_myinst();
version_t queue(LogEntry &entry);
private:
bool is_mon;
Mutex log_lock;
version_t last_log_sent;
- version_t last_log;
+ std::atomic<uint64_t> last_log;
std::deque<LogEntry> log_queue;
std::map<std::string, LogChannelRef> channels;