Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{177710175}: Keeping track of qdb adds and deletes in statreqs #4940

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions db/comdb2.c
Original file line number Diff line number Diff line change
Expand Up @@ -4541,6 +4541,22 @@ static inline void log_tbl_item(int64_t curr, int64_t *prev, const char *(*type_
*prev = curr;
}

static inline void log_qdb_item(int64_t curr, int64_t *prev, const char *(*type_to_str)(int), int type, char *string,
int *hdr_p, struct reqlogger *statlogger, dbtable *tbl, int first)
{
int diff = curr - *prev;
if (diff > 0) {
if (*hdr_p == 0) {
const char hdr_fmt[] = "DIFF REQUEST STATS FOR QUEUE '%s'\n";
reqlog_logf(statlogger, REQL_INFO, hdr_fmt, tbl->tablename);
*hdr_p = 1;
}
reqlog_logf(statlogger, REQL_INFO, "%s%-22s %u\n", (first ? "" : " "),
(type_to_str ? type_to_str(type) : string), diff);
}
*prev = curr;
}

void *statthd(void *p)
{
struct dbenv *dbenv;
Expand Down Expand Up @@ -4860,6 +4876,13 @@ void *statthd(void *p)
log_tbl_item(tbl->deadlock_count, &tbl->saved_deadlock_count,
NULL, 0, "deadlock count", &hdr, statlogger, tbl, 0);
}

for (int i = 0; i < dbenv->num_qdbs; i++) {
dbtable *qdb = dbenv->qdbs[i];
int hdr = 0;
log_qdb_item(bdb_get_qdb_adds(qdb->handle), &qdb->prev_qdb_adds, NULL, 0, "adds", &hdr, statlogger, qdb, 0);
log_qdb_item(bdb_get_qdb_cons(qdb->handle), &qdb->prev_qdb_dels, NULL, 0, "dels", &hdr, statlogger, qdb, 0);
}
unlock_schema_lk();

pstats = bdb_get_process_stats();
Expand Down
2 changes: 2 additions & 0 deletions db/comdb2.h
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,8 @@ typedef struct dbtable {
int64_t prev_blocktypcnt[BLOCK_MAXOPCODE];
int64_t prev_blockosqltypcnt[MAX_OSQL_TYPES];
int64_t prev_nsql;
int64_t prev_qdb_adds;
int64_t prev_qdb_dels;
/* counters for writes to this table */
int64_t write_count[RECORD_WRITE_MAX];
int64_t saved_write_count[RECORD_WRITE_MAX];
Expand Down