3038 Alfranio Correia 2010-09-17
Removed static allocation of workers.
@ sql/mysqld.cc
Removed static allocation of workers.
modified:
sql/mysqld.cc
sql/mysqld.h
sql/rpl_rli.cc
sql/rpl_rli.h
3037 Alfranio Correia 2010-09-16
Reported errors while getting a valid worker to execut events.
modified:
sql/log_event.cc
sql/log_event.h
sql/rpl_rli.cc
sql/rpl_rli.h
sql/rpl_rli_pdb.cc
sql/rpl_rli_pdb.h
sql/rpl_slave.cc
=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc 2010-09-15 01:39:03 +0000
+++ b/sql/mysqld.cc 2010-09-17 00:50:31 +0000
@@ -7830,9 +7830,6 @@ PSI_mutex_key key_BINLOG_LOCK_index, key
key_LOCK_error_messages, key_LOG_INFO_lock, key_LOCK_thread_count,
key_PARTITION_LOCK_auto_inc;
-PSI_mutex_key key_mutex_slave_parallel_worker[16]; // mts-II (todo: make dynamic)
-PSI_mutex_key key_mutex_slave_parallel_pend_jobs;
-
static PSI_mutex_info all_server_mutexes[]=
{
#ifdef HAVE_MMAP
@@ -7875,11 +7872,6 @@ static PSI_mutex_info all_server_mutexes
{ &key_mutex_slave_reporting_capability_err_lock, "Slave_reporting_capability::err_lock", 0},
{ &key_relay_log_info_data_lock, "Relay_log_info::data_lock", 0},
{ &key_relay_log_info_log_space_lock, "Relay_log_info::log_space_lock", 0},
- { &key_mutex_slave_parallel_worker[0], "struct slave_worker::jobs_lock", 0}, // mts-II:
- { &key_mutex_slave_parallel_worker[1], "struct slave_worker::jobs_lock", 0}, // redo
- { &key_mutex_slave_parallel_worker[2], "struct slave_worker::jobs_lock", 0},
- { &key_mutex_slave_parallel_worker[3], "struct slave_worker::jobs_lock", 0},
- { &key_mutex_slave_parallel_pend_jobs, "Relay_log_info::pending_jobs_lock", 0},
{ &key_relay_log_info_run_lock, "Relay_log_info::run_lock", 0},
{ &key_structure_guard_mutex, "Query_cache::structure_guard_mutex", 0},
{ &key_TABLE_SHARE_LOCK_ha_data, "TABLE_SHARE::LOCK_ha_data", 0},
@@ -7921,9 +7913,6 @@ PSI_cond_key key_BINLOG_COND_prep_xids,
key_TABLE_SHARE_cond, key_user_level_lock_cond,
key_COND_thread_count, key_COND_thread_cache, key_COND_flush_thread_cache;
-PSI_cond_key key_cond_slave_parallel_worker[16]; // mts-II (todo: make dynamic)
-PSI_cond_key key_cond_slave_parallel_pend_jobs;
-
static PSI_cond_info all_server_conds[]=
{
#if (defined(_WIN32) || defined(HAVE_SMEM)) && !defined(EMBEDDED_LIBRARY)
@@ -7950,11 +7939,6 @@ static PSI_cond_info all_server_conds[]=
{ &key_relay_log_info_log_space_cond, "Relay_log_info::log_space_cond", 0},
{ &key_relay_log_info_start_cond, "Relay_log_info::start_cond", 0},
{ &key_relay_log_info_stop_cond, "Relay_log_info::stop_cond", 0},
- { &key_cond_slave_parallel_worker[0], "struct slave_worker::jobs_cond", 0}, // mts-II:
- { &key_cond_slave_parallel_worker[1], "struct slave_worker::jobs_cond", 0}, // redo
- { &key_cond_slave_parallel_worker[2], "struct slave_worker::jobs_cond", 0},
- { &key_cond_slave_parallel_worker[3], "struct slave_worker::jobs_cond", 0},
- { &key_cond_slave_parallel_pend_jobs, "Relay_log_info::pending_jobs_cond", 0},
{ &key_TABLE_SHARE_cond, "TABLE_SHARE::cond", 0},
{ &key_user_level_lock_cond, "User_level_lock::cond", 0},
{ &key_COND_thread_count, "COND_thread_count", PSI_FLAG_GLOBAL},
=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h 2010-09-09 18:43:16 +0000
+++ b/sql/mysqld.h 2010-09-17 00:50:31 +0000
@@ -244,8 +244,6 @@ extern PSI_mutex_key key_BINLOG_LOCK_ind
key_structure_guard_mutex, key_TABLE_SHARE_LOCK_ha_data,
key_LOCK_error_messages, key_LOCK_thread_count, key_PARTITION_LOCK_auto_inc;
-extern PSI_mutex_key key_mutex_slave_parallel_worker[16]; // mts: redo
-extern PSI_mutex_key key_mutex_slave_parallel_pend_jobs;
extern PSI_rwlock_key key_rwlock_LOCK_grant, key_rwlock_LOCK_logger,
key_rwlock_LOCK_sys_init_connect, key_rwlock_LOCK_sys_init_slave,
key_rwlock_LOCK_system_variables_hash, key_rwlock_query_cache_query_lock;
@@ -265,9 +263,6 @@ extern PSI_cond_key key_BINLOG_COND_prep
key_TABLE_SHARE_cond, key_user_level_lock_cond,
key_COND_thread_count, key_COND_thread_cache, key_COND_flush_thread_cache;
-extern PSI_cond_key key_cond_slave_parallel_worker[16]; // mts: redo
-extern PSI_cond_key key_cond_slave_parallel_pend_jobs;
-
extern PSI_thread_key key_thread_bootstrap, key_thread_delayed_insert,
key_thread_handle_manager, key_thread_kill_server, key_thread_main,
key_thread_one_connection, key_thread_signal_hand;
=== modified file 'sql/rpl_rli.cc'
--- a/sql/rpl_rli.cc 2010-09-16 19:29:26 +0000
+++ b/sql/rpl_rli.cc 2010-09-17 00:50:31 +0000
@@ -46,6 +46,15 @@ const char* info_rli_fields[]=
const char *const Relay_log_info::state_delaying_string = "Waiting until MASTER_DELAY seconds after master executed event";
+static PSI_mutex_info *worker_mutexes= NULL;
+static PSI_cond_info *worker_conds= NULL;
+
+PSI_mutex_key *key_mutex_slave_parallel_worker= NULL;
+PSI_mutex_key key_mutex_slave_parallel_pend_jobs;
+
+PSI_cond_key *key_cond_slave_parallel_worker= NULL;
+PSI_cond_key key_cond_slave_parallel_pend_jobs;
+
Relay_log_info::Relay_log_info(bool is_slave_recovery,
PSI_mutex_key *param_key_info_run_lock,
PSI_mutex_key *param_key_info_data_lock,
@@ -85,12 +94,7 @@ Relay_log_info::Relay_log_info(bool is_s
whether the feature is or going to be active or not.
*/
trans_jobs= stmt_jobs= pending_jobs= wait_jobs= 0;
- 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);
- //init_sql_alloc(&jobs_mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
- init_sql_alloc(&job_list_mem_root, SLAVE_WORKER_QUEUE_SIZE, 0);
- /*
+ /*
parallel slave parameter to pospone Crdr reading when the number
of non-processed yet jobs becomes bigger than the limit's value
MHS_todo: consider a memory-size based param
@@ -99,9 +103,40 @@ Relay_log_info::Relay_log_info(bool is_s
//
// TODO -- ANDREI --- You need to take care of possible failures related to
- // the dynamic array.
+ // allocation.
//
+ uint wi= 0;
+ key_mutex_slave_parallel_worker= new PSI_mutex_key[slave_parallel_workers];
+ key_cond_slave_parallel_worker= new PSI_cond_key[slave_parallel_workers];
+ worker_mutexes= new PSI_mutex_info[slave_parallel_workers];
+ worker_conds= new PSI_cond_info[slave_parallel_workers];
+ for (wi= 0; wi < slave_parallel_workers; wi++)
+ {
+ worker_mutexes[wi].m_key= (PSI_mutex_key *) &(key_mutex_slave_parallel_worker[wi]);
+ worker_mutexes[wi].m_name= "struct slave_worker::jobs_lock";
+ worker_mutexes[wi].m_flags= 0;
+ worker_conds[wi].m_key= (PSI_cond_key *) &(key_cond_slave_parallel_worker[wi]);
+ worker_conds[wi].m_name= "struct slave_worker::jobs_cond";
+ worker_conds[wi].m_flags= 0;
+ }
+ if (PSI_server)
+ {
+ PSI_server->register_mutex("worker", worker_mutexes,
+ slave_parallel_workers);
+ PSI_server->register_cond("worker", worker_conds,
+ slave_parallel_workers);
+ }
+ 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);
+ //init_sql_alloc(&jobs_mem_root, TABLE_ALLOC_BLOCK_SIZE, 0);
+ init_sql_alloc(&job_list_mem_root, SLAVE_WORKER_QUEUE_SIZE, 0);
my_init_dynamic_array(&workers, sizeof(Slave_worker *), slave_parallel_workers, 4);
+
+ /*
+ Error checking is done internally when creating, destroying and using the
+ associated hash functions.
+ */
init_hash_workers(slave_parallel_workers);
DBUG_VOID_RETURN;
@@ -117,13 +152,16 @@ Relay_log_info::~Relay_log_info()
mysql_mutex_destroy(&pending_jobs_lock);
mysql_cond_destroy(&pending_jobs_cond);
+
//
// ANDREI ---- See comment on the init routine in the constructor.
//free_root(&jobs_mem_root, MYF(0));
//
+
destroy_hash_workers();
free_root(&job_list_mem_root, MYF(0));
delete_dynamic(&workers);
+
DBUG_VOID_RETURN;
}
=== modified file 'sql/rpl_rli.h'
--- a/sql/rpl_rli.h 2010-09-16 19:29:26 +0000
+++ b/sql/rpl_rli.h 2010-09-17 00:50:31 +0000
@@ -70,6 +70,12 @@ public:
ulong items_buf_len;
};
+extern PSI_mutex_key *key_mutex_slave_parallel_worker;
+extern PSI_mutex_key key_mutex_slave_parallel_pend_jobs;
+
+extern PSI_cond_key *key_cond_slave_parallel_worker;
+extern PSI_cond_key key_cond_slave_parallel_pend_jobs;
+
/*******************************************************************************
Replication SQL Thread
Attachment: [text/bzr-bundle] bzr/alfranio.correia@oracle.com-20100917005031-m0jpfrc9flpbywu6.bundle
| Thread |
|---|
| • bzr push into mysql-next-mr-rpl-merge branch (alfranio.correia:3037 to 3038) | Alfranio Correia | 17 Sep |