Commit d85a33e9 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:2027], add explanation text

git-svn-id: file:///svn/mysql/tokudb-engine/src@14816 c7de825b-a66e-492c-adef-691d508d4ae1
parent c9062915
......@@ -732,14 +732,6 @@ static bool tokudb_show_logs(THD * thd, stat_print_fn * stat_print) {
TOKUDB_DBUG_RETURN(error);
}
static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) {
TOKUDB_DBUG_ENTER("tokudb_show_engine_status");
int error;
char buf[1024] = {'\0'};
ENGINE_STATUS engstat;
#define STATPRINT(legend, val) stat_print(thd, \
tokudb_hton_name, \
tokudb_hton_name_length, \
......@@ -748,6 +740,14 @@ static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) {
val, \
strlen(val))
static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) {
TOKUDB_DBUG_ENTER("tokudb_show_engine_status");
int error;
char buf[1024] = {'\0'};
ENGINE_STATUS engstat;
error = db_env->get_engine_status(db_env, &engstat);
if (error == 0) {
const char * lockstat = (engstat.ydb_lock_ctr & 0x01) ? "Locked" : "Unlocked";
......@@ -816,7 +816,7 @@ static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) {
}
int tokudb_checkpoint_lock(THD * thd) {
int tokudb_checkpoint_lock(THD * thd, stat_print_fn * stat_print) {
int error;
tokudb_trx_data* trx = NULL;
trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot);
......@@ -831,6 +831,7 @@ int tokudb_checkpoint_lock(THD * thd) {
}
if (trx->checkpoint_lock_taken) {
STATPRINT("checkpoint lock", "Lock already taken");
error = 0;
goto cleanup;
}
......@@ -838,6 +839,7 @@ int tokudb_checkpoint_lock(THD * thd) {
if (error) { goto cleanup; }
trx->checkpoint_lock_taken = true;
STATPRINT("checkpoint lock", "Lock successfully taken");
error = 0;
cleanup:
......@@ -845,16 +847,18 @@ int tokudb_checkpoint_lock(THD * thd) {
return error;
}
int tokudb_checkpoint_unlock(THD * thd) {
int tokudb_checkpoint_unlock(THD * thd, stat_print_fn * stat_print) {
int error;
tokudb_trx_data* trx = NULL;
trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot);
if (!trx) {
error = 0;
STATPRINT("checkpoint unlock", "Lock never taken");
goto cleanup;
}
if (!trx->checkpoint_lock_taken) {
error = 0;
STATPRINT("checkpoint unlock", "Lock never taken");
goto cleanup;
}
//
......@@ -864,6 +868,7 @@ int tokudb_checkpoint_unlock(THD * thd) {
if (error) {goto cleanup;}
trx->checkpoint_lock_taken = false;
STATPRINT("checkpoint unlock", "Successfully unlocked");
cleanup:
if (error) { my_errno = error; }
......@@ -885,10 +890,10 @@ bool tokudb_show_status(handlerton * hton, THD * thd, stat_print_fn * stat_print
return tokudb_show_engine_status(thd, stat_print);
break;
case HA_ENGINE_CHECKPOINT_LOCK:
return tokudb_checkpoint_lock(thd);
return tokudb_checkpoint_lock(thd, stat_print);
break;
case HA_ENGINE_CHECKPOINT_UNLOCK:
return tokudb_checkpoint_unlock(thd);
return tokudb_checkpoint_unlock(thd, stat_print);
break;
default:
break;
......
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