summaryrefslogtreecommitdiff
path: root/sql/tztime.cc
diff options
context:
space:
mode:
authorAnnamalai Gurusami <annamalai.gurusami@oracle.com>2012-10-08 19:40:30 +0530
committerAnnamalai Gurusami <annamalai.gurusami@oracle.com>2012-10-08 19:40:30 +0530
commit378a7d1ef5e60884d21f3e4059aad29d0e4dcefa (patch)
treef4b66e0e1aa0556afbaf7190a833dc54c0792585 /sql/tztime.cc
parent52a4ef95e87af8d85f5682e9e643e563d41169c4 (diff)
downloadmariadb-git-378a7d1ef5e60884d21f3e4059aad29d0e4dcefa.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/tztime.cc')
-rw-r--r--sql/tztime.cc32
1 files changed, 14 insertions, 18 deletions
diff --git a/sql/tztime.cc b/sql/tztime.cc
index f245b736f52..72898ccc706 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -1706,14 +1706,11 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
}
table= tz_tables[0].table;
- /*
- It is OK to ignore ha_index_init()/ha_index_end() return values since
- mysql.time_zone* tables are MyISAM and these operations always succeed
- for MyISAM.
- */
- (void)table->file->ha_index_init(0, 1);
- table->use_all_columns();
+ if (table->file->ha_index_init(0, 1))
+ goto end_with_close;
+
+ table->use_all_columns();
tz_leapcnt= 0;
res= table->file->index_first(table->record[0]);
@@ -1899,12 +1896,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
tz_tables= tz_tables->next_local;
table->field[0]->store(tz_name->ptr(), tz_name->length(),
&my_charset_latin1);
- /*
- It is OK to ignore ha_index_init()/ha_index_end() return values since
- mysql.time_zone* tables are MyISAM and these operations always succeed
- for MyISAM.
- */
- (void)table->file->ha_index_init(0, 1);
+ if (table->file->ha_index_init(0, 1))
+ goto end;
if (table->file->index_read_map(table->record[0], table->field[0]->ptr,
HA_WHOLE_KEY, HA_READ_KEY_EXACT))
@@ -1932,7 +1925,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
table= tz_tables->table;
tz_tables= tz_tables->next_local;
table->field[0]->store((longlong) tzid, TRUE);
- (void)table->file->ha_index_init(0, 1);
+ if (table->file->ha_index_init(0, 1))
+ goto end;
if (table->file->index_read_map(table->record[0], table->field[0]->ptr,
HA_WHOLE_KEY, HA_READ_KEY_EXACT))
@@ -1959,7 +1953,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
table= tz_tables->table;
tz_tables= tz_tables->next_local;
table->field[0]->store((longlong) tzid, TRUE);
- (void)table->file->ha_index_init(0, 1);
+ if (table->file->ha_index_init(0, 1))
+ goto end;
res= table->file->index_read_map(table->record[0], table->field[0]->ptr,
(key_part_map)1, HA_READ_KEY_EXACT);
@@ -2030,7 +2025,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
*/
table= tz_tables->table;
table->field[0]->store((longlong) tzid, TRUE);
- (void)table->file->ha_index_init(0, 1);
+ if (table->file->ha_index_init(0, 1))
+ goto end;
res= table->file->index_read_map(table->record[0], table->field[0]->ptr,
(key_part_map)1, HA_READ_KEY_EXACT);
@@ -2165,8 +2161,8 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
end:
- if (table)
- (void)table->file->ha_index_end();
+ if (table && table->file->inited)
+ (void) table->file->ha_index_end();
DBUG_RETURN(return_val);
}