From: Pedro Gomes Date: January 15 2013 2:47pm Subject: bzr push into mysql-trunk branch (pedro.gomes:5381 to 5382) Bug#14678248 List-Archive: http://lists.mysql.com/commits/145612 X-Bug: 14678248 Message-Id: <20130115144712.18673.83964.5382@pgomes-ThinkPad> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 5382 Pedro Gomes 2013-01-15 Bug#14678248: SLAVE_OPEN_TEMP_TABLES_LOCK INITIALIZED MULTIPLE TIMES The slave_open_temp_tables_lock can currently be initialized multiple times because this action is made on the Relay_log_info constructor. In fact, this constructor is not only used by the SQL thread itself but also by clients to execute Binlog statements where dummy relay log info objects are needed. Not belonging to the class, the double initialization of this lock can be problematic. Guaranteeing that the lock is only initialized on the relay log info object that belongs to the SQL thread solves this issue. modified: sql/rpl_info_factory.cc sql/rpl_rli.cc sql/rpl_rli.h sql/rpl_rli_pdb.cc 5381 Manish Kumar 2013-01-15 WL#6404 - Add rewrite-db option to mysqlbinlog on RBR Added a new option to mysqlbinlog to rewrite from-db to to-db so that the row events can be applied to the new database (ie. to_db). Also the use is suppressed incase the new option is used. Usage : ./mysqlbinlog --rewrite-db='from_db->to_db" added: mysql-test/suite/binlog/r/binlog_mysqlbinlog_rewrite_db.result mysql-test/suite/binlog/r/binlog_rewrite_db_noleak.result mysql-test/suite/binlog/r/binlog_rewrite_suppress_use.result mysql-test/suite/binlog/t/binlog_mysqlbinlog_rewrite_db.test mysql-test/suite/binlog/t/binlog_rewrite_db_noleak.test mysql-test/suite/binlog/t/binlog_rewrite_suppress_use.test modified: client/client_priv.h client/mysqlbinlog.cc sql/log_event.cc sql/log_event.h === modified file 'sql/rpl_info_factory.cc' --- a/sql/rpl_info_factory.cc revid:manish.4.kumar@stripped +++ b/sql/rpl_info_factory.cc revid:pedro.gomes@stripped @@ -225,7 +225,9 @@ Relay_log_info *Rpl_info_factory::create &key_relay_log_info_stop_cond, &key_relay_log_info_sleep_cond #endif - , instances + , instances, + (rli_option != INFO_REPOSITORY_TABLE + && rli_option != INFO_REPOSITORY_FILE) ))) { msg= msg_alloc; === modified file 'sql/rpl_rli.cc' --- a/sql/rpl_rli.cc revid:manish.4.kumar@stripped +++ b/sql/rpl_rli.cc revid:pedro.gomes@stripped @@ -63,7 +63,7 @@ Relay_log_info::Relay_log_info(bool is_s PSI_mutex_key *param_key_info_stop_cond, PSI_mutex_key *param_key_info_sleep_cond #endif - , uint param_id + , uint param_id, bool is_rli_fake ) :Rpl_info("SQL" #ifdef HAVE_PSI_INTERFACE @@ -81,6 +81,7 @@ Relay_log_info::Relay_log_info(bool is_s cur_log_old_open_count(0), group_relay_log_pos(0), event_relay_log_pos(0), group_master_log_pos(0), gtid_set(global_sid_map, global_sid_lock), + rli_fake(is_rli_fake), is_group_master_log_pos_invalid(false), log_space_total(0), ignore_log_space_limit(0), sql_force_rotate_relay(false), @@ -128,13 +129,18 @@ Relay_log_info::Relay_log_info(bool is_s memset(&cache_buf, 0, sizeof(cache_buf)); cached_charset_invalidate(); + if(!rli_fake) + { + my_atomic_rwlock_init(&slave_open_temp_tables_lock); + } + + mysql_mutex_init(key_relay_log_info_log_space_lock, &log_space_lock, MY_MUTEX_INIT_FAST); mysql_cond_init(key_relay_log_info_log_space_cond, &log_space_cond, NULL); mysql_mutex_init(key_mutex_slave_parallel_pend_jobs, &pending_jobs_lock, MY_MUTEX_INIT_FAST); mysql_cond_init(key_cond_slave_parallel_pend_jobs, &pending_jobs_cond, NULL); - my_atomic_rwlock_init(&slave_open_temp_tables_lock); relay_log.init_pthread_objects(); do_server_version_split(::server_version, slave_version_split); @@ -175,7 +181,12 @@ Relay_log_info::~Relay_log_info() mysql_cond_destroy(&log_space_cond); mysql_mutex_destroy(&pending_jobs_lock); mysql_cond_destroy(&pending_jobs_cond); - my_atomic_rwlock_destroy(&slave_open_temp_tables_lock); + + if(!rli_fake) + { + my_atomic_rwlock_destroy(&slave_open_temp_tables_lock); + } + relay_log.cleanup(); set_rli_description_event(NULL); === modified file 'sql/rpl_rli.h' --- a/sql/rpl_rli.h revid:manish.4.kumar@stripped +++ b/sql/rpl_rli.h revid:pedro.gomes@stripped @@ -240,6 +240,14 @@ protected: private: Gtid_set gtid_set; + /* + Identifies when this object belongs to the SQL thread and was not + created for a client thread or some other purpose including + Slave_worker instance initializations. Ends up serving the same + purpose as the belongs_to_client method, but its value is set + earlier on in the class constructor. + */ + bool rli_fake; public: int add_logged_gtid(rpl_sidno sidno, rpl_gno gno) @@ -848,7 +856,7 @@ public: PSI_mutex_key *param_key_info_stop_cond, PSI_mutex_key *param_key_info_sleep_cond #endif - , uint param_id + , uint param_id, bool is_rli_fake ); virtual ~Relay_log_info(); === modified file 'sql/rpl_rli_pdb.cc' --- a/sql/rpl_rli_pdb.cc revid:manish.4.kumar@stripped +++ b/sql/rpl_rli_pdb.cc revid:pedro.gomes@stripped @@ -86,7 +86,7 @@ Slave_worker::Slave_worker(Relay_log_inf param_key_info_data_cond, param_key_info_start_cond, param_key_info_stop_cond, param_key_info_sleep_cond #endif - , param_id + 1 + , param_id + 1, true ), c_rli(rli), id(param_id), checkpoint_relay_log_pos(0), checkpoint_master_log_pos(0), checkpoint_seqno(0), running_status(NOT_RUNNING) No bundle (reason: useless for push emails).