Commit fcea8785 authored by Barry Perlman's avatar Barry Perlman Committed by Yoni Fogel

Addresses #1792 refs[t:1792] Added more content to show engine status

git-svn-id: file:///svn/mysql/tokudb-engine/src@14730 c7de825b-a66e-492c-adef-691d508d4ae1
parent 36ec86c9
/* -*- mode: C; c-basic-offset: 4 -*- */
#define MYSQL_SERVER 1 #define MYSQL_SERVER 1
#include "mysql_priv.h" #include "mysql_priv.h"
...@@ -725,50 +726,51 @@ static bool tokudb_show_logs(THD * thd, stat_print_fn * stat_print) { ...@@ -725,50 +726,51 @@ static bool tokudb_show_logs(THD * thd, stat_print_fn * stat_print) {
static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) { static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) {
TOKUDB_DBUG_ENTER("tokudb_show_engine_status"); TOKUDB_DBUG_ENTER("tokudb_show_engine_status");
int error; int error;
char * legend_ydb_lock = "ydb lock held"; char buf[4096] = {'\0'};
char * legend_cp_period = "Checkpoint period";
char * legend_cp_status = "Checkpoint status code (0 = idle)";
char buf[4096] = {0};
ENGINE_STATUS engstat; ENGINE_STATUS engstat;
#define STATPRINT(legend, val) stat_print(thd, \
tokudb_hton_name, \
tokudb_hton_name_length, \
legend, \
strlen(legend), \
val, \
strlen(val))
error = db_env->get_engine_status(db_env, &engstat); error = db_env->get_engine_status(db_env, &engstat);
if (error == 0) { if (error == 0) {
const char * lockstat = (engstat.ydb_lock_ctr & 0x01) ? "Locked" : "Unlocked";
const char * lockstat = engstat.ydb_lock_held ? "Locked" : "Unlocked"; u_int32_t lockctr = engstat.ydb_lock_ctr >> 1; // lsb indicates if locked
stat_print( sprintf(buf, "%" PRIu32, lockctr);
thd, STATPRINT("ydb lock held", lockstat);
tokudb_hton_name, STATPRINT("ydb lock counter", buf);
tokudb_hton_name_length,
legend_ydb_lock, lockstat = (engstat.cachetable_lock_ctr & 0x01) ? "Locked" : "Unlocked";
strlen(legend_ydb_lock), lockctr = engstat.cachetable_lock_ctr >> 1; // lsb indicates if locked
lockstat, sprintf(buf, "%" PRIu32, lockctr);
strlen(lockstat) STATPRINT("cachetable lock held", lockstat);
); STATPRINT("cachetable lock counter", buf);
sprintf(buf, "%" PRIu64, engstat.cachetable_hit);
STATPRINT("cachetable hit", buf);
sprintf(buf, "%" PRIu32, (unsigned int) engstat.checkpoint_period); sprintf(buf, "%" PRIu64, engstat.cachetable_miss);
stat_print( STATPRINT("cachetable miss", buf);
thd, sprintf(buf, "%" PRIu64, engstat.cachetable_wait_reading);
tokudb_hton_name, STATPRINT("cachetable wait reading", buf);
tokudb_hton_name_length, sprintf(buf, "%" PRIu64, engstat.cachetable_wait_writing);
legend_cp_period, STATPRINT("cachetable wait writing", buf);
strlen(legend_cp_period), sprintf(buf, "%" PRIu64, engstat.cachetable_size_current);
buf, STATPRINT("cachetable size_current", buf);
strlen(buf) sprintf(buf, "%" PRIu64, engstat.cachetable_size_limit);
); STATPRINT("cachetable size_limit", buf);
sprintf(buf, "%" PRIu64, engstat.cachetable_size_writing);
sprintf(buf, "%" PRIu64, (long unsigned int) engstat.checkpoint_footprint); STATPRINT("cachetable size_writing", buf);
stat_print(
thd, sprintf(buf, "%" PRIu32, engstat.checkpoint_period);
tokudb_hton_name, STATPRINT("Checkpoint period", buf);
tokudb_hton_name_length, sprintf(buf, "%" PRIu32, engstat.checkpoint_footprint);
legend_cp_status, STATPRINT("Checkpoint status code (0 = idle)", buf);
strlen(legend_cp_status),
buf,
strlen(buf)
);
} }
TOKUDB_DBUG_RETURN(error); TOKUDB_DBUG_RETURN(error);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment