mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
ctdb-daemon: Reset database statistics when resetting statistics
When the ctdb statistics is reset, reset per database statistics to keep it consistent with ctdb statistics. Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
parent
d9030d8c10
commit
7949ce103f
@ -1446,6 +1446,8 @@ int ctdb_fetch_func(struct ctdb_call_info *call);
|
||||
|
||||
int ctdb_fetch_with_header_func(struct ctdb_call_info *call);
|
||||
|
||||
void ctdb_db_statistics_reset(struct ctdb_db_context *ctdb_db);
|
||||
|
||||
int32_t ctdb_control_get_db_statistics(struct ctdb_context *ctdb,
|
||||
uint32_t db_id,
|
||||
TDB_DATA *outdata);
|
||||
|
@ -151,8 +151,15 @@ static int32_t ctdb_control_dispatch(struct ctdb_context *ctdb,
|
||||
}
|
||||
|
||||
case CTDB_CONTROL_STATISTICS_RESET: {
|
||||
struct ctdb_db_context *ctdb_db;
|
||||
|
||||
CHECK_CONTROL_DATA_SIZE(0);
|
||||
ZERO_STRUCT(ctdb->statistics);
|
||||
for (ctdb_db = ctdb->db_list;
|
||||
ctdb_db != NULL;
|
||||
ctdb_db = ctdb_db->next) {
|
||||
ctdb_db_statistics_reset(ctdb_db);
|
||||
}
|
||||
ctdb->statistics.statistics_start_time = timeval_current();
|
||||
return 0;
|
||||
}
|
||||
|
@ -1600,6 +1600,20 @@ int ctdb_set_db_sticky(struct ctdb_context *ctdb, struct ctdb_db_context *ctdb_d
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ctdb_db_statistics_reset(struct ctdb_db_context *ctdb_db)
|
||||
{
|
||||
struct ctdb_db_statistics *s = &ctdb_db->statistics;
|
||||
int i;
|
||||
|
||||
for (i=0; i<MAX_HOT_KEYS; i++) {
|
||||
if (s->hot_keys[i].key.dsize > 0) {
|
||||
talloc_free(s->hot_keys[i].key.dptr);
|
||||
}
|
||||
}
|
||||
|
||||
ZERO_STRUCT(ctdb_db->statistics);
|
||||
}
|
||||
|
||||
int32_t ctdb_control_get_db_statistics(struct ctdb_context *ctdb,
|
||||
uint32_t db_id,
|
||||
TDB_DATA *outdata)
|
||||
|
Loading…
Reference in New Issue
Block a user