Merge lp:~akopytov/percona-xtradb-cluster/bug1333348-5.5 into lp:percona-xtradb-cluster/5.5

Proposed by Alexey Kopytov
Status: Merged
Approved by: Raghavendra D Prabhu
Approved revision: no longer in the source branch.
Merged at revision: 763
Proposed branch: lp:~akopytov/percona-xtradb-cluster/bug1333348-5.5
Merge into: lp:percona-xtradb-cluster/5.5
Diff against target: 104 lines (+17/-32)
1 file modified
sql/mysqld.cc (+17/-32)
To merge this branch: bzr merge lp:~akopytov/percona-xtradb-cluster/bug1333348-5.5
Reviewer Review Type Date Requested Status
Raghavendra D Prabhu (community) Needs Fixing
Review via email: mp+224440@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote :

Commented for 5.6, needs some fixing.

review: Needs Fixing
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Done.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== removed symlink 'build'
=== target was u'build-ps'
=== modified file 'sql/mysqld.cc'
--- sql/mysqld.cc 2014-04-30 02:30:49 +0000
+++ sql/mysqld.cc 2014-06-26 18:26:28 +0000
@@ -4523,11 +4523,19 @@
45234523
4524 mysql_thread_set_psi_id(thd->thread_id);4524 mysql_thread_set_psi_id(thd->thread_id);
4525 thd->thr_create_utime= my_micro_time();4525 thd->thr_create_utime= my_micro_time();
4526 if (MYSQL_CALLBACK_ELSE(thd->scheduler, init_new_connection_thread, (), 0))4526
4527 /*
4528 Don't use thd->scheduler methods to initialize and destroy wsrep threads,
4529 as these threads are not managed by the scheduler specified with the
4530 thread_handling option. Instead execute initialization/destruction code
4531 directly similar to the replication slave threads.
4532 */
4533
4534 if (init_new_connection_handler_thread())
4527 {4535 {
4528 close_connection(thd, ER_OUT_OF_RESOURCES);4536 close_connection(thd, ER_OUT_OF_RESOURCES);
4529 statistic_increment(aborted_connects,&LOCK_status);4537 statistic_increment(aborted_connects,&LOCK_status);
4530 MYSQL_CALLBACK(thd->scheduler, end_thread, (thd, 0));4538 one_thread_per_connection_end(thd, 0);
45314539
4532 return(NULL);4540 return(NULL);
4533 }4541 }
@@ -4550,7 +4558,7 @@
4550 {4558 {
4551 close_connection(thd, ER_OUT_OF_RESOURCES);4559 close_connection(thd, ER_OUT_OF_RESOURCES);
4552 statistic_increment(aborted_connects,&LOCK_status);4560 statistic_increment(aborted_connects,&LOCK_status);
4553 MYSQL_CALLBACK(thd->scheduler, end_thread, (thd, 0));4561 one_thread_per_connection_end(thd, 0);
4554 delete thd;4562 delete thd;
45554563
4556 return(NULL);4564 return(NULL);
@@ -4592,23 +4600,13 @@
4592 if (plugins_are_initialized)4600 if (plugins_are_initialized)
4593 {4601 {
4594 net_end(&thd->net);4602 net_end(&thd->net);
4595 MYSQL_CALLBACK(thd->scheduler, end_thread, (thd, 1));4603 one_thread_per_connection_end(thd, 0);
4596 }4604 }
4597 else4605 else
4598 {4606 {
4599 // TODO: lightweight cleanup to get rid of:4607 my_thread_end();
4600 // 'Error in my_thread_global_end(): 2 threads didn't exit'
4601 // at server shutdown
4602 }4608 }
46034609
4604 if (thread_handling > SCHEDULER_ONE_THREAD_PER_CONNECTION)
4605 {
4606 mysql_mutex_lock(&LOCK_thread_count);
4607 delete thd;
4608 thread_count--;
4609 mysql_mutex_unlock(&LOCK_thread_count);
4610 }
4611 my_thread_end();
4612 return(NULL);4610 return(NULL);
4613}4611}
46144612
@@ -4691,7 +4689,8 @@
4691static void wsrep_close_thread(THD *thd)4689static void wsrep_close_thread(THD *thd)
4692{4690{
4693 thd->killed= THD::KILL_CONNECTION;4691 thd->killed= THD::KILL_CONNECTION;
4694 MYSQL_CALLBACK(thd->scheduler, post_kill_notification, (thd));4692 if (!thd->wsrep_applier)
4693 MYSQL_CALLBACK(thd->scheduler, post_kill_notification, (thd));
4695 if (thd->mysys_var)4694 if (thd->mysys_var)
4696 {4695 {
4697 thd->mysys_var->abort=1;4696 thd->mysys_var->abort=1;
@@ -4878,14 +4877,7 @@
4878 // This gotta be fixed in a more elegant manner if we gonna have arbitrary4877 // This gotta be fixed in a more elegant manner if we gonna have arbitrary
4879 // number of non-applier wsrep threads.4878 // number of non-applier wsrep threads.
4880 {4879 {
4881 if (thread_handling > SCHEDULER_ONE_THREAD_PER_CONNECTION)4880 mysql_cond_wait(&COND_thread_count,&LOCK_thread_count);
4882 {
4883 mysql_mutex_unlock(&LOCK_thread_count);
4884 my_sleep(100);
4885 mysql_mutex_lock(&LOCK_thread_count);
4886 }
4887 else
4888 mysql_cond_wait(&COND_thread_count,&LOCK_thread_count);
4889 DBUG_PRINT("quit",("One applier died (count=%u)",thread_count));4881 DBUG_PRINT("quit",("One applier died (count=%u)",thread_count));
4890 }4882 }
4891 mysql_mutex_unlock(&LOCK_thread_count);4883 mysql_mutex_unlock(&LOCK_thread_count);
@@ -4895,14 +4887,7 @@
4895 mysql_mutex_lock(&LOCK_thread_count);4887 mysql_mutex_lock(&LOCK_thread_count);
4896 while (wsrep_running_threads > 0)4888 while (wsrep_running_threads > 0)
4897 {4889 {
4898 if (thread_handling > SCHEDULER_ONE_THREAD_PER_CONNECTION)4890 mysql_cond_wait(&COND_thread_count,&LOCK_thread_count);
4899 {
4900 mysql_mutex_unlock(&LOCK_thread_count);
4901 my_sleep(100);
4902 mysql_mutex_lock(&LOCK_thread_count);
4903 }
4904 else
4905 mysql_cond_wait(&COND_thread_count,&LOCK_thread_count);
4906 DBUG_PRINT("quit",("One thread died (count=%u)",thread_count));4891 DBUG_PRINT("quit",("One thread died (count=%u)",thread_count));
4907 }4892 }
4908 mysql_mutex_unlock(&LOCK_thread_count);4893 mysql_mutex_unlock(&LOCK_thread_count);

Subscribers

People subscribed via source and target branches