summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <istruewing@chilla.local>2006-09-22 15:06:01 +0200
committerunknown <istruewing@chilla.local>2006-09-22 15:06:01 +0200
commit48b2d415d2e8eb28a0a804fc3e48d14cfab79db8 (patch)
tree83138724df074c0b7518b8e039fc0db05d97f43a /myisam
parent1e9ede934be3a368eb4efa455bf42dceee6d898c (diff)
parent6aa811e75e43085cf2be2e412be26eb96c1ee89f (diff)
downloadmariadb-git-48b2d415d2e8eb28a0a804fc3e48d14cfab79db8.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into chilla.local:/home/mydev/mysql-4.0-bug14400 mysql-test/r/myisam.result: Auto merged myisam/mi_rkey.c: Bug#14400 - Query joins wrong rows from table which is subject of "concurrent insert" Manual merge mysql-test/t/myisam.test: Bug#14400 - Query joins wrong rows from table which is subject of "concurrent insert" Manual merge
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_rkey.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/myisam/mi_rkey.c b/myisam/mi_rkey.c
index f051558cae5..52403b110cb 100644
--- a/myisam/mi_rkey.c
+++ b/myisam/mi_rkey.c
@@ -78,25 +78,18 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
if (!_mi_search(info,keyinfo, key_buff, use_key_length,
myisam_read_vec[search_flag], info->s->state.key_root[inx]))
{
- if (info->lastpos >= info->state->data_file_length)
- {
+ /*
+ 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 (info->lastpos >= info->state->data_file_length &&
+ (search_flag != HA_READ_KEY_EXACT ||
+ last_used_keyseg != keyinfo->seg + keyinfo->keysegs))
do
{
uint not_used;
/*
- If we are searching for an exact key, abort if we find a bigger
- key.
- */
- if (search_flag == HA_READ_KEY_EXACT &&
- (use_key_length == USE_WHOLE_KEY ||
- _mi_key_cmp(keyinfo->seg, key_buff, info->lastkey, use_key_length,
- SEARCH_FIND, &not_used)))
- {
- my_errno= HA_ERR_END_OF_FILE;
- info->lastpos= HA_OFFSET_ERROR;
- break;
- }
- /*
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
@@ -107,8 +100,20 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
myisam_readnext_vec[search_flag],
info->s->state.key_root[inx]))
break;
- }
- while (info->lastpos >= info->state->data_file_length);
+ /*
+ 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 &&
+ _mi_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);
}
}
if (share->concurrent_insert)