diff options
author | Sergei Golubchik <sergii@pisem.net> | 2010-11-25 18:17:28 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2010-11-25 18:17:28 +0100 |
commit | 65ca700def99289cc31a7040537f5aa6e12bf485 (patch) | |
tree | 97b3a07299b626c519da0e80c122b5b79b933914 /storage/myisam/mi_rprev.c | |
parent | 2ab57de38d13d927ddff2d51aed4af34e13998f5 (diff) | |
parent | 6e5bcca7935d3c62f84bb640e5357664a210ee12 (diff) | |
download | mariadb-git-65ca700def99289cc31a7040537f5aa6e12bf485.tar.gz |
merge.
checkpoint.
does not compile.
Diffstat (limited to 'storage/myisam/mi_rprev.c')
-rw-r--r-- | storage/myisam/mi_rprev.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/storage/myisam/mi_rprev.c b/storage/myisam/mi_rprev.c index f7dddefb647..89612b5a661 100644 --- a/storage/myisam/mi_rprev.c +++ b/storage/myisam/mi_rprev.c @@ -51,22 +51,36 @@ int mi_rprev(MI_INFO *info, uchar *buf, int inx) error=_mi_search(info,share->keyinfo+inx,info->lastkey, USE_WHOLE_KEY, flag, share->state.key_root[inx]); - if (share->concurrent_insert) + if (!error) { - if (!error) + int res= 0; + while ((share->concurrent_insert && + info->lastpos >= info->state->data_file_length) || + (info->index_cond_func && + !(res= mi_check_index_cond(info, inx, buf)))) { - while (info->lastpos >= info->state->data_file_length) - { - /* Skip rows that are inserted by other threads since we got a lock */ - if ((error=_mi_search_next(info,share->keyinfo+inx,info->lastkey, - info->lastkey_length, - SEARCH_SMALLER, - share->state.key_root[inx]))) - break; - } + /* + Skip rows that are either inserted by other threads since + we got a lock or do not match pushed index conditions + */ + if ((error=_mi_search_next(info,share->keyinfo+inx,info->lastkey, + info->lastkey_length, + SEARCH_SMALLER, + share->state.key_root[inx]))) + break; + } + if (!error && res == 2) + { + if (share->concurrent_insert) + rw_unlock(&share->key_root_lock[inx]); + info->lastpos= HA_OFFSET_ERROR; + DBUG_RETURN(my_errno= HA_ERR_END_OF_FILE); } - mysql_rwlock_unlock(&share->key_root_lock[inx]); } + + if (share->concurrent_insert) + mysql_rwlock_unlock(&share->key_root_lock[inx]); + info->update&= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); info->update|= HA_STATE_PREV_FOUND; if (error) |