Bug #69270 Needn't execute srv_wake_master_thread while executing drop/truncate table
Submitted: 17 May 2013 15:56 Modified: 3 Apr 2018 16:17
Reporter: zhai weixiang (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.6.11 OS:Any
Assigned to: CPU Architecture:Any

[17 May 2013 15:56] zhai weixiang
Description:
srv_wake_master_thread() may not need to be called while executing drop/truncate table.

In MySQL5.6.11, the master thread will only sleep and never be suspended (only two exception: innodb_force_recovery>= 2 or the server is being shutdown ):

quoted code in srv_master_thread:

2332 loop:
2333         if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND) {
2334                 goto suspend_thread;
2335         }
2336
2337         while (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
2338 
2339                 srv_master_sleep();
2340 
2341                 MONITOR_INC(MONITOR_MASTER_THREAD_SLEEP);
2342 
2343                 if (srv_check_activity(old_activity_count)) {
2344                         old_activity_count = srv_get_activity_count();
2345                         srv_master_do_active_tasks();
2346                 } else {
2347                         srv_master_do_idle_tasks();
2348                 }
2349         }

While executing DROP/TRUNCATE table , srv_wake_master_thread was always called:

backtrace of truncate  table: 
ha_innobase::truncate->row_truncate_table_for_mysql->srv_wake_master_thread
backtrace of drop table: 
ha_innobase::delete_table->row_drop_table_for_mysql->srv_wake_master_thread

In function srv_wake_master_thread, srv_release_threads(SRV_MASTER, 1) was called and it will acquire srv_sys->mutex to check if the master thread is suspened and  wake up it .

I think srv_release_threads(SRV_MASTER, 1) is not need to be called in most situation.

How to repeat:
just read the related code 

Suggested fix:
I don't know...
[17 May 2013 16:04] zhai weixiang
edit the Synopsis
[22 Jul 2013 3:15] zhai weixiang
any suggestion?  If I was wrong , please close this bug report :-)
[3 Apr 2018 16:17] MySQL Verification Team
Hi!

Thank you very much. 

5.6 version will not get any changes in this respect. Hence, closed ....