*/
#include "includes.h"
-#include "lib/events/events.h"
+#include "lib/tevent/tevent.h"
#include "lib/tdb/include/tdb.h"
#include "system/network.h"
#include "system/filesys.h"
return p;
}
-
-/*
- update a max latency number
- */
-void ctdb_latency(struct ctdb_db_context *ctdb_db, const char *name, double *latency, struct timeval t)
-{
- double l = timeval_elapsed(&t);
- if (l > *latency) {
- *latency = l;
- }
-
- if (ctdb_db->ctdb->tunable.log_latency_ms !=0) {
- if (l*1000 > ctdb_db->ctdb->tunable.log_latency_ms) {
- DEBUG(DEBUG_WARNING, ("High latency %.6fs for operation %s on database %s\n", l, name, ctdb_db->db_name));
- }
- }
-}
-
-/*
- update a reclock latency number
- */
-void ctdb_reclock_latency(struct ctdb_context *ctdb, const char *name, double *latency, double l)
-{
- if (l > *latency) {
- *latency = l;
- }
-
- if (ctdb->tunable.reclock_latency_ms !=0) {
- if (l*1000 > ctdb->tunable.reclock_latency_ms) {
- DEBUG(DEBUG_ERR, ("High RECLOCK latency %fs for operation %s\n", l, name));
- }
- }
-}
-
uint32_t ctdb_reqid_new(struct ctdb_context *ctdb, void *state)
{
- uint32_t id;
-
- id = ctdb->idr_cnt++ & 0xFFFF;
- id |= (idr_get_new(ctdb->idr, state, 0xFFFF)<<16);
+ int id = idr_get_new_above(ctdb->idr, state, ctdb->lastid+1, INT_MAX);
+ if (id < 0) {
+ DEBUG(DEBUG_NOTICE, ("Reqid wrap!\n"));
+ id = idr_get_new(ctdb->idr, state, INT_MAX);
+ }
+ ctdb->lastid = id;
return id;
}
{
void *p;
- p = _idr_find_type(ctdb->idr, (reqid>>16)&0xFFFF, type, location);
+ p = _idr_find_type(ctdb->idr, reqid, type, location);
if (p == NULL) {
DEBUG(DEBUG_WARNING, ("Could not find idr:%u\n",reqid));
}
{
int ret;
- ret = idr_remove(ctdb->idr, (reqid>>16)&0xFFFF);
+ ret = idr_remove(ctdb->idr, reqid);
if (ret != 0) {
DEBUG(DEBUG_ERR, ("Removing idr that does not exist\n"));
}
"status",
"shutdown",
"reload",
- "updateip"
+ "updateip",
+ "ipreallocated"
};