diff options
author | unknown <svoj@mysql.com/june.mysql.com> | 2006-12-26 17:47:30 +0400 |
---|---|---|
committer | unknown <svoj@mysql.com/june.mysql.com> | 2006-12-26 17:47:30 +0400 |
commit | f63d8c8d0c4a57b9f77a1c190cde4de7ad91bf81 (patch) | |
tree | 813b9c4b985ca4c8ed1a93e881980b0440b781ac /sql/opt_range.cc | |
parent | 16b596bf34c974057904ec850b499c3a36dcb88d (diff) | |
download | mariadb-git-f63d8c8d0c4a57b9f77a1c190cde4de7ad91bf81.tar.gz |
BUG#25048 - ERROR 126 : Incorrect key file for table '.XXXX.MYI'; try to
repair it
Multi-table delete that is optimized with QUICK_RANGE reports table
corruption.
DELETE statement must not use KEYREAD optimization, and sets
table->no_keyread to 1. This was ignored in QUICK_RANGE optimization.
With this fix QUICK_RANGE optimization honors table->no_keyread
value and does not enable KEYREAD when it is requested.
mysql-test/r/index_merge.result:
Fixed a test case according to fix for bug#25048.
mysql-test/r/index_merge_ror.result:
A test case for bug#25048.
mysql-test/t/index_merge_ror.test:
A test case for bug#25048.
sql/opt_range.cc:
Do not use key read when head->no_keyread is set.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r-- | sql/opt_range.cc | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 23a82c6eda7..4659c21f20f 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -875,7 +875,11 @@ QUICK_RANGE_SELECT::~QUICK_RANGE_SELECT() if (file) { range_end(); - file->extra(HA_EXTRA_NO_KEYREAD); + if (head->key_read) + { + head->key_read= 0; + file->extra(HA_EXTRA_NO_KEYREAD); + } if (free_file) { DBUG_PRINT("info", ("Freeing separate handler 0x%lx (free: %d)", (long) file, @@ -1017,8 +1021,12 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler) if (reuse_handler) { DBUG_PRINT("info", ("Reusing handler %p", file)); - if (file->extra(HA_EXTRA_KEYREAD) || - file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) || + if (!head->no_keyread) + { + head->key_read= 1; + file->extra(HA_EXTRA_KEYREAD); + } + if (file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) || init() || reset()) { DBUG_RETURN(1); @@ -1041,9 +1049,12 @@ int QUICK_RANGE_SELECT::init_ror_merged_scan(bool reuse_handler) } if (file->external_lock(thd, F_RDLCK)) goto failure; - - if (file->extra(HA_EXTRA_KEYREAD) || - file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) || + if (!head->no_keyread) + { + head->key_read= 1; + file->extra(HA_EXTRA_KEYREAD); + } + if (file->extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) || init() || reset()) { file->external_lock(thd, F_UNLCK); |