LP #1374930: put threads with GLOBAL READ lock (executing ftwrl) into high priority queue

Description

**Reported in Launchpad by zhai weixiang last update 19-09-2016 08:49:57

Version: Percona Server 5.6.19

1. With thread pool enabled:
root@sb 05:49:05>show variables like '%thread%pool%';
---------------------------------------------+

Variable_name

Value

---------------------------------------------+

thread_pool_high_prio_mode

transactions

thread_pool_high_prio_tickets

4294967295

thread_pool_idle_timeout

60

thread_pool_max_threads

100000

thread_pool_oversubscribe

3

thread_pool_size

32

thread_pool_stall_limit

30

---------------------------------------------+
7 rows in set (0.00 sec)

2. start sysbench , with high concurrency updates, for example, 500 threads

3.
root@(none) 05:51:37>flush tables with read lock;
Query OK, 0 rows affected (0.01 sec)

root@(none) 05:51:44>show processlist; ----------- hang in same session.

^C^Z

I think it's better to put threads that own global mdl lock (by executing FLUSH TABLES WITH READ LOCK) into high priority queue.
PS : I am not completely sure if this is the exact reason that lead to hang. Still working on this issue.

Environment

None

Smart Checklist

Activity

Show:

lpjirasync January 23, 2018 at 3:54 PM

lpjirasync January 23, 2018 at 3:54 PM

**Comment from Launchpad by: Laurynas Biveinis on: 29-09-2014 05:37:21

IMHO makes sense

lpjirasync January 23, 2018 at 3:54 PM

**Comment from Launchpad by: zhai weixiang on: 29-09-2014 03:01:28

I think metadata lock should be taken into consideration while deciding if a thread has a high priority.

lpjirasync January 23, 2018 at 3:54 PM

**Comment from Launchpad by: zhai weixiang on: 28-09-2014 10:58:27

A simple patch to prove the problem..

$svn diff sql/threadpool_unix.cc
Index: sql/threadpool_unix.cc
===================================================================
— sql/threadpool_unix.cc (revision 7085)
+++ sql/threadpool_unix.cc (working copy)
@@ -444,7 +444,8 @@

return (mode == TP_HIGH_PRIO_MODE_STATEMENTS) ||
(mode == TP_HIGH_PRIO_MODE_TRANSACTIONS &&

  • c->tickets > 0 && thd_is_transaction_active(c->thd));
    + c->tickets > 0 && thd_is_transaction_active(c->thd)) ||
    + c->thd->global_read_lock.is_acquired();
    }

} // namespace

Done

Details

Assignee

Reporter

Priority

Smart Checklist

Created January 23, 2018 at 3:54 PM
Updated January 23, 2018 at 3:54 PM
Resolved January 23, 2018 at 3:54 PM