diff options
author | Jon Olav Hauglid <jon.hauglid@sun.com> | 2010-04-20 10:51:50 +0200 |
---|---|---|
committer | Jon Olav Hauglid <jon.hauglid@sun.com> | 2010-04-20 10:51:50 +0200 |
commit | ac7873663866e74fb7572c0b2a5f2548a2897420 (patch) | |
tree | 3c10718d95da445db1e1f9405aa01297659a8739 /storage/myisam | |
parent | afdf0f030c342e28c5cfd7220e55830b18424de3 (diff) | |
parent | 1a3c03dbb49cfc9ae8246957c5b0ac2a9389d28e (diff) | |
download | mariadb-git-ac7873663866e74fb7572c0b2a5f2548a2897420.tar.gz |
merge from mysql-trunk-bugfixing
Diffstat (limited to 'storage/myisam')
-rw-r--r-- | storage/myisam/ha_myisam.cc | 21 | ||||
-rw-r--r-- | storage/myisam/ha_myisam.h | 5 | ||||
-rw-r--r-- | storage/myisam/rt_index.c | 22 | ||||
-rw-r--r-- | storage/myisam/sort.c | 14 |
4 files changed, 38 insertions, 24 deletions
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 13f042ba904..a831335cbb9 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -19,9 +19,10 @@ #endif #define MYSQL_SERVER 1 -#include "mysql_priv.h" +#include "sql_priv.h" #include "probes_mysql.h" -#include <mysql/plugin.h> +#include "key.h" // key_copy +#include "sql_plugin.h" #include <m_ctype.h> #include <my_bit.h> #include <myisampack.h> @@ -29,6 +30,8 @@ #include <stdarg.h> #include "myisamdef.h" #include "rt_index.h" +#include "sql_table.h" // tablename_to_filename +#include "sql_class.h" // THD ulonglong myisam_recover_options; static ulong opt_myisam_block_size; @@ -1346,9 +1349,17 @@ int ha_myisam::enable_indexes(uint mode) { sql_print_warning("Warning: Enabling keys got errno %d on %s.%s, retrying", my_errno, param.db_name, param.table_name); - /* Repairing by sort failed. Now try standard repair method. */ - param.testflag&= ~(T_REP_BY_SORT | T_QUICK); - error= (repair(thd,param,0) != HA_ADMIN_OK); + /* + Repairing by sort failed. Now try standard repair method. + Still we want to fix only index file. If data file corruption + was detected (T_RETRY_WITHOUT_QUICK), we shouldn't do much here. + Let implicit repair do this job. + */ + if (!(param.testflag & T_RETRY_WITHOUT_QUICK)) + { + param.testflag&= ~T_REP_BY_SORT; + error= (repair(thd,param,0) != HA_ADMIN_OK); + } /* If the standard repair succeeded, clear all error messages which might have been set by the first repair. They can still be seen diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h index 71865d87fe2..1a8246ae882 100644 --- a/storage/myisam/ha_myisam.h +++ b/storage/myisam/ha_myisam.h @@ -22,6 +22,11 @@ #include <myisam.h> #include <ft_global.h> +#include "handler.h" /* handler */ +#include "table.h" /* TABLE_SHARE */ + +struct TABLE_SHARE; +typedef struct st_ha_create_information HA_CREATE_INFO; #define HA_RECOVER_DEFAULT 1 /* Automatic recover active */ #define HA_RECOVER_BACKUP 2 /* Make a backupfile on recover */ diff --git a/storage/myisam/rt_index.c b/storage/myisam/rt_index.c index e094c302f92..31241a83228 100644 --- a/storage/myisam/rt_index.c +++ b/storage/myisam/rt_index.c @@ -404,10 +404,16 @@ int rtree_get_first(MI_INFO *info, uint keynr, uint key_length) int rtree_get_next(MI_INFO *info, uint keynr, uint key_length) { - my_off_t root; + my_off_t root= info->s->state.key_root[keynr]; MI_KEYDEF *keyinfo = info->s->keyinfo + keynr; - if (!info->buff_used) + if (root == HA_OFFSET_ERROR) + { + my_errno= HA_ERR_END_OF_FILE; + return -1; + } + + if (!info->buff_used && !info->page_changed) { uint k_len = keyinfo->keylength - info->s->base.rec_reflength; /* rt_PAGE_NEXT_KEY(info->int_keypos) */ @@ -428,16 +434,8 @@ int rtree_get_next(MI_INFO *info, uint keynr, uint key_length) return 0; } - else - { - if ((root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR) - { - my_errno= HA_ERR_END_OF_FILE; - return -1; - } - - return rtree_get_req(info, keyinfo, key_length, root, 0); - } + + return rtree_get_req(info, keyinfo, key_length, root, 0); } diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c index 441d6bfa05b..3cb99867c6a 100644 --- a/storage/myisam/sort.c +++ b/storage/myisam/sort.c @@ -506,7 +506,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) for (i= 0, sinfo= sort_param ; i < sort_info->total_keys ; - i++, rec_per_key_part+=sinfo->keyinfo->keysegs, sinfo++) + i++, sinfo++) { if (!sinfo->sort_keys) { @@ -529,11 +529,6 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) flush_ft_buf(sinfo) || flush_pending_blocks(sinfo)) got_error=1; } - if (!got_error && param->testflag & T_STATISTICS) - update_key_parts(sinfo->keyinfo, rec_per_key_part, sinfo->unique, - param->stats_method == MI_STATS_METHOD_IGNORE_NULLS? - sinfo->notnull: NULL, - (ulonglong) info->state->records); } my_free((uchar*) sinfo->sort_keys,MYF(0)); my_free(mi_get_rec_buff_ptr(info, sinfo->rec_buff), @@ -547,7 +542,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) delete_dynamic(&sinfo->buffpek), close_cached_file(&sinfo->tempfile), close_cached_file(&sinfo->tempfile_for_exceptions), - sinfo++) + rec_per_key_part+= sinfo->keyinfo->keysegs, sinfo++) { if (got_error) continue; @@ -639,6 +634,11 @@ int thr_write_keys(MI_SORT_PARAM *sort_param) got_error=1; } } + if (!got_error && param->testflag & T_STATISTICS) + update_key_parts(sinfo->keyinfo, rec_per_key_part, sinfo->unique, + param->stats_method == MI_STATS_METHOD_IGNORE_NULLS ? + sinfo->notnull : NULL, + (ulonglong) info->state->records); } my_free((uchar*) mergebuf,MYF(MY_ALLOW_ZERO_PTR)); DBUG_RETURN(got_error); |