Merge lp:~laurynas-biveinis/percona-server/xtradb-thread-priority-flag into lp:percona-server/5.6

Proposed by Laurynas Biveinis
Status: Superseded
Proposed branch: lp:~laurynas-biveinis/percona-server/xtradb-thread-priority-flag
Merge into: lp:percona-server/5.6
Diff against target: 468 lines (+336/-0)
14 files modified
Percona-Server/mysql-test/suite/sys_vars/r/innodb_priority_cleaner_basic.result (+31/-0)
Percona-Server/mysql-test/suite/sys_vars/r/innodb_priority_io_basic.result (+31/-0)
Percona-Server/mysql-test/suite/sys_vars/r/innodb_priority_master_basic.result (+31/-0)
Percona-Server/mysql-test/suite/sys_vars/r/innodb_priority_purge_basic.result (+31/-0)
Percona-Server/mysql-test/suite/sys_vars/t/innodb_priority_cleaner_basic.test (+35/-0)
Percona-Server/mysql-test/suite/sys_vars/t/innodb_priority_io_basic.test (+35/-0)
Percona-Server/mysql-test/suite/sys_vars/t/innodb_priority_master_basic.test (+35/-0)
Percona-Server/mysql-test/suite/sys_vars/t/innodb_priority_purge_basic.test (+35/-0)
Percona-Server/storage/innobase/buf/buf0flu.cc (+2/-0)
Percona-Server/storage/innobase/handler/ha_innodb.cc (+25/-0)
Percona-Server/storage/innobase/include/srv0srv.h (+16/-0)
Percona-Server/storage/innobase/include/univ.i (+6/-0)
Percona-Server/storage/innobase/srv/srv0srv.cc (+22/-0)
Percona-Server/storage/innobase/srv/srv0start.cc (+1/-0)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/xtradb-thread-priority-flag
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Needs Resubmitting
Review via email: mp+186766@code.launchpad.net

This proposal has been superseded by a proposal from 2013-09-26.

Description of the change

Implement thread priority flag
(https://blueprints.launchpad.net/percona-server/+spec/xtradb-thread-priority-flag)
that would be available for InnoDB threads to check whether they
should acquire some shared resource with priority or no. The actual
uses of this flag will be in follow-up.

This flag srv_current_thread_priority is implemented through
thread-local storage. There were two other alternatives considered
for its implementation.
1. Passing the flag value from the DECLARE_THREAD functions to its use
   sites through the callstacks. But such callstacks would be very
   deep and would require patching dozens of InnoDB functions to
   include this new arg.
2. pthread_setspecific()/pthread_getspecific(). This would have the
   advantage of being slightly more portable than TLS, but it's more
   complicated to use: 1) the flag would have to be allocated in
   heap. 2) pthread_key_create() calls through pthread_once() would
   be necessary, moreover they'd have to be placed in mysys instead of
   InnoDB and any affected non-mysys-initializing threads in InnoDB
   would have to be converted to initialize mysys. 3)
   pthread_getspecific() calls would have to happen in very hot code
   paths, such as mutex locking/unlocking code.

Thus TLS appears to be the best option.

Means to change the flag value for individual InnoDB utility threads
are provided for UNIV_PERF_DEBUG or UNIV_DEBUG builds through the new
global dynamic variables innodb_priority_purge, innodb_priority_io,
innodb_priority_cleaner, innodb_priority_master. Added sys_vars tests
for them.

http://jenkins.percona.com/job/percona-server-5.6-param/281/

To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Just make it Linux-specific for now, i.e. so that the system variables only appear in UNIV_LINUX builds, and srv_current_thread_priority is #define'd to 0 otherwise.

Making it truly portable is more complex than just #ifdef __GNUC__, and I will address it later.

But I also don't like reviewing this change in isolation. Please resubmit with the code that actually makes use of srv_current_thread_priority.

review: Needs Resubmitting
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Yes, UNIV_LINUX makes more sense than __GNUC__.

Re. isolation. The whole set of changes would be as follows, in the smallest parts:
- This MP.
- Priority mutex implementation.
- Specific buffer pool free list mutex conversion to priority.
- Non-specific mutex conversion to priority: dict_sys, LRU list, rseg, log.
- Priority rwlatch implementation.
- Non-specific rwlatch conversion to priority: fsp, page_hash, AHI, index, purge.

How this should be distributed among MPs? One big one with everything? Are separate commits OK or one big commit too?

Thanks.

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

1 MP, multiple commits should be fine.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/innodb_priority_cleaner_basic.result'
2--- Percona-Server/mysql-test/suite/sys_vars/r/innodb_priority_cleaner_basic.result 1970-01-01 00:00:00 +0000
3+++ Percona-Server/mysql-test/suite/sys_vars/r/innodb_priority_cleaner_basic.result 2013-09-20 12:09:05 +0000
4@@ -0,0 +1,31 @@
5+SET @start_value = @@GLOBAL.innodb_priority_cleaner;
6+SELECT @@GLOBAL.innodb_priority_cleaner;
7+@@GLOBAL.innodb_priority_cleaner
8+0
9+SELECT @@SESSION.innodb_priority_cleaner;
10+ERROR HY000: Variable 'innodb_priority_cleaner' is a GLOBAL variable
11+SET GLOBAL innodb_priority_cleaner='OFF';
12+SELECT @@GLOBAL.innodb_priority_cleaner;
13+@@GLOBAL.innodb_priority_cleaner
14+0
15+SET GLOBAL innodb_priority_cleaner='ON';
16+SELECT @@GLOBAL.innodb_priority_cleaner;
17+@@GLOBAL.innodb_priority_cleaner
18+1
19+SET GLOBAL innodb_priority_cleaner=0;
20+SELECT @@GLOBAL.innodb_priority_cleaner;
21+@@GLOBAL.innodb_priority_cleaner
22+0
23+SET GLOBAL innodb_priority_cleaner=1;
24+SELECT @@GLOBAL.innodb_priority_cleaner;
25+@@GLOBAL.innodb_priority_cleaner
26+1
27+SET GLOBAL innodb_priority_cleaner=1.1;
28+ERROR 42000: Incorrect argument type to variable 'innodb_priority_cleaner'
29+SET GLOBAL innodb_priority_cleaner=1e1;
30+ERROR 42000: Incorrect argument type to variable 'innodb_priority_cleaner'
31+SET GLOBAL innodb_priority_cleaner=2;
32+ERROR 42000: Variable 'innodb_priority_cleaner' can't be set to the value of '2'
33+SET GLOBAL innodb_priority_cleaner='foo';
34+ERROR 42000: Variable 'innodb_priority_cleaner' can't be set to the value of 'foo'
35+SET GLOBAL innodb_priority_cleaner = @start_value;
36
37=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/innodb_priority_io_basic.result'
38--- Percona-Server/mysql-test/suite/sys_vars/r/innodb_priority_io_basic.result 1970-01-01 00:00:00 +0000
39+++ Percona-Server/mysql-test/suite/sys_vars/r/innodb_priority_io_basic.result 2013-09-20 12:09:05 +0000
40@@ -0,0 +1,31 @@
41+SET @start_value = @@GLOBAL.innodb_priority_io;
42+SELECT @@GLOBAL.innodb_priority_io;
43+@@GLOBAL.innodb_priority_io
44+0
45+SELECT @@SESSION.innodb_priority_io;
46+ERROR HY000: Variable 'innodb_priority_io' is a GLOBAL variable
47+SET GLOBAL innodb_priority_io='OFF';
48+SELECT @@GLOBAL.innodb_priority_io;
49+@@GLOBAL.innodb_priority_io
50+0
51+SET GLOBAL innodb_priority_io='ON';
52+SELECT @@GLOBAL.innodb_priority_io;
53+@@GLOBAL.innodb_priority_io
54+1
55+SET GLOBAL innodb_priority_io=0;
56+SELECT @@GLOBAL.innodb_priority_io;
57+@@GLOBAL.innodb_priority_io
58+0
59+SET GLOBAL innodb_priority_io=1;
60+SELECT @@GLOBAL.innodb_priority_io;
61+@@GLOBAL.innodb_priority_io
62+1
63+SET GLOBAL innodb_priority_io=1.1;
64+ERROR 42000: Incorrect argument type to variable 'innodb_priority_io'
65+SET GLOBAL innodb_priority_io=1e1;
66+ERROR 42000: Incorrect argument type to variable 'innodb_priority_io'
67+SET GLOBAL innodb_priority_io=2;
68+ERROR 42000: Variable 'innodb_priority_io' can't be set to the value of '2'
69+SET GLOBAL innodb_priority_io='foo';
70+ERROR 42000: Variable 'innodb_priority_io' can't be set to the value of 'foo'
71+SET GLOBAL innodb_priority_io = @start_value;
72
73=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/innodb_priority_master_basic.result'
74--- Percona-Server/mysql-test/suite/sys_vars/r/innodb_priority_master_basic.result 1970-01-01 00:00:00 +0000
75+++ Percona-Server/mysql-test/suite/sys_vars/r/innodb_priority_master_basic.result 2013-09-20 12:09:05 +0000
76@@ -0,0 +1,31 @@
77+SET @start_value = @@GLOBAL.innodb_priority_master;
78+SELECT @@GLOBAL.innodb_priority_master;
79+@@GLOBAL.innodb_priority_master
80+0
81+SELECT @@SESSION.innodb_priority_master;
82+ERROR HY000: Variable 'innodb_priority_master' is a GLOBAL variable
83+SET GLOBAL innodb_priority_master='OFF';
84+SELECT @@GLOBAL.innodb_priority_master;
85+@@GLOBAL.innodb_priority_master
86+0
87+SET GLOBAL innodb_priority_master='ON';
88+SELECT @@GLOBAL.innodb_priority_master;
89+@@GLOBAL.innodb_priority_master
90+1
91+SET GLOBAL innodb_priority_master=0;
92+SELECT @@GLOBAL.innodb_priority_master;
93+@@GLOBAL.innodb_priority_master
94+0
95+SET GLOBAL innodb_priority_master=1;
96+SELECT @@GLOBAL.innodb_priority_master;
97+@@GLOBAL.innodb_priority_master
98+1
99+SET GLOBAL innodb_priority_master=1.1;
100+ERROR 42000: Incorrect argument type to variable 'innodb_priority_master'
101+SET GLOBAL innodb_priority_master=1e1;
102+ERROR 42000: Incorrect argument type to variable 'innodb_priority_master'
103+SET GLOBAL innodb_priority_master=2;
104+ERROR 42000: Variable 'innodb_priority_master' can't be set to the value of '2'
105+SET GLOBAL innodb_priority_master='foo';
106+ERROR 42000: Variable 'innodb_priority_master' can't be set to the value of 'foo'
107+SET GLOBAL innodb_priority_master = @start_value;
108
109=== added file 'Percona-Server/mysql-test/suite/sys_vars/r/innodb_priority_purge_basic.result'
110--- Percona-Server/mysql-test/suite/sys_vars/r/innodb_priority_purge_basic.result 1970-01-01 00:00:00 +0000
111+++ Percona-Server/mysql-test/suite/sys_vars/r/innodb_priority_purge_basic.result 2013-09-20 12:09:05 +0000
112@@ -0,0 +1,31 @@
113+SET @start_value = @@GLOBAL.innodb_priority_purge;
114+SELECT @@GLOBAL.innodb_priority_purge;
115+@@GLOBAL.innodb_priority_purge
116+0
117+SELECT @@SESSION.innodb_priority_purge;
118+ERROR HY000: Variable 'innodb_priority_purge' is a GLOBAL variable
119+SET GLOBAL innodb_priority_purge='OFF';
120+SELECT @@GLOBAL.innodb_priority_purge;
121+@@GLOBAL.innodb_priority_purge
122+0
123+SET GLOBAL innodb_priority_purge='ON';
124+SELECT @@GLOBAL.innodb_priority_purge;
125+@@GLOBAL.innodb_priority_purge
126+1
127+SET GLOBAL innodb_priority_purge=0;
128+SELECT @@GLOBAL.innodb_priority_purge;
129+@@GLOBAL.innodb_priority_purge
130+0
131+SET GLOBAL innodb_priority_purge=1;
132+SELECT @@GLOBAL.innodb_priority_purge;
133+@@GLOBAL.innodb_priority_purge
134+1
135+SET GLOBAL innodb_priority_purge=1.1;
136+ERROR 42000: Incorrect argument type to variable 'innodb_priority_purge'
137+SET GLOBAL innodb_priority_purge=1e1;
138+ERROR 42000: Incorrect argument type to variable 'innodb_priority_purge'
139+SET GLOBAL innodb_priority_purge=2;
140+ERROR 42000: Variable 'innodb_priority_purge' can't be set to the value of '2'
141+SET GLOBAL innodb_priority_purge='foo';
142+ERROR 42000: Variable 'innodb_priority_purge' can't be set to the value of 'foo'
143+SET GLOBAL innodb_priority_purge = @start_value;
144
145=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/innodb_priority_cleaner_basic.test'
146--- Percona-Server/mysql-test/suite/sys_vars/t/innodb_priority_cleaner_basic.test 1970-01-01 00:00:00 +0000
147+++ Percona-Server/mysql-test/suite/sys_vars/t/innodb_priority_cleaner_basic.test 2013-09-20 12:09:05 +0000
148@@ -0,0 +1,35 @@
149+--source include/have_debug.inc
150+--source include/have_innodb.inc
151+
152+# A dynamic, global variable
153+
154+SET @start_value = @@GLOBAL.innodb_priority_cleaner;
155+
156+# Default value
157+SELECT @@GLOBAL.innodb_priority_cleaner;
158+
159+# Global only
160+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
161+SELECT @@SESSION.innodb_priority_cleaner;
162+
163+# Correct values
164+SET GLOBAL innodb_priority_cleaner='OFF';
165+SELECT @@GLOBAL.innodb_priority_cleaner;
166+SET GLOBAL innodb_priority_cleaner='ON';
167+SELECT @@GLOBAL.innodb_priority_cleaner;
168+SET GLOBAL innodb_priority_cleaner=0;
169+SELECT @@GLOBAL.innodb_priority_cleaner;
170+SET GLOBAL innodb_priority_cleaner=1;
171+SELECT @@GLOBAL.innodb_priority_cleaner;
172+
173+# Incorrect values
174+--error ER_WRONG_TYPE_FOR_VAR
175+SET GLOBAL innodb_priority_cleaner=1.1;
176+--error ER_WRONG_TYPE_FOR_VAR
177+SET GLOBAL innodb_priority_cleaner=1e1;
178+--error ER_WRONG_VALUE_FOR_VAR
179+SET GLOBAL innodb_priority_cleaner=2;
180+--error ER_WRONG_VALUE_FOR_VAR
181+SET GLOBAL innodb_priority_cleaner='foo';
182+
183+SET GLOBAL innodb_priority_cleaner = @start_value;
184
185=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/innodb_priority_io_basic.test'
186--- Percona-Server/mysql-test/suite/sys_vars/t/innodb_priority_io_basic.test 1970-01-01 00:00:00 +0000
187+++ Percona-Server/mysql-test/suite/sys_vars/t/innodb_priority_io_basic.test 2013-09-20 12:09:05 +0000
188@@ -0,0 +1,35 @@
189+--source include/have_debug.inc
190+--source include/have_innodb.inc
191+
192+# A dynamic, global variable
193+
194+SET @start_value = @@GLOBAL.innodb_priority_io;
195+
196+# Default value
197+SELECT @@GLOBAL.innodb_priority_io;
198+
199+# Global only
200+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
201+SELECT @@SESSION.innodb_priority_io;
202+
203+# Correct values
204+SET GLOBAL innodb_priority_io='OFF';
205+SELECT @@GLOBAL.innodb_priority_io;
206+SET GLOBAL innodb_priority_io='ON';
207+SELECT @@GLOBAL.innodb_priority_io;
208+SET GLOBAL innodb_priority_io=0;
209+SELECT @@GLOBAL.innodb_priority_io;
210+SET GLOBAL innodb_priority_io=1;
211+SELECT @@GLOBAL.innodb_priority_io;
212+
213+# Incorrect values
214+--error ER_WRONG_TYPE_FOR_VAR
215+SET GLOBAL innodb_priority_io=1.1;
216+--error ER_WRONG_TYPE_FOR_VAR
217+SET GLOBAL innodb_priority_io=1e1;
218+--error ER_WRONG_VALUE_FOR_VAR
219+SET GLOBAL innodb_priority_io=2;
220+--error ER_WRONG_VALUE_FOR_VAR
221+SET GLOBAL innodb_priority_io='foo';
222+
223+SET GLOBAL innodb_priority_io = @start_value;
224
225=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/innodb_priority_master_basic.test'
226--- Percona-Server/mysql-test/suite/sys_vars/t/innodb_priority_master_basic.test 1970-01-01 00:00:00 +0000
227+++ Percona-Server/mysql-test/suite/sys_vars/t/innodb_priority_master_basic.test 2013-09-20 12:09:05 +0000
228@@ -0,0 +1,35 @@
229+--source include/have_debug.inc
230+--source include/have_innodb.inc
231+
232+# A dynamic, global variable
233+
234+SET @start_value = @@GLOBAL.innodb_priority_master;
235+
236+# Default value
237+SELECT @@GLOBAL.innodb_priority_master;
238+
239+# Global only
240+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
241+SELECT @@SESSION.innodb_priority_master;
242+
243+# Correct values
244+SET GLOBAL innodb_priority_master='OFF';
245+SELECT @@GLOBAL.innodb_priority_master;
246+SET GLOBAL innodb_priority_master='ON';
247+SELECT @@GLOBAL.innodb_priority_master;
248+SET GLOBAL innodb_priority_master=0;
249+SELECT @@GLOBAL.innodb_priority_master;
250+SET GLOBAL innodb_priority_master=1;
251+SELECT @@GLOBAL.innodb_priority_master;
252+
253+# Incorrect values
254+--error ER_WRONG_TYPE_FOR_VAR
255+SET GLOBAL innodb_priority_master=1.1;
256+--error ER_WRONG_TYPE_FOR_VAR
257+SET GLOBAL innodb_priority_master=1e1;
258+--error ER_WRONG_VALUE_FOR_VAR
259+SET GLOBAL innodb_priority_master=2;
260+--error ER_WRONG_VALUE_FOR_VAR
261+SET GLOBAL innodb_priority_master='foo';
262+
263+SET GLOBAL innodb_priority_master = @start_value;
264
265=== added file 'Percona-Server/mysql-test/suite/sys_vars/t/innodb_priority_purge_basic.test'
266--- Percona-Server/mysql-test/suite/sys_vars/t/innodb_priority_purge_basic.test 1970-01-01 00:00:00 +0000
267+++ Percona-Server/mysql-test/suite/sys_vars/t/innodb_priority_purge_basic.test 2013-09-20 12:09:05 +0000
268@@ -0,0 +1,35 @@
269+--source include/have_debug.inc
270+--source include/have_innodb.inc
271+
272+# A dynamic, global variable
273+
274+SET @start_value = @@GLOBAL.innodb_priority_purge;
275+
276+# Default value
277+SELECT @@GLOBAL.innodb_priority_purge;
278+
279+# Global only
280+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
281+SELECT @@SESSION.innodb_priority_purge;
282+
283+# Correct values
284+SET GLOBAL innodb_priority_purge='OFF';
285+SELECT @@GLOBAL.innodb_priority_purge;
286+SET GLOBAL innodb_priority_purge='ON';
287+SELECT @@GLOBAL.innodb_priority_purge;
288+SET GLOBAL innodb_priority_purge=0;
289+SELECT @@GLOBAL.innodb_priority_purge;
290+SET GLOBAL innodb_priority_purge=1;
291+SELECT @@GLOBAL.innodb_priority_purge;
292+
293+# Incorrect values
294+--error ER_WRONG_TYPE_FOR_VAR
295+SET GLOBAL innodb_priority_purge=1.1;
296+--error ER_WRONG_TYPE_FOR_VAR
297+SET GLOBAL innodb_priority_purge=1e1;
298+--error ER_WRONG_VALUE_FOR_VAR
299+SET GLOBAL innodb_priority_purge=2;
300+--error ER_WRONG_VALUE_FOR_VAR
301+SET GLOBAL innodb_priority_purge='foo';
302+
303+SET GLOBAL innodb_priority_purge = @start_value;
304
305=== modified file 'Percona-Server/storage/innobase/buf/buf0flu.cc'
306--- Percona-Server/storage/innobase/buf/buf0flu.cc 2013-09-20 05:27:28 +0000
307+++ Percona-Server/storage/innobase/buf/buf0flu.cc 2013-09-20 12:09:05 +0000
308@@ -2441,6 +2441,8 @@
309
310 while (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
311
312+ srv_current_thread_priority = srv_cleaner_thread_priority;
313+
314 /* The page_cleaner skips sleep if the server is
315 idle and there are no pending IOs in the buffer pool
316 and there is work to do. */
317
318=== modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc'
319--- Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-09-20 05:27:28 +0000
320+++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-09-20 12:09:05 +0000
321@@ -16471,6 +16471,27 @@
322 PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
323 "Number of pages reserved in doublewrite buffer for batch flushing",
324 NULL, NULL, 120, 1, 127, 0);
325+
326+static MYSQL_SYSVAR_BOOL(priority_purge, srv_purge_thread_priority,
327+ PLUGIN_VAR_OPCMDARG,
328+ "Make purge coordinator and worker threads acquire shared resources with "
329+ "priority", NULL, NULL, FALSE);
330+
331+static MYSQL_SYSVAR_BOOL(priority_io, srv_io_thread_priority,
332+ PLUGIN_VAR_OPCMDARG,
333+ "Make I/O threads acquire shared resources with priority",
334+ NULL, NULL, FALSE);
335+
336+static MYSQL_SYSVAR_BOOL(priority_cleaner, srv_cleaner_thread_priority,
337+ PLUGIN_VAR_OPCMDARG,
338+ "Make buffer pool cleaner thread acquire shared resources with priority",
339+ NULL, NULL, FALSE);
340+
341+static MYSQL_SYSVAR_BOOL(priority_master, srv_master_thread_priority,
342+ PLUGIN_VAR_OPCMDARG,
343+ "Make buffer pool cleaner thread acquire shared resources with priority",
344+ NULL, NULL, FALSE);
345+
346 #endif /* defined UNIV_DEBUG || defined UNIV_PERF_DEBUG */
347
348 static MYSQL_SYSVAR_LONG(buffer_pool_instances, innobase_buffer_pool_instances,
349@@ -17125,6 +17146,10 @@
350 #if defined UNIV_DEBUG || defined UNIV_PERF_DEBUG
351 MYSQL_SYSVAR(page_hash_locks),
352 MYSQL_SYSVAR(doublewrite_batch_size),
353+ MYSQL_SYSVAR(priority_purge),
354+ MYSQL_SYSVAR(priority_io),
355+ MYSQL_SYSVAR(priority_cleaner),
356+ MYSQL_SYSVAR(priority_master),
357 #endif /* defined UNIV_DEBUG || defined UNIV_PERF_DEBUG */
358 MYSQL_SYSVAR(print_all_deadlocks),
359 MYSQL_SYSVAR(cmp_per_index_enabled),
360
361=== modified file 'Percona-Server/storage/innobase/include/srv0srv.h'
362--- Percona-Server/storage/innobase/include/srv0srv.h 2013-08-06 15:16:34 +0000
363+++ Percona-Server/storage/innobase/include/srv0srv.h 2013-09-20 12:09:05 +0000
364@@ -479,6 +479,22 @@
365 extern const char* srv_io_thread_op_info[];
366 extern const char* srv_io_thread_function[];
367
368+/* The relative priority of the current thread. If 0, low priority; if 1, high
369+priority. */
370+extern UNIV_THREAD_LOCAL ulint srv_current_thread_priority;
371+
372+/* The relative priority of the purge coordinator and worker threads. */
373+extern my_bool srv_purge_thread_priority;
374+
375+/* The relative priority of the I/O threads. */
376+extern my_bool srv_io_thread_priority;
377+
378+/* The relative priority of the cleaner thread. */
379+extern my_bool srv_cleaner_thread_priority;
380+
381+/* The relative priority of the master thread. */
382+extern my_bool srv_master_thread_priority;
383+
384 /* the number of purge threads to use from the worker pool (currently 0 or 1) */
385 extern ulong srv_n_purge_threads;
386
387
388=== modified file 'Percona-Server/storage/innobase/include/univ.i'
389--- Percona-Server/storage/innobase/include/univ.i 2013-08-29 17:05:40 +0000
390+++ Percona-Server/storage/innobase/include/univ.i 2013-09-20 12:09:05 +0000
391@@ -277,6 +277,12 @@
392 # define UNIV_COLD /* empty */
393 #endif
394
395+#if defined(__GNUC__)
396+# define UNIV_THREAD_LOCAL __thread
397+#else
398+# error "Please define the TLS storage specifier for your platform"
399+#endif
400+
401 #ifndef UNIV_MUST_NOT_INLINE
402 /* Definition for inline version */
403
404
405=== modified file 'Percona-Server/storage/innobase/srv/srv0srv.cc'
406--- Percona-Server/storage/innobase/srv/srv0srv.cc 2013-09-02 12:24:08 +0000
407+++ Percona-Server/storage/innobase/srv/srv0srv.cc 2013-09-20 12:09:05 +0000
408@@ -319,6 +319,22 @@
409 /* Number of iterations over which adaptive flushing is averaged. */
410 UNIV_INTERN ulong srv_flushing_avg_loops = 30;
411
412+/* The relative priority of the current thread. If 0, low priority; if 1, high
413+priority. */
414+UNIV_INTERN UNIV_THREAD_LOCAL ulint srv_current_thread_priority = 0;
415+
416+/* The relative priority of the purge coordinator and worker threads. */
417+UNIV_INTERN my_bool srv_purge_thread_priority = FALSE;
418+
419+/* The relative priority of the I/O threads. */
420+UNIV_INTERN my_bool srv_io_thread_priority = FALSE;
421+
422+/* The relative priority of the cleaner thread. */
423+UNIV_INTERN my_bool srv_cleaner_thread_priority = FALSE;
424+
425+/* The relative priority of the master thread. */
426+UNIV_INTERN my_bool srv_master_thread_priority = FALSE;
427+
428 /* The number of purge threads to use.*/
429 UNIV_INTERN ulong srv_n_purge_threads = 1;
430
431@@ -2857,6 +2873,8 @@
432
433 MONITOR_INC(MONITOR_MASTER_THREAD_SLEEP);
434
435+ srv_current_thread_priority = srv_master_thread_priority;
436+
437 if (srv_check_activity(old_activity_count)) {
438 old_activity_count = srv_get_activity_count();
439 srv_master_do_active_tasks();
440@@ -2997,6 +3015,8 @@
441
442 os_event_wait(slot->event);
443
444+ srv_current_thread_priority = srv_purge_thread_priority;
445+
446 if (srv_task_execute()) {
447
448 /* If there are tasks in the queue, wakeup
449@@ -3273,6 +3293,8 @@
450
451 n_total_purged = 0;
452
453+ srv_current_thread_priority = srv_purge_thread_priority;
454+
455 rseg_history_len = srv_do_purge(
456 srv_n_purge_threads, &n_total_purged);
457
458
459=== modified file 'Percona-Server/storage/innobase/srv/srv0start.cc'
460--- Percona-Server/storage/innobase/srv/srv0start.cc 2013-08-14 03:57:21 +0000
461+++ Percona-Server/storage/innobase/srv/srv0start.cc 2013-09-20 12:09:05 +0000
462@@ -476,6 +476,7 @@
463 #endif /* UNIV_PFS_THREAD */
464
465 while (srv_shutdown_state != SRV_SHUTDOWN_EXIT_THREADS) {
466+ srv_current_thread_priority = srv_io_thread_priority;
467 fil_aio_wait(segment);
468 }
469

Subscribers

People subscribed via source and target branches