summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2006-07-05 11:20:10 +0200
committerunknown <ingo@mysql.com>2006-07-05 11:20:10 +0200
commitfef31470d5f2114f374ba181e7937d728526cbaf (patch)
tree4c78c2445fa863be62cde1c40ae6490a1ad3ec23 /myisam
parent516fdb7197a27822e0a7623843fdb326473777e9 (diff)
parent752b826e0d890b2c3b28146089611c1982b459ed (diff)
downloadmariadb-git-fef31470d5f2114f374ba181e7937d728526cbaf.tar.gz
Merge mysql.com:/home/mydev/mysql-4.1-bug14400
into mysql.com:/home/mydev/mysql-5.0-ateam libmysqld/libmysqld.c: Auto merged myisam/mi_rkey.c: Auto merged mysql-test/r/func_sapdb.result: Auto merged mysql-test/r/symlink.result: Auto merged mysql-test/t/func_sapdb.test: Auto merged scripts/make_binary_distribution.sh: Auto merged sql/item_geofunc.h: Auto merged sql/item_timefunc.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_parse.cc: Auto merged libmysqld/lib_sql.cc: Manual merge mysql-test/r/func_time.result: Manual merge mysql-test/r/gis.result: Manual merge mysql-test/t/func_time.test: Manual merge mysql-test/t/gis.test: Manual merge sql-common/client.c: Manual merge
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_rkey.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/myisam/mi_rkey.c b/myisam/mi_rkey.c
index e6f4d39ab49..a9a8cbacb4b 100644
--- a/myisam/mi_rkey.c
+++ b/myisam/mi_rkey.c
@@ -68,6 +68,7 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
if (fast_mi_readinfo(info))
goto err;
+
if (share->concurrent_insert)
rw_rdlock(&share->key_root_lock[inx]);
@@ -90,24 +91,35 @@ int mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
case HA_KEY_ALG_BTREE:
default:
if (!_mi_search(info, keyinfo, key_buff, use_key_length,
- myisam_read_vec[search_flag], info->s->state.key_root[inx]))
+ myisam_read_vec[search_flag], info->s->state.key_root[inx]))
{
- while (info->lastpos >= info->state->data_file_length)
+ /*
+ 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 ((search_flag == HA_READ_KEY_EXACT) &&
+ (info->lastpos >= info->state->data_file_length))
+ {
+ 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]))
+ info->lastkey_length,
+ myisam_readnext_vec[search_flag],
+ info->s->state.key_root[inx]))
break;
}
}
}
+
if (share->concurrent_insert)
rw_unlock(&share->key_root_lock[inx]);