diff options
author | svoj@april.(none) <> | 2006-09-18 19:43:33 +0500 |
---|---|---|
committer | svoj@april.(none) <> | 2006-09-18 19:43:33 +0500 |
commit | 419a51c5a510b59c63f311daf57a666c492b2b29 (patch) | |
tree | 68c1f1f36b5de78e7fceb16d543c95376febf576 /storage | |
parent | 343e08391d70accf2d2c9f077b3e950b53ea05fe (diff) | |
parent | 33acddb56849fd66092b0a030ce1fa6b1d981764 (diff) | |
download | mariadb-git-419a51c5a510b59c63f311daf57a666c492b2b29.tar.gz |
Merge april.(none):/home/svoj/devel/bk/mysql-5.1
into april.(none):/home/svoj/devel/mysql/merge/mysql-5.1-engines
Diffstat (limited to 'storage')
-rw-r--r-- | storage/myisam/ha_myisam.cc | 8 | ||||
-rw-r--r-- | storage/myisam/ha_myisam.h | 1 | ||||
-rw-r--r-- | storage/myisam/mi_rkey.c | 54 |
3 files changed, 43 insertions, 20 deletions
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 53044338b50..b9180248f34 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -143,6 +143,14 @@ ha_myisam::ha_myisam(TABLE_SHARE *table_arg) can_enable_indexes(1) {} +handler *ha_myisam::clone(MEM_ROOT *mem_root) +{ + ha_myisam *new_handler= static_cast <ha_myisam *>(handler::clone(mem_root)); + if (new_handler) + new_handler->file->state= file->state; + return new_handler; +} + static const char *ha_myisam_exts[] = { ".MYI", diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h index 5544e5040b3..511b796ebdb 100644 --- a/storage/myisam/ha_myisam.h +++ b/storage/myisam/ha_myisam.h @@ -45,6 +45,7 @@ class ha_myisam: public handler public: ha_myisam(TABLE_SHARE *table_arg); ~ha_myisam() {} + handler *clone(MEM_ROOT *mem_root); const char *table_type() const { return "MyISAM"; } const char *index_type(uint key_number); const char **bas_ext() const; diff --git a/storage/myisam/mi_rkey.c b/storage/myisam/mi_rkey.c index a9a8cbacb4b..3a58b17a983 100644 --- a/storage/myisam/mi_rkey.c +++ b/storage/myisam/mi_rkey.c @@ -94,28 +94,42 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len, myisam_read_vec[search_flag], info->s->state.key_root[inx])) { /* - If we are searching for an exact key (including the data pointer) - and this was added by an concurrent insert, - then the result is "key not found". + If we searching for a partial key (or using >, >=, < or <=) and + the data is outside of the data file, we need to continue searching + for the first key inside the data file */ - if ((search_flag == HA_READ_KEY_EXACT) && - (info->lastpos >= info->state->data_file_length)) + if (info->lastpos >= info->state->data_file_length && + (search_flag != HA_READ_KEY_EXACT || + last_used_keyseg != keyinfo->seg + keyinfo->keysegs)) { - my_errno= HA_ERR_KEY_NOT_FOUND; - info->lastpos= HA_OFFSET_ERROR; - } - else while (info->lastpos >= info->state->data_file_length) - { - /* - Skip rows that are inserted by other threads since we got a lock - Note that this can only happen if we are not searching after an - exact key, because the keys are sorted according to position - */ - if (_mi_search_next(info, keyinfo, info->lastkey, - info->lastkey_length, - myisam_readnext_vec[search_flag], - info->s->state.key_root[inx])) - break; + do + { + uint not_used[2]; + /* + Skip rows that are inserted by other threads since we got a lock + Note that this can only happen if we are not searching after an + full length exact key, because the keys are sorted + according to position + */ + if (_mi_search_next(info, keyinfo, info->lastkey, + info->lastkey_length, + myisam_readnext_vec[search_flag], + info->s->state.key_root[inx])) + break; + /* + Check that the found key does still match the search. + _mi_search_next() delivers the next key regardless of its + value. + */ + if (search_flag == HA_READ_KEY_EXACT && + ha_key_cmp(keyinfo->seg, key_buff, info->lastkey, use_key_length, + SEARCH_FIND, not_used)) + { + my_errno= HA_ERR_KEY_NOT_FOUND; + info->lastpos= HA_OFFSET_ERROR; + break; + } + } while (info->lastpos >= info->state->data_file_length); } } } |