diff options
| author | Michael Widenius <monty@askmonty.org> | 2011-01-11 15:36:41 +0200 |
|---|---|---|
| committer | Michael Widenius <monty@askmonty.org> | 2011-01-11 15:36:41 +0200 |
| commit | 050c004f5e6f152f5c4cdadda8a15e01d2f07a9a (patch) | |
| tree | f5828daced42ff651d5f822af17844154fb9ffd1 /sql/sql_handler.cc | |
| parent | e63b5546c597f65696868eaf69159107bc4a8e44 (diff) | |
| parent | 2eaa76b84426b19f8574876ad1fa85ae6cfe3196 (diff) | |
| download | mariadb-git-050c004f5e6f152f5c4cdadda8a15e01d2f07a9a.tar.gz | |
Merge with 5.1
Fixes to get Aria handler tests to work.
Fixes LP#697597 "HANDLER + Aria asserts in maria-5.3-handler"
Diffstat (limited to 'sql/sql_handler.cc')
| -rw-r--r-- | sql/sql_handler.cc | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index eaae5efe21c..f0cc90f06a6 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -174,6 +174,11 @@ static void mysql_ha_close_table(SQL_HANDLER *handler, if (*table_ptr) { + if (handler->lock) + { + // Mark it unlocked, like in reset_lock_data() + reset_lock_data(handler->lock, 1); + } table->file->ha_index_or_rnd_end(); if (! is_locked) VOID(pthread_mutex_lock(&LOCK_open)); @@ -607,6 +612,12 @@ mysql_ha_fix_cond_and_key(SQL_HANDLER *handler, } } } + else if (table->file->inited != handler::RND) + { + /* Convert RNEXT to RFIRST if we haven't started row scan */ + if (mode == RNEXT) + mode= RFIRST; + } handler->mode= mode; // Store adjusted mode return 0; } @@ -723,6 +734,8 @@ retry: case RNEXT: if (table->file->inited != handler::NONE) { + if ((error= table->file->can_continue_handler_scan())) + break; if (keyname) { /* Check if we read from the same index. */ @@ -755,7 +768,9 @@ retry: DBUG_ASSERT((uint) keyno == table->file->get_index()); if (table->file->inited != handler::NONE) { - error=table->file->ha_index_prev(table->record[0]); + if ((error= table->file->can_continue_handler_scan())) + break; + error= table->file->ha_index_prev(table->record[0]); break; } /* else fall through */ @@ -798,8 +813,11 @@ retry: continue; if (error != HA_ERR_KEY_NOT_FOUND && error != HA_ERR_END_OF_FILE) { - sql_print_error("mysql_ha_read: Got error %d when reading table '%s'", - error, tables->table_name); + /* Don't give error in the log file for some expected problems */ + if (error != HA_ERR_RECORD_CHANGED && error != HA_ERR_WRONG_COMMAND) + sql_print_error("mysql_ha_read: Got error %d when reading " + "table '%s'", + error, tables->table_name); table->file->print_error(error,MYF(0)); goto err; } |
