diff options
author | Sergei Golubchik <sergii@pisem.net> | 2011-10-19 21:45:18 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2011-10-19 21:45:18 +0200 |
commit | 76f0b94bb0b2994d639353530c5b251d0f1a204b (patch) | |
tree | 9ed50628aac34f89a37637bab2fc4915b86b5eb4 /storage/myisam/mi_rnext_same.c | |
parent | 4e46d8e5bff140f2549841167dc4b65a3c0a645d (diff) | |
parent | 5dc1a2231f55bacc9aaf0e24816f3d9c2ee1f21d (diff) | |
download | mariadb-git-76f0b94bb0b2994d639353530c5b251d0f1a204b.tar.gz |
merge with 5.3
sql/sql_insert.cc:
CREATE ... IF NOT EXISTS may do nothing, but
it is still not a failure. don't forget to my_ok it.
******
CREATE ... IF NOT EXISTS may do nothing, but
it is still not a failure. don't forget to my_ok it.
sql/sql_table.cc:
small cleanup
******
small cleanup
Diffstat (limited to 'storage/myisam/mi_rnext_same.c')
-rw-r--r-- | storage/myisam/mi_rnext_same.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/storage/myisam/mi_rnext_same.c b/storage/myisam/mi_rnext_same.c index 54de367016b..ea1449f2c98 100644 --- a/storage/myisam/mi_rnext_same.c +++ b/storage/myisam/mi_rnext_same.c @@ -29,6 +29,7 @@ int mi_rnext_same(MI_INFO *info, uchar *buf) int error; uint inx,not_used[2]; MI_KEYDEF *keyinfo; + ICP_RESULT icp_res= ICP_MATCH; DBUG_ENTER("mi_rnext_same"); if ((int) (inx=info->lastinx) < 0 || info->lastpos == HA_OFFSET_ERROR) @@ -63,6 +64,17 @@ int mi_rnext_same(MI_INFO *info, uchar *buf) } for (;;) { + /* + If we are at the last key on the key page, allow writers to + access the index. + */ + if (info->int_keypos >= info->int_maxpos && + mi_yield_and_check_if_killed(info, inx)) + { + error=1; + break; + } + if ((error=_mi_search_next(info,keyinfo,info->lastkey, info->lastkey_length,SEARCH_BIGGER, info->s->state.key_root[inx]))) @@ -78,26 +90,31 @@ int mi_rnext_same(MI_INFO *info, uchar *buf) /* Skip - rows that are inserted by other threads since we got a lock - - rows that don't match index condition */ + - rows that don't match index condition + */ if (info->lastpos < info->state->data_file_length && (!info->index_cond_func || - mi_check_index_cond(info, inx, buf) != ICP_NO_MATCH)) + (icp_res= mi_check_index_cond(info, inx, buf)) != ICP_NO_MATCH)) break; } } if (info->s->concurrent_insert) mysql_rwlock_unlock(&info->s->key_root_lock[inx]); + + /* Don't clear if database-changed */ info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); info->update|= HA_STATE_NEXT_FOUND | HA_STATE_RNEXT_SAME; - if (error) + if (error || icp_res != ICP_MATCH) { + fast_mi_writeinfo(info); if (my_errno == HA_ERR_KEY_NOT_FOUND) my_errno=HA_ERR_END_OF_FILE; } else if (!buf) { + fast_mi_writeinfo(info); DBUG_RETURN(info->lastpos==HA_OFFSET_ERROR ? my_errno : 0); } else if (!(*info->read_record)(info,info->lastpos,buf)) |