Commit c33f2ba0 authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

[t:4002] merging handlerton changes for HOT

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@38550 c7de825b-a66e-492c-adef-691d508d4ae1
parent 118501a0
...@@ -342,6 +342,22 @@ int poll_fun(void *extra, float progress) { ...@@ -342,6 +342,22 @@ int poll_fun(void *extra, float progress) {
return 0; return 0;
} }
struct hot_poll_fun_extra {
uint current_table;
uint num_tables;
};
int hot_poll_fun(void *extra, float progress) {
HOT_OPTIMIZE_CONTEXT context = (HOT_OPTIMIZE_CONTEXT)extra;
if (context->thd->killed) {
sprintf(context->write_status_msg, "The process has been killed, aborting hot optimize.");
return ER_ABORTING_CONNECTION;
}
sprintf(context->write_status_msg, "Optimization of index %u of %u about %.lf%% done", context->current_table, context->num_tables, progress*100);
thd_proc_info(context->thd, context->write_status_msg);
return 0;
}
void loader_ai_err_fun(DB *db, int i, int err, DBT *key, DBT *val, void *error_extra) { void loader_ai_err_fun(DB *db, int i, int err, DBT *key, DBT *val, void *error_extra) {
LOADER_CONTEXT context = (LOADER_CONTEXT)error_extra; LOADER_CONTEXT context = (LOADER_CONTEXT)error_extra;
...@@ -7689,12 +7705,16 @@ int ha_tokudb::optimize(THD * thd, HA_CHECK_OPT * check_opt) { ...@@ -7689,12 +7705,16 @@ int ha_tokudb::optimize(THD * thd, HA_CHECK_OPT * check_opt) {
if (error) { if (error) {
goto cleanup; goto cleanup;
} }
/* struct hot_optimize_context hc;
error = db->hot_optimize(db); memset(&hc, 0, sizeof hc);
hc.thd = thd;
hc.ha = this;
hc.current_table = i;
hc.num_tables = curr_num_DBs;
error = db->hot_optimize(db, hot_poll_fun, &hc);
if (error) { if (error) {
goto cleanup; goto cleanup;
} }
*/
} }
error = 0; error = 0;
......
...@@ -22,6 +22,14 @@ typedef struct loader_context { ...@@ -22,6 +22,14 @@ typedef struct loader_context {
ha_tokudb* ha; ha_tokudb* ha;
} *LOADER_CONTEXT; } *LOADER_CONTEXT;
typedef struct hot_optimize_context {
THD *thd;
char write_status_msg[200];
ha_tokudb *ha;
uint current_table;
uint num_tables;
} *HOT_OPTIMIZE_CONTEXT;
// //
// This object stores table information that is to be shared // This object stores table information that is to be shared
// among all ha_tokudb objects. // among all ha_tokudb objects.
......
...@@ -1293,7 +1293,7 @@ static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) { ...@@ -1293,7 +1293,7 @@ static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) {
SHOWVAL(cleaner_max_buffer_workdone); SHOWVAL(cleaner_max_buffer_workdone);
SHOWVAL(cleaner_min_buffer_workdone); SHOWVAL(cleaner_min_buffer_workdone);
SHOWVAL(cleaner_total_buffer_workdone); SHOWVAL(cleaner_total_buffer_workdone);
SHOWVAL(cleaner_num_leaves_unmerged); SHOWVAL(cleaner_num_dirtied_for_leaf_merge);
SHOWVAL(flush_total); SHOWVAL(flush_total);
SHOWVAL(flush_in_memory); SHOWVAL(flush_in_memory);
SHOWVAL(flush_needed_io); SHOWVAL(flush_needed_io);
...@@ -1319,6 +1319,10 @@ static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) { ...@@ -1319,6 +1319,10 @@ static bool tokudb_show_engine_status(THD * thd, stat_print_fn * stat_print) {
SHOWVAL(dirty_leaf); SHOWVAL(dirty_leaf);
SHOWVAL(dirty_nonleaf); SHOWVAL(dirty_nonleaf);
SHOWVAL(balance_leaf); SHOWVAL(balance_leaf);
SHOWVAL(hot_num_started);
SHOWVAL(hot_num_completed);
SHOWVAL(hot_num_aborted);
SHOWVAL(hot_max_root_flush_count);
SHOWVAL(msg_bytes_in); SHOWVAL(msg_bytes_in);
SHOWVAL(msg_bytes_out); SHOWVAL(msg_bytes_out);
SHOWVAL(msg_bytes_curr); SHOWVAL(msg_bytes_curr);
......
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