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
1=== removed symlink 'build'
2=== target was u'build-ps'
3=== modified file 'sql/mysqld.cc'
4--- sql/mysqld.cc 2014-04-30 02:30:49 +0000
5+++ sql/mysqld.cc 2014-06-26 18:26:28 +0000
6@@ -4523,11 +4523,19 @@
7
8 mysql_thread_set_psi_id(thd->thread_id);
9 thd->thr_create_utime= my_micro_time();
10- if (MYSQL_CALLBACK_ELSE(thd->scheduler, init_new_connection_thread, (), 0))
11+
12+ /*
13+ Don't use thd->scheduler methods to initialize and destroy wsrep threads,
14+ as these threads are not managed by the scheduler specified with the
15+ thread_handling option. Instead execute initialization/destruction code
16+ directly similar to the replication slave threads.
17+ */
18+
19+ if (init_new_connection_handler_thread())
20 {
21 close_connection(thd, ER_OUT_OF_RESOURCES);
22 statistic_increment(aborted_connects,&LOCK_status);
23- MYSQL_CALLBACK(thd->scheduler, end_thread, (thd, 0));
24+ one_thread_per_connection_end(thd, 0);
25
26 return(NULL);
27 }
28@@ -4550,7 +4558,7 @@
29 {
30 close_connection(thd, ER_OUT_OF_RESOURCES);
31 statistic_increment(aborted_connects,&LOCK_status);
32- MYSQL_CALLBACK(thd->scheduler, end_thread, (thd, 0));
33+ one_thread_per_connection_end(thd, 0);
34 delete thd;
35
36 return(NULL);
37@@ -4592,23 +4600,13 @@
38 if (plugins_are_initialized)
39 {
40 net_end(&thd->net);
41- MYSQL_CALLBACK(thd->scheduler, end_thread, (thd, 1));
42+ one_thread_per_connection_end(thd, 0);
43 }
44 else
45 {
46- // TODO: lightweight cleanup to get rid of:
47- // 'Error in my_thread_global_end(): 2 threads didn't exit'
48- // at server shutdown
49+ my_thread_end();
50 }
51
52- if (thread_handling > SCHEDULER_ONE_THREAD_PER_CONNECTION)
53- {
54- mysql_mutex_lock(&LOCK_thread_count);
55- delete thd;
56- thread_count--;
57- mysql_mutex_unlock(&LOCK_thread_count);
58- }
59- my_thread_end();
60 return(NULL);
61 }
62
63@@ -4691,7 +4689,8 @@
64 static void wsrep_close_thread(THD *thd)
65 {
66 thd->killed= THD::KILL_CONNECTION;
67- MYSQL_CALLBACK(thd->scheduler, post_kill_notification, (thd));
68+ if (!thd->wsrep_applier)
69+ MYSQL_CALLBACK(thd->scheduler, post_kill_notification, (thd));
70 if (thd->mysys_var)
71 {
72 thd->mysys_var->abort=1;
73@@ -4878,14 +4877,7 @@
74 // This gotta be fixed in a more elegant manner if we gonna have arbitrary
75 // number of non-applier wsrep threads.
76 {
77- if (thread_handling > SCHEDULER_ONE_THREAD_PER_CONNECTION)
78- {
79- mysql_mutex_unlock(&LOCK_thread_count);
80- my_sleep(100);
81- mysql_mutex_lock(&LOCK_thread_count);
82- }
83- else
84- mysql_cond_wait(&COND_thread_count,&LOCK_thread_count);
85+ mysql_cond_wait(&COND_thread_count,&LOCK_thread_count);
86 DBUG_PRINT("quit",("One applier died (count=%u)",thread_count));
87 }
88 mysql_mutex_unlock(&LOCK_thread_count);
89@@ -4895,14 +4887,7 @@
90 mysql_mutex_lock(&LOCK_thread_count);
91 while (wsrep_running_threads > 0)
92 {
93- if (thread_handling > SCHEDULER_ONE_THREAD_PER_CONNECTION)
94- {
95- mysql_mutex_unlock(&LOCK_thread_count);
96- my_sleep(100);
97- mysql_mutex_lock(&LOCK_thread_count);
98- }
99- else
100- mysql_cond_wait(&COND_thread_count,&LOCK_thread_count);
101+ mysql_cond_wait(&COND_thread_count,&LOCK_thread_count);
102 DBUG_PRINT("quit",("One thread died (count=%u)",thread_count));
103 }
104 mysql_mutex_unlock(&LOCK_thread_count);

Subscribers

People subscribed via source and target branches