diff options
author | Rik Prohaska <prohaska7@gmail.com> | 2015-04-01 07:25:04 -0400 |
---|---|---|
committer | Rik Prohaska <prohaska7@gmail.com> | 2015-04-01 07:25:04 -0400 |
commit | dba93629b67984b03daeebe8b2867f74d685fc5f (patch) | |
tree | 9435261991c7d69404cff7fbb6aaef5dd2a0da29 /storage/tokudb | |
parent | b576414189f9058c5d345fb94a574fb5a402b214 (diff) | |
download | mariadb-git-dba93629b67984b03daeebe8b2867f74d685fc5f.tar.gz |
DB-834 check table reports the corrupt index name
Diffstat (limited to 'storage/tokudb')
-rw-r--r-- | storage/tokudb/ha_tokudb_admin.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/storage/tokudb/ha_tokudb_admin.cc b/storage/tokudb/ha_tokudb_admin.cc index b109cd1b976..42205c6d6be 100644 --- a/storage/tokudb/ha_tokudb_admin.cc +++ b/storage/tokudb/ha_tokudb_admin.cc @@ -121,9 +121,10 @@ static int analyze_progress(void *v_extra, uint64_t rows) { progress_time = (float) (t_now - t_start) / (float) t_limit; char *write_status_msg = extra->write_status_msg; TABLE_SHARE *table_share = extra->table_share; - sprintf(write_status_msg, "%s.%s.%s %u of %u %.lf%% rows %.lf%% time", - table_share->db.str, table_share->table_name.str, extra->key_name, - extra->key_i, table_share->keys, progress_rows * 100.0, progress_time * 100.0); + sprintf(write_status_msg, "%.*s.%.*s.%s %u of %u %.lf%% rows %.lf%% time", + (int) table_share->db.length, table_share->db.str, + (int) table_share->table_name.length, table_share->table_name.str, + extra->key_name, extra->key_i, table_share->keys, progress_rows * 100.0, progress_time * 100.0); thd_proc_info(thd, write_status_msg); return 0; } @@ -338,8 +339,10 @@ static int ha_tokudb_check_progress(void *extra, float progress) { static void ha_tokudb_check_info(THD *thd, TABLE *table, const char *msg) { if (thd->vio_ok()) { - char tablename[256]; - snprintf(tablename, sizeof tablename, "%s.%s", table->s->db.str, table->s->table_name.str); + char tablename[table->s->db.length + 1 + table->s->table_name.length + 1]; + snprintf(tablename, sizeof tablename, "%.*s.%.*s", + (int) table->s->db.length, table->s->db.str, + (int) table->s->table_name.length, table->s->table_name.str); thd->protocol->prepare_for_resend(); thd->protocol->store(tablename, strlen(tablename), system_charset_info); thd->protocol->store("check", 5, system_charset_info); @@ -388,6 +391,11 @@ int ha_tokudb::check(THD *thd, HA_CHECK_OPT *check_opt) { } struct check_context check_context = { thd }; r = db->verify_with_progress(db, ha_tokudb_check_progress, &check_context, (tokudb_debug & TOKUDB_DEBUG_CHECK) != 0, keep_going); + if (r != 0) { + char msg[32 + strlen(kname)]; + sprintf(msg, "Corrupt %s", kname); + ha_tokudb_check_info(thd, table, msg); + } snprintf(write_status_msg, sizeof write_status_msg, "%s key=%s %u result=%d", share->table_name, kname, i, r); thd_proc_info(thd, write_status_msg); if (tokudb_debug & TOKUDB_DEBUG_CHECK) { |