Commit a77a73fd authored by Rich Prohaska's avatar Rich Prohaska

#204 print compression status variables

parent b75eeb27
...@@ -1105,24 +1105,24 @@ static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) { ...@@ -1105,24 +1105,24 @@ static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) {
case CHARSTR: case CHARSTR:
snprintf(buf, bufsiz, "%s", mystat[row].value.str); snprintf(buf, bufsiz, "%s", mystat[row].value.str);
break; break;
case UNIXTIME: case UNIXTIME: {
{
time_t t = mystat[row].value.num; time_t t = mystat[row].value.num;
char tbuf[26]; char tbuf[26];
snprintf(buf, bufsiz, "%.24s", ctime_r(&t, tbuf)); snprintf(buf, bufsiz, "%.24s", ctime_r(&t, tbuf));
}
break; break;
case TOKUTIME: }
{ case TOKUTIME: {
double t = tokutime_to_seconds(mystat[row].value.num); double t = tokutime_to_seconds(mystat[row].value.num);
snprintf(buf, bufsiz, "%.6f", t); snprintf(buf, bufsiz, "%.6f", t);
}
break; break;
case PARCOUNT: }
{ case PARCOUNT: {
uint64_t v = read_partitioned_counter(mystat[row].value.parcount); uint64_t v = read_partitioned_counter(mystat[row].value.parcount);
snprintf(buf, bufsiz, "%" PRIu64, v); snprintf(buf, bufsiz, "%" PRIu64, v);
break;
} }
case DOUBLE:
snprintf(buf, bufsiz, "%.6f", mystat[row].value.dnum);
break; break;
default: default:
snprintf(buf, bufsiz, "UNKNOWN STATUS TYPE: %d", mystat[row].type); snprintf(buf, bufsiz, "UNKNOWN STATUS TYPE: %d", mystat[row].type);
...@@ -2216,42 +2216,39 @@ static int show_tokudb_vars(THD *thd, SHOW_VAR *var, char *buff) { ...@@ -2216,42 +2216,39 @@ static int show_tokudb_vars(THD *thd, SHOW_VAR *var, char *buff) {
status_var.type = SHOW_CHAR; status_var.type = SHOW_CHAR;
status_var.value = (char*)status_row.value.str; status_var.value = (char*)status_row.value.str;
break; break;
case UNIXTIME: case UNIXTIME: {
{
status_var.type = SHOW_CHAR; status_var.type = SHOW_CHAR;
time_t t = status_row.value.num; time_t t = status_row.value.num;
char tbuf[26]; char tbuf[26];
// Reuse the memory in status_row. (It belongs to us). // Reuse the memory in status_row. (It belongs to us).
snprintf(status_row.value.datebuf, sizeof(status_row.value.datebuf), "%.24s", ctime_r(&t, tbuf)); snprintf(status_row.value.datebuf, sizeof(status_row.value.datebuf), "%.24s", ctime_r(&t, tbuf));
status_var.value = (char*)&status_row.value.datebuf[0]; status_var.value = (char*)&status_row.value.datebuf[0];
}
break; break;
}
case TOKUTIME: case TOKUTIME:
{
status_var.type = SHOW_DOUBLE; status_var.type = SHOW_DOUBLE;
double t = tokutime_to_seconds(status_row.value.num);
// Reuse the memory in status_row. (It belongs to us). // Reuse the memory in status_row. (It belongs to us).
status_row.value.dnum = t; status_row.value.dnum = tokutime_to_seconds(status_row.value.num);
status_var.value = (char*)&status_row.value.dnum; status_var.value = (char*)&status_row.value.dnum;
}
break; break;
case PARCOUNT: case PARCOUNT: {
{
status_var.type = SHOW_LONGLONG; status_var.type = SHOW_LONGLONG;
uint64_t v = read_partitioned_counter(status_row.value.parcount); uint64_t v = read_partitioned_counter(status_row.value.parcount);
// Reuse the memory in status_row. (It belongs to us). // Reuse the memory in status_row. (It belongs to us).
status_row.value.num = v; status_row.value.num = v;
status_var.value = (char*)&status_row.value.num; status_var.value = (char*)&status_row.value.num;
break;
} }
case DOUBLE:
status_var.type = SHOW_DOUBLE;
status_var.value = (char*) &status_row.value.dnum;
break; break;
default: default:
{
status_var.type = SHOW_CHAR; status_var.type = SHOW_CHAR;
// Reuse the memory in status_row.datebuf. (It belongs to us). // Reuse the memory in status_row.datebuf. (It belongs to us).
// UNKNOWN TYPE: %d fits in 26 bytes (sizeof datebuf) for any integer. // UNKNOWN TYPE: %d fits in 26 bytes (sizeof datebuf) for any integer.
snprintf(status_row.value.datebuf, sizeof(status_row.value.datebuf), "UNKNOWN TYPE: %d", status_row.type); snprintf(status_row.value.datebuf, sizeof(status_row.value.datebuf), "UNKNOWN TYPE: %d", status_row.type);
status_var.value = (char*)&status_row.value.datebuf[0]; status_var.value = (char*)&status_row.value.datebuf[0];
}
break; 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