Essays: what is MYSQL_BIN_LOG::COND_done
First, problems
What is it
Welcome to my "in-depth understanding of MySQL Master and Slave principle 32", as follows:
If the picture cannot be displayed, please see the following link:
Https://www.jianshu.com/p/d636215d767f
Second, find the location of influence
The whole search process should find the value of key_BINLOG_COND_done, and then go to see where it is defined on the corresponding mutex/cond, and then find the role of mutex/cond.
Definition:
Static PSI_cond_info all_server_conds [] =
{
{& key_PAGE_cond, "PAGE::cond", 0}
{& key_COND_active, "TC_LOG_MMAP::COND_active", 0}
{& key_COND_pool, "TC_LOG_MMAP::COND_pool", 0}
{& key_BINLOG_COND_done, "MYSQL_BIN_LOG::COND_done", 0}
{& key_BINLOG_update_cond, "MYSQL_BIN_LOG::update_cond", 0}
Registration:
Register_cond_class
Initialize:
MYSQL_BIN_LOG::set_psi_keys
Establish a condition variable:
Stage_manager::init
Use: * / if (! leader) / / if it is not leader {mysql_mutex_lock (& m_lock_done); / / Lock while (thd- > get_transaction ()-> m_flags.pending) / / set the state of everything to ture mysql_cond_wait (& m_cond_done, & m_lock_done) when you wake up; / / release the lock waiting condition to meet pending=false mysql_mutex_unlock (& m_lock_done) / / unlock} stack frame Breakpoint 2, MYSQL_BIN_LOG::set_psi_keys (this=0x2e83640, key_LOCK_index=7, key_LOCK_commit=3, key_LOCK_commit_queue=4, key_LOCK_done=5, key_LOCK_flush_queue=6, key_LOCK_log=8, key_LOCK_binlog_end_pos=9, key_LOCK_sync=10, key_LOCK_sync_queue=11, key_LOCK_xids=12, key_COND_done=4, key_update_cond=5, key_prep_xids_cond=6, key_file_log=2 Key_file_log_index=4, key_file_log_cache=3, key_file_log_index_cache=5) at / mysqldata/percona-server-locks-detail-5.7.22/sql/binlog.h:539539 masks keyword CONDUBG = key_COND_done Bt#0 MYSQL_BIN_LOG::set_psi_keys (this=0x2e83640, key_LOCK_index=7, key_LOCK_commit=3, key_LOCK_commit_queue=4, key_LOCK_done=5, key_LOCK_flush_queue=6, key_LOCK_log=8, key_LOCK_binlog_end_pos=9, key_LOCK_sync=10, key_LOCK_sync_queue=11, key_LOCK_xids=12, key_COND_done=4, key_update_cond=5, key_prep_xids_cond=6, key_file_log=2, key_file_log_index=4) Key_file_log_cache=3, key_file_log_index_cache=5) at / mysqldata/percona-server-locks-detail-5.7.22/sql/binlog.h:539#1 0x0000000000edcee4 in init_common_variables () at / mysqldata/percona-server-locks-detail-5.7.22/sql/mysqld.cc:2974#2 0x0000000000ee117f in mysqld_main (argc=82, argv=0x2f26738) at / mysqldata/percona-server-locks-detail-5.7.22/sql/mysqld.cc:4938#3 0x0000000000ed8504 in main (argc=4 Argv=0x7fffffffe3f8) at / mysqldata/percona-server-locks-detail-5.7.22/sql/main.cc:25 establish conditional variables Breakpoint 3, Stage_manager::init (this=0x2e84858, key_LOCK_flush_queue=6, key_LOCK_sync_queue=11, key_LOCK_commit_queue=4, key_LOCK_done=5, key_COND_done=4) at / mysqldata/percona-server-locks-detail-5.7.22/sql/binlog.h:156156 mysql_mutex_init (key_LOCK_done, & m_lock_done) MY_MUTEX_INIT_FAST) (gdb) bt#0 Stage_manager::init (this=0x2e84858, key_LOCK_flush_queue=6, key_LOCK_sync_queue=11, key_LOCK_commit_queue=4, key_LOCK_done=5 Key_COND_done=4) at / mysqldata/percona-server-locks-detail-5.7.22/sql/binlog.h:156#1 0x000000000187cbea in MYSQL_BIN_LOG::init_pthread_objects (this=0x2e83640) at / mysqldata/percona-server-locks-detail-5.7.22/sql/binlog.cc:3601#2 0x0000000000edcef3 in init_common_variables () at / mysqldata/percona-server-locks-detail-5.7.22/sql/mysqld.cc:2983#3 0x0000000000ee117f in mysqld_main (argc=82 Argv=0x2f26738) at / mysqldata/percona-server-locks-detail-5.7.22/sql/mysqld.cc:4938#4 0x0000000000ed8504 in main (argc=4, argv=0x7fffffffe3f8) at / mysqldata/percona-server-locks-detail-5.7.22/sql/main.cc:25