#At lp:maria based on revid:monty@askmonty.org-20091203152654-839losfiuarve9w5 2778 Michael Widenius 2009-12-04 Fixed Bug#47017 rpl_timezone fails on PB-2 with mismatch error Fixed coredump in sql_plugin.cc:intern_plugin_lock() on mysqld start with PBXT modified: sql/mysqld.cc sql/share/errmsg.txt sql/sql_base.cc sql/sql_class.cc sql/sql_insert.cc per-file messages: sql/mysqld.cc Fixed coredump in sql_plugin.cc:intern_plugin_lock() on mysqld start with PBXT sql/share/errmsg.txt Row numbers are always positive sql/sql_base.cc Fixed race condition in lock tables when killing insert_delayed thread. This fixes Bug#47017 rpl_timezone fails on PB-2 with mismatch error (Note that the patch only adds a continue; The rest is (required) indentation changes) sql/sql_class.cc Fixed wrong output for high end machines in outfile_loaddata. (Problem was that ER_TRUNCATED_WRONG_VALUE_FOR_FIELD expects ulong, not ulonglong) sql/sql_insert.cc Ensure that if we get a lock problem with delayed_insert, the error is logged. === modified file 'sql/mysqld.cc' --- a/sql/mysqld.cc 2009-12-03 11:34:11 +0000 +++ b/sql/mysqld.cc 2009-12-04 15:12:22 +0000 @@ -4169,8 +4169,10 @@ server."); Need to unlock as global_system_variables.table_plugin was acquired during plugin_init() */ + pthread_mutex_lock(&LOCK_global_system_variables); plugin_unlock(0, global_system_variables.table_plugin); global_system_variables.table_plugin= plugin; + pthread_mutex_unlock(&LOCK_global_system_variables); } } #if defined(WITH_MARIA_STORAGE_ENGINE) && defined(USE_MARIA_FOR_TMP_TABLES) === modified file 'sql/share/errmsg.txt' --- a/sql/share/errmsg.txt 2009-12-03 11:19:05 +0000 +++ b/sql/share/errmsg.txt 2009-12-04 15:12:22 +0000 @@ -5322,8 +5322,8 @@ ER_DIVISION_BY_ZERO 22012 eng "Division by 0" ger "Division durch 0" ER_TRUNCATED_WRONG_VALUE_FOR_FIELD - eng "Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %ld" - ger "Falscher %-.32s-Wert: '%-.128s' f�r Feld '%.192s' in Zeile %ld" + eng "Incorrect %-.32s value: '%-.128s' for column '%.192s' at row %lu" + ger "Falscher %-.32s-Wert: '%-.128s' f�r Feld '%.192s' in Zeile %lu" ER_ILLEGAL_VALUE_FOR_TYPE 22007 eng "Illegal %s '%-.192s' value found during parsing" ger "Nicht zul�ssiger %s-Wert '%-.192s' beim Parsen gefunden" === modified file 'sql/sql_base.cc' --- a/sql/sql_base.cc 2009-12-03 11:34:11 +0000 +++ b/sql/sql_base.cc 2009-12-04 15:12:22 +0000 @@ -8488,19 +8488,26 @@ bool remove_table_from_cache(THD *thd, c result=1; } /* Kill delayed insert threads */ - if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT) && - ! in_use->killed) + if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT)) { - in_use->killed= THD::KILL_CONNECTION; - pthread_mutex_lock(&in_use->mysys_var->mutex); - if (in_use->mysys_var->current_cond) - { - pthread_mutex_lock(in_use->mysys_var->current_mutex); - signalled= 1; - pthread_cond_broadcast(in_use->mysys_var->current_cond); - pthread_mutex_unlock(in_use->mysys_var->current_mutex); - } - pthread_mutex_unlock(&in_use->mysys_var->mutex); + if (!in_use->killed) + { + in_use->killed= THD::KILL_CONNECTION; + pthread_mutex_lock(&in_use->mysys_var->mutex); + if (in_use->mysys_var->current_cond) + { + pthread_mutex_lock(in_use->mysys_var->current_mutex); + signalled= 1; + pthread_cond_broadcast(in_use->mysys_var->current_cond); + pthread_mutex_unlock(in_use->mysys_var->current_mutex); + } + pthread_mutex_unlock(&in_use->mysys_var->mutex); + } + /* + Don't abort locks. Instead give the delayed insert thread + time to finish it's inserts and die gracefully. + */ + continue; } /* Now we must abort all tables locks used by this thread === modified file 'sql/sql_class.cc' --- a/sql/sql_class.cc 2009-12-03 11:34:11 +0000 +++ b/sql/sql_class.cc 2009-12-04 15:12:22 +0000 @@ -2046,7 +2046,7 @@ bool select_export::send_data(List<Item> ER_TRUNCATED_WRONG_VALUE_FOR_FIELD, ER(ER_TRUNCATED_WRONG_VALUE_FOR_FIELD), "string", printable_buff, - item->name, row_count); + item->name, (ulong) row_count); } cvt_str.length(bytes); res= &cvt_str; === modified file 'sql/sql_insert.cc' --- a/sql/sql_insert.cc 2009-12-03 11:34:11 +0000 +++ b/sql/sql_insert.cc 2009-12-04 15:12:22 +0000 @@ -2618,7 +2618,7 @@ bool Delayed_insert::handle_inserts(void or if another thread is removing the current table definition from the table cache. */ - my_error(ER_DELAYED_CANT_CHANGE_LOCK,MYF(ME_FATALERROR), + my_error(ER_DELAYED_CANT_CHANGE_LOCK, MYF(ME_FATALERROR | ME_NOREFRESH), table->s->table_name.str); goto err; } @@ -2791,10 +2791,11 @@ bool Delayed_insert::handle_inserts(void query_cache_invalidate3(&thd, table, 1); if (thr_reschedule_write_lock(*thd.lock->locks)) { - /* This is not known to happen. */ - my_error(ER_DELAYED_CANT_CHANGE_LOCK,MYF(ME_FATALERROR), - table->s->table_name.str); - goto err; + /* This is not known to happen. */ + my_error(ER_DELAYED_CANT_CHANGE_LOCK, + MYF(ME_FATALERROR | ME_NOREFRESH), + table->s->table_name.str); + goto err; } if (!using_bin_log) table->file->extra(HA_EXTRA_WRITE_CACHE);