Commit ea6a4eef authored by Michael Widenius's avatar Michael Widenius

Fixed issues found by buildbot & valgrind:

- Wrong thd uses in Item_subselect, could lead to crash
- Inititalize uninitialized variable in new autoincrement handling code


sql/handler.cc:
  More DBUG_PRINT
sql/item_subselect.cc:
  Wrong thd uses in Item_subselect, could lead to crash
storage/innobase/handler/ha_innodb.cc:
  Initialize variable needed by upper level. This only happens when auto-increment value wraps over.
storage/xtradb/handler/ha_innodb.cc:
  Initialize variable needed by upper level. This only happens when auto-increment value wraps over.
parent b722aebd
...@@ -2621,7 +2621,8 @@ int handler::update_auto_increment() ...@@ -2621,7 +2621,8 @@ int handler::update_auto_increment()
if (unlikely(nr == ULONGLONG_MAX)) if (unlikely(nr == ULONGLONG_MAX))
DBUG_RETURN(HA_ERR_AUTOINC_ERANGE); DBUG_RETURN(HA_ERR_AUTOINC_ERANGE);
DBUG_PRINT("info",("auto_increment: %lu", (ulong) nr)); DBUG_PRINT("info",("auto_increment: %llu nb_reserved_values: %llu",
nr, nb_reserved_values));
/* Store field without warning (Warning will be printed by insert) */ /* Store field without warning (Warning will be printed by insert) */
save_count_cuted_fields= thd->count_cuted_fields; save_count_cuted_fields= thd->count_cuted_fields;
......
...@@ -220,7 +220,7 @@ bool Item_subselect::fix_fields(THD *thd_param, Item **ref) ...@@ -220,7 +220,7 @@ bool Item_subselect::fix_fields(THD *thd_param, Item **ref)
uint8 uncacheable; uint8 uncacheable;
bool res; bool res;
status_var_increment(thd->status_var.feature_subquery); status_var_increment(thd_param->status_var.feature_subquery);
DBUG_ASSERT(fixed == 0); DBUG_ASSERT(fixed == 0);
engine->set_thd((thd= thd_param)); engine->set_thd((thd= thd_param));
......
...@@ -10284,6 +10284,7 @@ ha_innobase::get_auto_increment( ...@@ -10284,6 +10284,7 @@ ha_innobase::get_auto_increment(
take care of this */ take care of this */
prebuilt->autoinc_last_value = 0; prebuilt->autoinc_last_value = 0;
dict_table_autoinc_unlock(prebuilt->table); dict_table_autoinc_unlock(prebuilt->table);
*nb_reserved_values= 0;
return; return;
} }
*nb_reserved_values = trx->n_autoinc_rows; *nb_reserved_values = trx->n_autoinc_rows;
......
...@@ -11225,6 +11225,7 @@ ha_innobase::get_auto_increment( ...@@ -11225,6 +11225,7 @@ ha_innobase::get_auto_increment(
take care of this */ take care of this */
prebuilt->autoinc_last_value = 0; prebuilt->autoinc_last_value = 0;
dict_table_autoinc_unlock(prebuilt->table); dict_table_autoinc_unlock(prebuilt->table);
*nb_reserved_values = 0;
return; return;
} }
*nb_reserved_values = trx->n_autoinc_rows; *nb_reserved_values = trx->n_autoinc_rows;
...@@ -13019,7 +13020,7 @@ static MYSQL_SYSVAR_ENUM(corrupt_table_action, srv_pass_corrupt_table, ...@@ -13019,7 +13020,7 @@ static MYSQL_SYSVAR_ENUM(corrupt_table_action, srv_pass_corrupt_table,
"Warn corruptions of user tables as 'corrupt table' instead of not crashing itself, " "Warn corruptions of user tables as 'corrupt table' instead of not crashing itself, "
"when used with file_per_table. " "when used with file_per_table. "
"All file io for the datafile after detected as corrupt are disabled, " "All file io for the datafile after detected as corrupt are disabled, "
"except for the deletion.", "except for the deletion. Possible options are 'assert', 'warn' & 'salvage'",
NULL, NULL, 0, &corrupt_table_action_typelib); NULL, NULL, 0, &corrupt_table_action_typelib);
static MYSQL_SYSVAR_ULINT(lazy_drop_table, srv_lazy_drop_table, static MYSQL_SYSVAR_ULINT(lazy_drop_table, srv_lazy_drop_table,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment