1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

STATISTICS: add total counts for number of delegations and number of revokes

Everytime we give a delegation to another node we count this as one delegation.
If the same record is delegated to several nodes we count one for each node.

Everytime a record has all its delegations revoked we count this as one revoke.

(This used to be ctdb commit b098bcf8007be63889aaed640a951b0eeaa9d191)
This commit is contained in:
Ronnie Sahlberg 2012-02-08 13:42:30 +11:00
parent 770bba6718
commit 1eafa68f0f
4 changed files with 7 additions and 0 deletions

View File

@ -646,6 +646,8 @@ struct ctdb_statistics {
uint32_t num_recoveries;
struct timeval statistics_start_time;
struct timeval statistics_current_time;
uint32_t total_ro_delegations;
uint32_t total_ro_revokes;
};
/*

View File

@ -513,6 +513,7 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
if (header.flags & CTDB_REC_RO_REVOKE_COMPLETE) {
header.flags &= ~(CTDB_REC_RO_HAVE_DELEGATIONS|CTDB_REC_RO_HAVE_READONLY|CTDB_REC_RO_REVOKING_READONLY|CTDB_REC_RO_REVOKE_COMPLETE);
CTDB_INCREMENT_STAT(ctdb, total_ro_revokes);
if (ctdb_ltdb_store(ctdb_db, call->key, &header, data) != 0) {
ctdb_fatal(ctdb, "Failed to write header with cleared REVOKE flag");
}
@ -619,6 +620,7 @@ void ctdb_request_call(struct ctdb_context *ctdb, struct ctdb_req_header *hdr)
}
ctdb_queue_packet(ctdb, &r->hdr);
CTDB_INCREMENT_STAT(ctdb, total_ro_delegations);
talloc_free(r);
return;

View File

@ -690,6 +690,7 @@ static void daemon_request_call_from_client(struct ctdb_client *client,
if (header.flags & CTDB_REC_RO_REVOKE_COMPLETE) {
header.flags &= ~(CTDB_REC_RO_HAVE_DELEGATIONS|CTDB_REC_RO_HAVE_READONLY|CTDB_REC_RO_REVOKING_READONLY|CTDB_REC_RO_REVOKE_COMPLETE);
CTDB_INCREMENT_STAT(ctdb, total_ro_revokes);
if (ctdb_ltdb_store(ctdb_db, key, &header, data) != 0) {
ctdb_fatal(ctdb, "Failed to write header with cleared REVOKE flag");
}

View File

@ -343,6 +343,8 @@ static void show_statistics(struct ctdb_statistics *s, int show_header)
STATISTICS_FIELD(pending_childwrite_calls),
STATISTICS_FIELD(memory_used),
STATISTICS_FIELD(max_hop_count),
STATISTICS_FIELD(total_ro_delegations),
STATISTICS_FIELD(total_ro_revokes),
};
tmp = s->statistics_current_time.tv_sec - s->statistics_start_time.tv_sec;
seconds = tmp%60;