Commit 4e2e9253 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/toku/tokudb@14732 c7de825b-a66e-492c-adef-691d508d4ae1
parent 4e0b6b79
......@@ -18,16 +18,16 @@
#include <sys/types.h>
static toku_pthread_mutex_t ydb_big_lock = TOKU_PTHREAD_MUTEX_INITIALIZER;
static int ydb_lock_held = 0; // useful for debug at a live installation (int easier to pass to handlerton than BOOL)
static u_int32_t ydb_lock_ctr = 0; // useful for debug at a live installation
int
toku_ydb_lock_held(void) {
return ydb_lock_held;
toku_ydb_lock_ctr(void) {
return ydb_lock_ctr;
}
int
toku_ydb_lock_init(void) {
ydb_lock_held = 0;
ydb_lock_ctr = 0;
int r = toku_pthread_mutex_init(&ydb_big_lock, NULL); assert(r == 0);
return r;
}
......@@ -40,11 +40,11 @@ toku_ydb_lock_destroy(void) {
void toku_ydb_lock(void) {
int r = toku_pthread_mutex_lock(&ydb_big_lock); assert(r == 0);
ydb_lock_held = 1;
ydb_lock_ctr++;
}
void toku_ydb_unlock(void) {
ydb_lock_ctr++;
int r = toku_pthread_mutex_unlock(&ydb_big_lock); assert(r == 0);
ydb_lock_held = 0;
}
......@@ -69,7 +69,7 @@ int toku_ydb_lock_init(void);
int toku_ydb_lock_destroy(void);
void toku_ydb_lock(void);
void toku_ydb_unlock(void);
int toku_ydb_lock_held(void);
int toku_ydb_lock_ctr(void);
/* *********************************************************
......
......@@ -958,9 +958,21 @@ env_get_engine_status(DB_ENV * env, ENGINE_STATUS * engstat) {
int r = 0;
if (!env_opened(env)) r = EINVAL;
else {
engstat->ydb_lock_held = toku_ydb_lock_held(); // is ydb lock held?
env_checkpointing_get_period(env, &(engstat->checkpoint_period)); // do not take ydb lock
engstat->ydb_lock_ctr = toku_ydb_lock_ctr(); // is ydb lock held? how many times?
env_checkpointing_get_period(env, &(engstat->checkpoint_period)); // do not take ydb lock (take minicron lock, but that's a very ephemeral low-level lock)
engstat->checkpoint_footprint = toku_checkpoint_get_footprint();
{
CACHETABLE_STATUS_S ctstat;
toku_cachetable_get_status(env->i->cachetable, &ctstat);
engstat->cachetable_lock_ctr = ctstat.lock_ctr;
engstat->cachetable_hit = ctstat.hit;
engstat->cachetable_miss = ctstat.miss;
engstat->cachetable_wait_reading = ctstat.wait_reading;
engstat->cachetable_wait_writing = ctstat.wait_writing;
engstat->cachetable_size_current = ctstat.size_current;
engstat->cachetable_size_limit = ctstat.size_limit;
engstat->cachetable_size_writing = ctstat.size_writing;
}
}
return r;
}
......
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