diff options
author | Annamalai Gurusami <annamalai.gurusami@oracle.com> | 2012-10-08 19:40:30 +0530 |
---|---|---|
committer | Annamalai Gurusami <annamalai.gurusami@oracle.com> | 2012-10-08 19:40:30 +0530 |
commit | bd7c9815cee8f9bcf6ebd7d87cce6ee045732e42 (patch) | |
tree | f4b66e0e1aa0556afbaf7190a833dc54c0792585 /sql/log_event_old.cc | |
parent | 5d9e863faf9867bc4639af77e73767ac856fe3ed (diff) | |
download | mariadb-git-bd7c9815cee8f9bcf6ebd7d87cce6ee045732e42.tar.gz |
Bug #14036214 MYSQLD CRASHES WHEN EXECUTING UPDATE IN TRX WITH
CONSISTENT SNAPSHOT OPTION
A transaction is started with a consistent snapshot. After
the transaction is started new indexes are added to the
table. Now when we issue an update statement, the optimizer
chooses an index. When the index scan is being initialized
via ha_innobase::change_active_index(), InnoDB reports
the error code HA_ERR_TABLE_DEF_CHANGED, with message
stating that "insufficient history for index".
This error message is propagated up to the SQL layer. But
the my_error() api is never called. The statement level
diagnostics area is not updated with the correct error
status (it remains in Diagnostics_area::DA_EMPTY).
Hence the following check in the Protocol::end_statement()
fails.
516 case Diagnostics_area::DA_EMPTY:
517 default:
518 DBUG_ASSERT(0);
519 error= send_ok(thd->server_status, 0, 0, 0, NULL);
520 break;
The fix is to backport the fix of bugs 14365043, 11761652
and 11746399.
14365043 PROTOCOL::END_STATEMENT(): ASSERTION `0' FAILED
11761652 HA_RND_INIT() RESULT CODE NOT CHECKED
11746399 RETURN VALUES OF HA_INDEX_INIT() AND INDEX_INIT() IGNORED
rb://1227 approved by guilhem and mattiasj.
Diffstat (limited to 'sql/log_event_old.cc')
-rw-r--r-- | sql/log_event_old.cc | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index d68c474d00a..55d8d72ec5d 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -725,7 +725,10 @@ static int find_and_fetch_row(TABLE *table, uchar *key) int error; /* We have a key: search the table using the index */ if (!table->file->inited && (error= table->file->ha_index_init(0, FALSE))) + { + table->file->print_error(error, MYF(0)); DBUG_RETURN(error); + } /* Don't print debug messages when running valgrind since they can @@ -823,7 +826,10 @@ static int find_and_fetch_row(TABLE *table, uchar *key) /* We don't have a key: search the table using rnd_next() */ if ((error= table->file->ha_rnd_init(1))) - return error; + { + table->file->print_error(error, MYF(0)); + DBUG_RETURN(error); + } /* Continue until we find the right record or have made a full loop */ do @@ -846,15 +852,21 @@ static int find_and_fetch_row(TABLE *table, uchar *key) goto restart_rnd_next; case HA_ERR_END_OF_FILE: - if (++restart_count < 2) - table->file->ha_rnd_init(1); - break; + if (++restart_count < 2) + { + if ((error= table->file->ha_rnd_init(1))) + { + table->file->print_error(error, MYF(0)); + DBUG_RETURN(error); + } + } + break; default: - table->file->print_error(error, MYF(0)); + table->file->print_error(error, MYF(0)); DBUG_PRINT("info", ("Record not found")); - table->file->ha_rnd_end(); - DBUG_RETURN(error); + (void) table->file->ha_rnd_end(); + DBUG_RETURN(error); } } while (restart_count < 2 && record_compare(table)); @@ -2417,7 +2429,7 @@ int Old_rows_log_event::find_row(const Relay_log_info *rli) continue; DBUG_PRINT("info",("no record matching the given row found")); table->file->print_error(error, MYF(0)); - table->file->ha_index_end(); + (void) table->file->ha_index_end(); DBUG_RETURN(error); } } @@ -2458,7 +2470,13 @@ int Old_rows_log_event::find_row(const Relay_log_info *rli) case HA_ERR_END_OF_FILE: if (++restart_count < 2) - table->file->ha_rnd_init(1); + { + if ((error= table->file->ha_rnd_init(1))) + { + table->file->print_error(error, MYF(0)); + DBUG_RETURN(error); + } + } break; default: |