#At file:///media/sda3/work/mysql/bzrwork/b39361/6.0-rpl/
2693 He Zhenxing 2008-09-10
BUG#39361 backup_views failed: Lost connection to MySQL server during query
thd->mysys_var was not reset to NULL before calling thd->store_globals() and
cause a assertion to fail, which is fixed by this patch.
modified:
sql/si_objects.cc
=== modified file 'sql/si_objects.cc'
--- a/sql/si_objects.cc 2008-08-27 12:49:58 +0000
+++ b/sql/si_objects.cc 2008-09-10 08:07:04 +0000
@@ -1341,6 +1341,10 @@ ViewBaseObjectsIterator::create(THD *thd
my_thd->thread_stack= (char*) &my_thd;
my_thd->store_globals();
+
+ /* after store_globals(), my_thd->mysys_var and thd->mysys_var
+ should point to the same instance */
+ DBUG_ASSERT(my_thd->mysys_var == thd->mysys_var);
lex_start(my_thd);
TABLE_LIST *tl =
@@ -1354,6 +1358,14 @@ ViewBaseObjectsIterator::create(THD *thd
{
close_thread_tables(my_thd);
delete my_thd;
+
+ /* my_thd->mysys_var and thd->mysys_var points to the same
+ instance, after deletion of my_thd, my_thd->mysys_var is freed,
+ so thd->mysys_var is no long valid and must be set to NULL */
+ pthread_mutex_lock(&thd->LOCK_delete);
+ thd->mysys_var= NULL;
+ pthread_mutex_unlock(&thd->LOCK_delete);
+
thd->store_globals();
return NULL;
| Thread |
|---|
| • bzr commit into mysql-6.0 branch (hezx:2693) Bug#39361 | He Zhenxing | 10 Sep |