mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
for debugging
add a global variable holding the pid of the main daemon. change the tracking of time() in the event loop to only check/warn when called from the main daemon (This used to be ctdb commit a10fc51f4c30e85ada6d4b7347b0f9a8ebc76637)
This commit is contained in:
parent
3d713d9e53
commit
4d40b86805
@ -30,6 +30,8 @@
|
||||
#include "../include/ctdb_private.h"
|
||||
#include "lib/util/dlinklist.h"
|
||||
|
||||
pid_t ctdbd_pid;
|
||||
|
||||
/*
|
||||
allocate a packet for use in client<->daemon communication
|
||||
*/
|
||||
|
@ -53,6 +53,11 @@ struct takeover_run_reply {
|
||||
uint64_t srvid;
|
||||
};
|
||||
|
||||
/*
|
||||
* pid of the ctdbd daemon
|
||||
*/
|
||||
extern pid_t ctdbd_pid;
|
||||
|
||||
/*
|
||||
a tcp connection description
|
||||
*/
|
||||
|
@ -29,6 +29,8 @@
|
||||
#include "lib/events/events_internal.h"
|
||||
#include <sys/epoll.h>
|
||||
|
||||
extern pid_t ctdbd_pid;
|
||||
|
||||
struct epoll_event_context {
|
||||
/* a pointer back to the generic event_context */
|
||||
struct event_context *ev;
|
||||
@ -466,17 +468,19 @@ static int epoll_event_loop_wait(struct event_context *ev)
|
||||
if (epoll_event_loop_once(ev) != 0) {
|
||||
break;
|
||||
}
|
||||
new_t=time(NULL);
|
||||
if (t != 0) {
|
||||
if (t > new_t) {
|
||||
DEBUG(0,("ERROR Time skipped backward by %d seconds\n", (int)(t-new_t)));
|
||||
}
|
||||
/* We assume here that we get at least one event every 5 seconds */
|
||||
if (new_t > (t+5)) {
|
||||
DEBUG(0,("ERROR Time jumped forward by %d seconds\n", (int)(new_t-t)));
|
||||
if (getpid() == ctdbd_pid) {
|
||||
new_t=time(NULL);
|
||||
if (t != 0) {
|
||||
if (t > new_t) {
|
||||
DEBUG(0,("ERROR Time skipped backward by %d seconds\n", (int)(t-new_t)));
|
||||
}
|
||||
/* We assume here that we get at least one event every 5 seconds */
|
||||
if (new_t > (t+5)) {
|
||||
DEBUG(0,("ERROR Time jumped forward by %d seconds\n", (int)(new_t-t)));
|
||||
}
|
||||
}
|
||||
t=new_t;
|
||||
}
|
||||
t=new_t;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "lib/events/events.h"
|
||||
#include "lib/events/events_internal.h"
|
||||
|
||||
extern pid_t ctdbd_pid;
|
||||
|
||||
struct select_event_context {
|
||||
/* a pointer back to the generic event_context */
|
||||
struct event_context *ev;
|
||||
@ -281,17 +283,19 @@ static int select_event_loop_wait(struct event_context *ev)
|
||||
if (select_event_loop_once(ev) != 0) {
|
||||
break;
|
||||
}
|
||||
new_t=time(NULL);
|
||||
if (t != 0) {
|
||||
if (t > new_t) {
|
||||
DEBUG(0,("ERROR Time skipped backward by %d seconds\n", (int)(t-new_t)));
|
||||
}
|
||||
/* We assume here that we get at least one event every 5 seconds */
|
||||
if (new_t > (t+5)) {
|
||||
DEBUG(0,("ERROR Time jumped forward by %d seconds\n", (int)(new_t-t)));
|
||||
if (getpid() == ctdbd_pid) {
|
||||
new_t=time(NULL);
|
||||
if (t != 0) {
|
||||
if (t > new_t) {
|
||||
DEBUG(0,("ERROR Time skipped backward by %d seconds\n", (int)(t-new_t)));
|
||||
}
|
||||
/* We assume here that we get at least one event every 5 seconds */
|
||||
if (new_t > (t+5)) {
|
||||
DEBUG(0,("ERROR Time jumped forward by %d seconds\n", (int)(new_t-t)));
|
||||
}
|
||||
}
|
||||
t=new_t;
|
||||
}
|
||||
t=new_t;
|
||||
}
|
||||
|
||||
return select_ev->exit_code;
|
||||
|
@ -36,6 +36,8 @@
|
||||
#include "lib/events/events.h"
|
||||
#include "lib/events/events_internal.h"
|
||||
|
||||
extern pid_t ctdbd_pid;
|
||||
|
||||
struct std_event_context {
|
||||
/* a pointer back to the generic event_context */
|
||||
struct event_context *ev;
|
||||
@ -582,17 +584,19 @@ static int std_event_loop_wait(struct event_context *ev)
|
||||
if (std_event_loop_once(ev) != 0) {
|
||||
break;
|
||||
}
|
||||
new_t=time(NULL);
|
||||
if (t != 0) {
|
||||
if (t > new_t) {
|
||||
DEBUG(0,("ERROR Time skipped backward by %d seconds\n", (int)(t-new_t)));
|
||||
}
|
||||
/* We assume here that we get at least one event every 5 seconds */
|
||||
if (new_t > (t+5)) {
|
||||
DEBUG(0,("ERROR Time jumped forward by %d seconds\n", (int)(new_t-t)));
|
||||
if (getpid() == ctdbd_pid) {
|
||||
new_t=time(NULL);
|
||||
if (t != 0) {
|
||||
if (t > new_t) {
|
||||
DEBUG(0,("ERROR Time skipped backward by %d seconds\n", (int)(t-new_t)));
|
||||
}
|
||||
/* We assume here that we get at least one event every 5 seconds */
|
||||
if (new_t > (t+5)) {
|
||||
DEBUG(0,("ERROR Time jumped forward by %d seconds\n", (int)(new_t-t)));
|
||||
}
|
||||
}
|
||||
t=new_t;
|
||||
}
|
||||
t=new_t;
|
||||
}
|
||||
|
||||
return std_ev->exit_code;
|
||||
|
@ -36,7 +36,6 @@ static void print_exit_message(void)
|
||||
DEBUG(DEBUG_NOTICE,("CTDB daemon shutting down\n"));
|
||||
}
|
||||
|
||||
|
||||
/* called when the "startup" event script has finished */
|
||||
static void ctdb_start_transport(struct ctdb_context *ctdb)
|
||||
{
|
||||
@ -690,6 +689,9 @@ int ctdb_start_daemon(struct ctdb_context *ctdb, bool do_fork)
|
||||
}
|
||||
block_signal(SIGPIPE);
|
||||
|
||||
ctdbd_pid = getpid();
|
||||
DEBUG(DEBUG_ERR, ("Starting CTDBD as pid : %u\n", ctdbd_pid));
|
||||
|
||||
if (ctdb->do_setsched) {
|
||||
/* try to set us up as realtime */
|
||||
ctdb_set_scheduler(ctdb);
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "../common/rb_tree.h"
|
||||
#include "db_wrap.h"
|
||||
|
||||
|
||||
#define ERR_TIMEOUT 20 /* timed out trying to reach node */
|
||||
#define ERR_NONODE 21 /* node does not exist */
|
||||
#define ERR_DISNODE 22 /* node is disconnected */
|
||||
|
Loading…
Reference in New Issue
Block a user