*
*/
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <pthread.h>
#include <signal.h>
#include "HeartbeatMap.h"
#include "ceph_context.h"
#include "common/errno.h"
-#include "common/valgrind.h"
-
#include "debug.h"
+
#define dout_subsys ceph_subsys_heartbeatmap
#undef dout_prefix
#define dout_prefix *_dout << "heartbeat_map "
bool healthy = true;
time_t was;
- was = h->timeout.read();
+ was = h->timeout;
if (was && was < now) {
ldout(m_cct, 1) << who << " '" << h->name << "'"
<< " had timed out after " << h->grace << dendl;
healthy = false;
}
- was = h->suicide_timeout.read();
+ was = h->suicide_timeout;
if (was && was < now) {
ldout(m_cct, 1) << who << " '" << h->name << "'"
<< " had suicide timed out after " << h->suicide_grace << dendl;
time_t now = time(NULL);
_check(h, "reset_timeout", now);
- h->timeout.set(now + grace);
+ h->timeout = now + grace;
h->grace = grace;
if (suicide_grace)
- h->suicide_timeout.set(now + suicide_grace);
+ h->suicide_timeout = now + suicide_grace;
else
- h->suicide_timeout.set(0);
+ h->suicide_timeout = 0;
h->suicide_grace = suicide_grace;
}
ldout(m_cct, 20) << "clear_timeout '" << h->name << "'" << dendl;
time_t now = time(NULL);
_check(h, "clear_timeout", now);
- h->timeout.set(0);
- h->suicide_timeout.set(0);
+ h->timeout = 0;
+ h->suicide_timeout = 0;
}
bool HeartbeatMap::is_healthy()
}
m_rwlock.put_read();
- m_unhealthy_workers.set(unhealthy);
- m_total_workers.set(total);
+ m_unhealthy_workers = unhealthy;
+ m_total_workers = total;
ldout(m_cct, 20) << "is_healthy = " << (healthy ? "healthy" : "NOT HEALTHY")
<< ", total workers: " << total << ", number of unhealthy: " << unhealthy << dendl;
int HeartbeatMap::get_unhealthy_workers() const
{
- return m_unhealthy_workers.read();
+ return m_unhealthy_workers;
}
int HeartbeatMap::get_total_workers() const
{
- return m_total_workers.read();
+ return m_total_workers;
}
void HeartbeatMap::check_touch_file()