#At file:///home/andrei/MySQL/BZR/2a-23May/MERGE/mysql-next-mr-wl5569/ based on revid:andrei.elkin@stripped
3288 Andrei Elkin 2011-06-14 [merge]
merge from trunk
modified:
mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result
mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result
mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result
mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result
sql/rpl_info.cc
sql/rpl_info.h
sql/rpl_mi.cc
sql/rpl_mi.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 'mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result'
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result 2011-05-06 10:38:10 +0000
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result 2011-06-13 06:04:55 +0000
@@ -175,9 +175,23 @@ def mysql slave_relay_log_info Master_id
def mysql slave_relay_log_info Master_log_name 5 NULL NO text 65535 65535 NULL NULL utf8 utf8_bin text The name of the master binary log file from which the events in the relay log file were read.
def mysql slave_relay_log_info Master_log_pos 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned The master log position of the last executed event.
def mysql slave_relay_log_info Number_of_lines 2 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned Number of lines in the file or rows in the table. Used to version table definitions.
+def mysql slave_relay_log_info Number_of_workers 8 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned
def mysql slave_relay_log_info Relay_log_name 3 NULL NO text 65535 65535 NULL NULL utf8 utf8_bin text The name of the current relay log file.
def mysql slave_relay_log_info Relay_log_pos 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned The relay log position of the last executed event.
def mysql slave_relay_log_info Sql_delay 7 NULL NO int NULL NULL 10 0 NULL NULL int(11) The number of seconds that the slave must lag behind the master.
+def mysql slave_worker_info Checkpoint_group_bitmap 13 NULL NO blob 65535 65535 NULL NULL NULL NULL blob
+def mysql slave_worker_info Checkpoint_group_size 12 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned
+def mysql slave_worker_info Checkpoint_master_log_name 9 NULL NO text 65535 65535 NULL NULL utf8 utf8_bin text
+def mysql slave_worker_info Checkpoint_master_log_pos 10 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned
+def mysql slave_worker_info Checkpoint_relay_log_name 7 NULL NO text 65535 65535 NULL NULL utf8 utf8_bin text
+def mysql slave_worker_info Checkpoint_relay_log_pos 8 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned
+def mysql slave_worker_info Checkpoint_seqno 11 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned
+def mysql slave_worker_info Master_id 1 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned PRI
+def mysql slave_worker_info Master_log_name 5 NULL NO text 65535 65535 NULL NULL utf8 utf8_bin text
+def mysql slave_worker_info Master_log_pos 6 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned
+def mysql slave_worker_info Relay_log_name 3 NULL NO text 65535 65535 NULL NULL utf8 utf8_bin text
+def mysql slave_worker_info Relay_log_pos 4 NULL NO bigint NULL NULL 20 0 NULL NULL bigint(20) unsigned
+def mysql slave_worker_info Worker_id 2 NULL NO int NULL NULL 10 0 NULL NULL int(10) unsigned PRI
def mysql slow_log db 7 NULL NO varchar 512 1536 NULL NULL utf8 utf8_general_ci varchar(512)
def mysql slow_log insert_id 9 NULL NO int NULL NULL 10 0 NULL NULL int(11)
def mysql slow_log last_insert_id 8 NULL NO int NULL NULL 10 0 NULL NULL int(11)
@@ -501,6 +515,20 @@ NULL mysql slave_relay_log_info Relay_lo
1.0000 mysql slave_relay_log_info Master_log_name text 65535 65535 utf8 utf8_bin text
NULL mysql slave_relay_log_info Master_log_pos bigint NULL NULL NULL NULL bigint(20) unsigned
NULL mysql slave_relay_log_info Sql_delay int NULL NULL NULL NULL int(11)
+NULL mysql slave_relay_log_info Number_of_workers int NULL NULL NULL NULL int(10) unsigned
+NULL mysql slave_worker_info Master_id int NULL NULL NULL NULL int(10) unsigned
+NULL mysql slave_worker_info Worker_id int NULL NULL NULL NULL int(10) unsigned
+1.0000 mysql slave_worker_info Relay_log_name text 65535 65535 utf8 utf8_bin text
+NULL mysql slave_worker_info Relay_log_pos bigint NULL NULL NULL NULL bigint(20) unsigned
+1.0000 mysql slave_worker_info Master_log_name text 65535 65535 utf8 utf8_bin text
+NULL mysql slave_worker_info Master_log_pos bigint NULL NULL NULL NULL bigint(20) unsigned
+1.0000 mysql slave_worker_info Checkpoint_relay_log_name text 65535 65535 utf8 utf8_bin text
+NULL mysql slave_worker_info Checkpoint_relay_log_pos bigint NULL NULL NULL NULL bigint(20) unsigned
+1.0000 mysql slave_worker_info Checkpoint_master_log_name text 65535 65535 utf8 utf8_bin text
+NULL mysql slave_worker_info Checkpoint_master_log_pos bigint NULL NULL NULL NULL bigint(20) unsigned
+NULL mysql slave_worker_info Checkpoint_seqno int NULL NULL NULL NULL int(10) unsigned
+NULL mysql slave_worker_info Checkpoint_group_size int NULL NULL NULL NULL int(10) unsigned
+1.0000 mysql slave_worker_info Checkpoint_group_bitmap blob 65535 65535 NULL NULL blob
NULL mysql slow_log start_time timestamp NULL NULL NULL NULL timestamp
1.0000 mysql slow_log user_host mediumtext 16777215 16777215 utf8 utf8_general_ci mediumtext
NULL mysql slow_log query_time time NULL NULL NULL NULL time
=== modified file 'mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result'
--- a/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result 2011-03-18 11:20:23 +0000
+++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result 2011-06-13 06:04:55 +0000
@@ -48,6 +48,8 @@ def mysql proxies_priv 0 mysql PRIMARY 4
def mysql servers 0 mysql PRIMARY 1 Server_name A #CARD# NULL NULL BTREE
def mysql slave_master_info 0 mysql PRIMARY 1 Master_id A #CARD# NULL NULL BTREE
def mysql slave_relay_log_info 0 mysql PRIMARY 1 Master_id A #CARD# NULL NULL BTREE
+def mysql slave_worker_info 0 mysql PRIMARY 1 Master_id A #CARD# NULL NULL BTREE
+def mysql slave_worker_info 0 mysql PRIMARY 2 Worker_id A #CARD# NULL NULL BTREE
def mysql tables_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE
def mysql tables_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql tables_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
@@ -108,6 +110,8 @@ def mysql proxies_priv 0 mysql PRIMARY 4
def mysql servers 0 mysql PRIMARY 1 Server_name A #CARD# NULL NULL BTREE
def mysql slave_master_info 0 mysql PRIMARY 1 Master_id A #CARD# NULL NULL BTREE
def mysql slave_relay_log_info 0 mysql PRIMARY 1 Master_id A #CARD# NULL NULL BTREE
+def mysql slave_worker_info 0 mysql PRIMARY 1 Master_id A #CARD# NULL NULL BTREE
+def mysql slave_worker_info 0 mysql PRIMARY 2 Worker_id A #CARD# NULL NULL BTREE
def mysql tables_priv 1 mysql Grantor 1 Grantor A #CARD# NULL NULL BTREE
def mysql tables_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE
def mysql tables_priv 0 mysql PRIMARY 2 Db A #CARD# NULL NULL BTREE
=== modified file 'mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result'
--- a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result 2011-03-18 11:20:23 +0000
+++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result 2011-06-13 06:04:55 +0000
@@ -27,6 +27,7 @@ def mysql PRIMARY mysql proxies_priv PRI
def mysql PRIMARY mysql servers PRIMARY KEY
def mysql PRIMARY mysql slave_master_info PRIMARY KEY
def mysql PRIMARY mysql slave_relay_log_info PRIMARY KEY
+def mysql PRIMARY mysql slave_worker_info PRIMARY KEY
def mysql PRIMARY mysql tables_priv PRIMARY KEY
def mysql PRIMARY mysql time_zone PRIMARY KEY
def mysql PRIMARY mysql time_zone_leap_second PRIMARY KEY
@@ -59,6 +60,7 @@ def mysql PRIMARY mysql proxies_priv PRI
def mysql PRIMARY mysql servers PRIMARY KEY
def mysql PRIMARY mysql slave_master_info PRIMARY KEY
def mysql PRIMARY mysql slave_relay_log_info PRIMARY KEY
+def mysql PRIMARY mysql slave_worker_info PRIMARY KEY
def mysql PRIMARY mysql tables_priv PRIMARY KEY
def mysql PRIMARY mysql time_zone PRIMARY KEY
def mysql PRIMARY mysql time_zone_leap_second PRIMARY KEY
=== modified file 'mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result'
--- a/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result 2011-03-18 11:20:23 +0000
+++ b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result 2011-06-13 06:04:55 +0000
@@ -428,6 +428,29 @@ user_comment Relay Log Information
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
+TABLE_NAME slave_worker_info
+TABLE_TYPE BASE TABLE
+ENGINE MyISAM
+VERSION 10
+ROW_FORMAT Dynamic
+TABLE_ROWS #TBLR#
+AVG_ROW_LENGTH #ARL#
+DATA_LENGTH #DL#
+MAX_DATA_LENGTH #MDL#
+INDEX_LENGTH #IL#
+DATA_FREE #DF#
+AUTO_INCREMENT NULL
+CREATE_TIME #CRT#
+UPDATE_TIME #UT#
+CHECK_TIME #CT#
+TABLE_COLLATION utf8_general_ci
+CHECKSUM NULL
+CREATE_OPTIONS #CO#
+TABLE_COMMENT #TC#
+user_comment Worker Information
+Separator -----------------------------------------------------
+TABLE_CATALOG def
+TABLE_SCHEMA mysql
TABLE_NAME slow_log
TABLE_TYPE BASE TABLE
ENGINE CSV
@@ -1042,6 +1065,29 @@ user_comment Relay Log Information
Separator -----------------------------------------------------
TABLE_CATALOG def
TABLE_SCHEMA mysql
+TABLE_NAME slave_worker_info
+TABLE_TYPE BASE TABLE
+ENGINE MyISAM
+VERSION 10
+ROW_FORMAT Dynamic
+TABLE_ROWS #TBLR#
+AVG_ROW_LENGTH #ARL#
+DATA_LENGTH #DL#
+MAX_DATA_LENGTH #MDL#
+INDEX_LENGTH #IL#
+DATA_FREE #DF#
+AUTO_INCREMENT NULL
+CREATE_TIME #CRT#
+UPDATE_TIME #UT#
+CHECK_TIME #CT#
+TABLE_COLLATION utf8_general_ci
+CHECKSUM NULL
+CREATE_OPTIONS #CO#
+TABLE_COMMENT #TC#
+user_comment Worker Information
+Separator -----------------------------------------------------
+TABLE_CATALOG def
+TABLE_SCHEMA mysql
TABLE_NAME slow_log
TABLE_TYPE BASE TABLE
ENGINE CSV
=== modified file 'sql/rpl_info.cc'
--- a/sql/rpl_info.cc 2011-06-09 15:27:47 +0000
+++ b/sql/rpl_info.cc 2011-06-13 00:07:26 +0000
@@ -17,29 +17,44 @@
#include <sql_priv.h>
#include "rpl_info.h"
-Rpl_info::Rpl_info(const char* type)
+Rpl_info::Rpl_info(const char* type, const char* description)
: Slave_reporting_capability(type),
info_thd(0), uidx(0), nidx(0),
inited(0), abort_slave(0),
slave_running(0), slave_run_id(0),
handler(0), rpl_info_type(INVALID_INFO_REPOSITORY)
+#ifdef HAVE_PSI_INTERFACE
+ , mutex_info(0), cond_info(0), key_mutex_info(0), key_cond_info(0)
+#endif
{
+ register_mutexes(description);
}
Rpl_info::~Rpl_info()
{
delete []uidx;
delete handler;
-}
-Rpl_info_coordinator::Rpl_info_coordinator(const char* type, const char* psf)
- : Rpl_info(type), mutex_info(0), cond_info(0), key_mutex_info(0),
- key_cond_info(0)
-{
- register_mutexes(psf);
+ if (registered_mutexes)
+ {
+#ifdef HAVE_PSI_INTERFACE
+ delete []key_mutex_info;
+ delete []key_cond_info;
+ delete []mutex_info;
+ delete []cond_info;
+#endif
+ }
+
+ mysql_mutex_destroy(&run_lock);
+ mysql_mutex_destroy(&data_lock);
+ mysql_mutex_destroy(&sleep_lock);
+ mysql_cond_destroy(&data_cond);
+ mysql_cond_destroy(&start_cond);
+ mysql_cond_destroy(&stop_cond);
+ mysql_cond_destroy(&sleep_cond);
}
-bool Rpl_info_coordinator::register_mutexes(const char* description)
+bool Rpl_info::register_mutexes(const char* description)
{
#ifdef HAVE_PSI_INTERFACE
const int NUMBER_MUTEX_INFO= 3;
@@ -60,33 +75,32 @@ bool Rpl_info_coordinator::register_mute
goto err;
mutex_info[RUN_LOCK_IDX].m_key= (PSI_mutex_key *) &(key_mutex_info[RUN_LOCK_IDX]);
- mutex_info[RUN_LOCK_IDX].m_name= "Rpl_info_coordinator::run_lock";
+ mutex_info[RUN_LOCK_IDX].m_name= "Rpl_info::run_lock";
mutex_info[RUN_LOCK_IDX].m_flags= 0;
mutex_info[DATA_LOCK_IDX].m_key= (PSI_mutex_key *) &(key_mutex_info[DATA_LOCK_IDX]);
- mutex_info[DATA_LOCK_IDX].m_name= "Rpl_info_coordinator::data_lock";
+ mutex_info[DATA_LOCK_IDX].m_name= "Rpl_info::data_lock";
mutex_info[DATA_LOCK_IDX].m_flags= 0;
mutex_info[SLEEP_LOCK_IDX].m_key= (PSI_mutex_key *) &(key_mutex_info[SLEEP_LOCK_IDX]);
- mutex_info[SLEEP_LOCK_IDX].m_name= "Rpl_info_coordinator::sleep_lock";
+ mutex_info[SLEEP_LOCK_IDX].m_name= "Rpl_info::sleep_lock";
mutex_info[SLEEP_LOCK_IDX].m_flags= 0;
cond_info[DATA_COND_IDX].m_key= (PSI_cond_key *) &(key_cond_info[DATA_COND_IDX]);
- cond_info[DATA_COND_IDX].m_name= "Rpl_info_coordinator::data_cond";
+ cond_info[DATA_COND_IDX].m_name= "Rpl_info::data_cond";
cond_info[DATA_COND_IDX].m_flags= 0;
cond_info[START_COND_IDX].m_key= (PSI_cond_key *) &(key_cond_info[START_COND_IDX]);
- cond_info[START_COND_IDX].m_name= "Rpl_info_coordinator::start_cond";
+ cond_info[START_COND_IDX].m_name= "Rpl_info::start_cond";
cond_info[START_COND_IDX].m_flags= 0;
cond_info[STOP_COND_IDX].m_key= (PSI_cond_key *) &(key_cond_info[STOP_COND_IDX]);
- cond_info[STOP_COND_IDX].m_name= "Rpl_info_coordinator::stop_cond";
+ cond_info[STOP_COND_IDX].m_name= "Rpl_info::stop_cond";
cond_info[STOP_COND_IDX].m_flags= 0;
cond_info[SLEEP_COND_IDX].m_key= (PSI_cond_key *) &(key_cond_info[SLEEP_COND_IDX]);
- cond_info[SLEEP_COND_IDX].m_name= "Rpl_info_coordinator::sleep_cond";
+ cond_info[SLEEP_COND_IDX].m_name= "Rpl_info::sleep_cond";
cond_info[SLEEP_COND_IDX].m_flags= 0;
if (PSI_server)
{
PSI_server->register_mutex(description, mutex_info,
NUMBER_MUTEX_INFO);
-
PSI_server->register_cond(description, cond_info,
NUMBER_COND_INFO);
}
@@ -104,11 +118,9 @@ bool Rpl_info_coordinator::register_mute
mysql_cond_init(key_cond_info[SLEEP_COND_IDX], &sleep_cond, NULL);
registered_mutexes= TRUE;
-#endif
return (FALSE);
-#ifdef HAVE_PSI_INTERFACE
err:
delete []key_mutex_info;
delete []key_cond_info;
@@ -121,39 +133,18 @@ err:
cond_info= NULL;
return (TRUE);
-#endif
-}
+#else
+ mysql_mutex_init(NULL, &run_lock, MY_MUTEX_INIT_FAST);
+ mysql_mutex_init(NULL, &data_lock, MY_MUTEX_INIT_FAST);
+ mysql_mutex_init(NULL, &sleep_lock, MY_MUTEX_INIT_FAST);
+
+ mysql_cond_init(NULL, &data_cond, NULL);
+ mysql_cond_init(NULL, &start_cond, NULL);
+ mysql_cond_init(NULL, &stop_cond, NULL);
+ mysql_cond_init(NULL, &sleep_cond, NULL);
-Rpl_info_coordinator::~Rpl_info_coordinator()
-{
- DBUG_ENTER("Rpl_info_coordinator::~Rpl_info_coordinator");
+ registered_mutexes= TRUE;
-#ifdef HAVE_PSI_INTERFACE
- if (registered_mutexes)
- {
- mysql_mutex_destroy(&run_lock);
- mysql_mutex_destroy(&data_lock);
- mysql_mutex_destroy(&sleep_lock);
- mysql_cond_destroy(&data_cond);
- mysql_cond_destroy(&start_cond);
- mysql_cond_destroy(&stop_cond);
- mysql_cond_destroy(&sleep_cond);
-
- delete []key_mutex_info;
- delete []key_cond_info;
- delete []mutex_info;
- delete []cond_info;
- }
+ return (FALSE);
#endif
-
- DBUG_VOID_RETURN;
-}
-
-Rpl_info_worker::Rpl_info_worker(const char* type, const char* pfs)
- : Rpl_info(type)
-{
-}
-
-Rpl_info_worker::~Rpl_info_worker()
-{
}
=== modified file 'sql/rpl_info.h'
--- a/sql/rpl_info.h 2011-06-09 15:27:47 +0000
+++ b/sql/rpl_info.h 2011-06-13 00:07:26 +0000
@@ -46,6 +46,31 @@ public:
volatile uint slave_running;
volatile ulong slave_run_id;
+ /*
+ standard lock acquisition order to avoid deadlocks:
+ run_lock, data_lock, relay_log.LOCK_log, relay_log.LOCK_index
+ run_lock, sleep_lock
+ */
+ mysql_mutex_t data_lock, run_lock, sleep_lock;
+
+ /*
+ start_cond is broadcast when SQL thread is started
+ stop_cond - when stopped
+ data_cond - when data protected by data_lock changes
+ sleep_cond - when killed
+ */
+ mysql_cond_t data_cond, start_cond, stop_cond, sleep_cond;
+
+#ifndef DBUG_OFF
+ int events_until_exit;
+#endif
+
+ /**
+ Identifies if mutexes and condition variables were successfuly
+ created and registered.
+ */
+ bool registered_mutexes;
+
/**
Defines the type of the repository that is used.
@@ -129,48 +154,6 @@ protected:
Rpl_info_handler *handler;
uint rpl_info_type;
- Rpl_info(const char *type);
-
-private:
- virtual bool read_info(Rpl_info_handler *from)= 0;
- virtual bool write_info(Rpl_info_handler *to)= 0;
-
- Rpl_info(const Rpl_info& info);
- Rpl_info& operator=(const Rpl_info& info);
-};
-
-class Rpl_info_coordinator: public Rpl_info
-{
-public:
- /*
- standard lock acquisition order to avoid deadlocks:
- run_lock, data_lock, relay_log.LOCK_log, relay_log.LOCK_index
- run_lock, sleep_lock
- */
- mysql_mutex_t data_lock, run_lock, sleep_lock;
-
- /*
- start_cond is broadcast when SQL thread is started
- stop_cond - when stopped
- data_cond - when data protected by data_lock changes
- sleep_cond - when killed
- */
- mysql_cond_t data_cond, start_cond, stop_cond, sleep_cond;
-
-#ifndef DBUG_OFF
- int events_until_exit;
-#endif
-
- Rpl_info_coordinator(const char* type, const char* pfs);
- virtual ~Rpl_info_coordinator();
-
- /**
- Identifies if mutexes and condition variables were successfuly
- created and registered.
- */
- bool registered_mutexes;
-
-protected:
/**
Registers mutexes and condition variables in the performance
schema.
@@ -182,6 +165,8 @@ protected:
*/
bool register_mutexes(const char* description);
+ Rpl_info(const char *type, const char* description);
+
private:
#ifdef HAVE_PSI_INTERFACE
PSI_mutex_info *mutex_info;
@@ -190,19 +175,10 @@ private:
PSI_cond_key *key_cond_info;
#endif
- Rpl_info_coordinator& operator=(const Rpl_info_coordinator& info);
- Rpl_info_coordinator(const Rpl_info_coordinator& info);
-};
-
-class Rpl_info_worker: public Rpl_info
-{
-public:
-
- Rpl_info_worker(const char* type, const char* pfs);
- virtual ~Rpl_info_worker();
+ virtual bool read_info(Rpl_info_handler *from)= 0;
+ virtual bool write_info(Rpl_info_handler *to)= 0;
-private:
- Rpl_info_worker& operator=(const Rpl_info_worker& info);
- Rpl_info_worker(const Rpl_info_worker& info);
+ Rpl_info(const Rpl_info& info);
+ Rpl_info& operator=(const Rpl_info& info);
};
#endif /* RPL_INFO_H */
=== modified file 'sql/rpl_mi.cc'
--- a/sql/rpl_mi.cc 2011-06-09 15:27:47 +0000
+++ b/sql/rpl_mi.cc 2011-06-13 00:07:26 +0000
@@ -77,7 +77,7 @@ const char *info_mi_fields []=
};
Master_info::Master_info()
- :Rpl_info_coordinator("I/O", "IO-Thread"),
+ :Rpl_info("I/O", "IO-Thread"),
ssl(0), ssl_verify_server_cert(0),
port(MYSQL_PORT), connect_retry(DEFAULT_CONNECT_RETRY),
clock_diff_with_master(0), heartbeat_period(0),
=== modified file 'sql/rpl_mi.h'
--- a/sql/rpl_mi.h 2011-06-09 15:27:47 +0000
+++ b/sql/rpl_mi.h 2011-06-13 00:07:26 +0000
@@ -61,7 +61,7 @@ class Rpl_info_factory;
*****************************************************************************/
-class Master_info : public Rpl_info_coordinator
+class Master_info : public Rpl_info
{
friend class Rpl_info_factory;
=== modified file 'sql/rpl_rli.cc'
--- a/sql/rpl_rli.cc 2011-06-12 19:05:05 +0000
+++ b/sql/rpl_rli.cc 2011-06-13 00:07:26 +0000
@@ -47,7 +47,7 @@ const char* info_rli_fields[]=
"number_of_workers"
};
-// ALFRANIO
+#ifdef HAVE_PSI_INTERFACE
static PSI_mutex_info *worker_mutexes= NULL;
static PSI_cond_info *worker_conds= NULL;
@@ -57,9 +57,10 @@ PSI_mutex_key key_mutex_mts_temp_tables_
PSI_cond_key *key_cond_slave_parallel_worker= NULL;
PSI_cond_key key_cond_slave_parallel_pend_jobs;
+#endif
Relay_log_info::Relay_log_info(bool is_slave_recovery)
- :Rpl_info_coordinator("SQL", "SQL-Thread"), checkpoint_thd(0), checkpoint_running(0),
+ :Rpl_info("SQL", "SQL-Thread"), checkpoint_thd(0), checkpoint_running(0),
replicate_same_server_id(::replicate_same_server_id),
cur_log_fd(-1), relay_log(&sync_relaylog_period),
is_relay_log_recovery(is_slave_recovery),
@@ -106,8 +107,6 @@ Relay_log_info::Relay_log_info(bool is_s
*/
void Relay_log_info::init_workers(ulong n)
{
- uint wi= 0;
-
/*
Parallel slave parameters initialization is done regardless
whether the feature is or going to be active or not.
@@ -115,11 +114,15 @@ void Relay_log_info::init_workers(ulong
trans_jobs= stmt_jobs= pending_jobs= wait_jobs= 0;
mts_wqs_underrun_cnt= mts_wqs_overfill_cnt= 0;
+ my_init_dynamic_array(&workers, sizeof(Slave_worker *), slave_parallel_workers, 4);
+ my_atomic_rwlock_init(&slave_open_temp_tables_lock);
+
+#ifdef HAVE_PSI_INTERFACE
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++)
+ for (uint 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= "Slave_worker::jobs_lock";
@@ -137,11 +140,14 @@ void Relay_log_info::init_workers(ulong
}
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);
mysql_mutex_init(key_mutex_mts_temp_tables_lock, &mts_temp_tables_lock,
MY_MUTEX_INIT_FAST);
- my_init_dynamic_array(&workers, sizeof(Slave_worker *), slave_parallel_workers, 4);
- my_atomic_rwlock_init(&slave_open_temp_tables_lock);
+ mysql_cond_init(key_cond_slave_parallel_pend_jobs, &pending_jobs_cond, NULL);
+#else
+ mysql_mutex_init(NULL, &pending_jobs_lock, MY_MUTEX_INIT_FAST);
+ mysql_mutex_init(NULL, &mts_temp_tables_lock, MY_MUTEX_INIT_FAST);
+ mysql_cond_init(NULL, &pending_jobs_cond, NULL);
+#endif
}
/**
=== modified file 'sql/rpl_rli.h'
--- a/sql/rpl_rli.h 2011-06-14 09:27:38 +0000
+++ b/sql/rpl_rli.h 2011-06-14 10:35:20 +0000
@@ -103,7 +103,7 @@ transactional or non-transactional is us
To correctly recovery from failures, one should combine transactional system
tables along with the --relay-log-recovery.
*******************************************************************************/
-class Relay_log_info : public Rpl_info_coordinator
+class Relay_log_info : public Rpl_info
{
friend class Rpl_info_factory;
@@ -758,5 +758,11 @@ inline bool mts_is_worker(THD *thd)
{
return thd->system_thread == SYSTEM_THREAD_SLAVE_WORKER;
}
+#ifdef HAVE_PSI_INTERFACE
+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;
+#endif
#endif /* RPL_RLI_H */
=== modified file 'sql/rpl_rli_pdb.cc'
--- a/sql/rpl_rli_pdb.cc 2011-06-14 09:27:38 +0000
+++ b/sql/rpl_rli_pdb.cc 2011-06-14 10:35:20 +0000
@@ -250,8 +250,11 @@ bool Slave_worker::commit_positions(Log_
static HASH mapping_db_to_worker;
static bool inited_hash_workers= FALSE;
+#ifdef HAVE_PSI_INTERFACE
PSI_mutex_key key_mutex_slave_worker_hash;
PSI_cond_key key_cond_slave_worker_hash;
+#endif
+
static mysql_mutex_t slave_worker_hash_lock;
static mysql_cond_t slave_worker_hash_cond;
@@ -296,9 +299,15 @@ bool init_hash_workers(ulong slave_paral
{
DBUG_ENTER("init_hash_workers");
+#ifdef HAVE_PSI_INTERFACE
mysql_mutex_init(key_mutex_slave_worker_hash, &slave_worker_hash_lock,
MY_MUTEX_INIT_FAST);
mysql_cond_init(key_cond_slave_worker_hash, &slave_worker_hash_cond, NULL);
+#else
+ mysql_mutex_init(NULL, &slave_worker_hash_lock,
+ MY_MUTEX_INIT_FAST);
+ mysql_cond_init(NULL, &slave_worker_hash_cond, NULL);
+#endif
inited_hash_workers=
(my_hash_init(&mapping_db_to_worker, &my_charset_bin,
=== modified file 'sql/rpl_rli_pdb.h'
--- a/sql/rpl_rli_pdb.h 2011-06-10 08:04:00 +0000
+++ b/sql/rpl_rli_pdb.h 2011-06-13 00:07:26 +0000
@@ -269,11 +269,6 @@ public:
volatile bool checkpoint_notified; // Coord sets and resets, W can read
ulong bitmap_shifted; // shift the last bitmap at receiving new CP
bool wq_overrun_set; // W monitors its queue usage to incr/decr rli->mts_wqs_overrun
- /*
- We need to make this a dynamic field. /Alfranio
- */
- char partitions[FN_REFLEN];
- // todo: remove
char checkpoint_relay_log_name[FN_REFLEN];
ulonglong checkpoint_relay_log_pos;
@@ -315,10 +310,4 @@ private:
TABLE* mts_move_temp_table_to_entry(TABLE*, THD*, db_worker_hash_entry*);
TABLE* mts_move_temp_tables_to_thd(THD*, TABLE*);
-
-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;
#endif
=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc 2011-06-14 09:27:38 +0000
+++ b/sql/rpl_slave.cc 2011-06-14 10:35:20 +0000
@@ -404,11 +404,6 @@ int init_info(Master_info* mi, bool igno
thread is being started and the relay log info if either the
SLAVE_SQL thread is being started or was not initialized as it is
required by the SLAVE_IO thread.
-
- In a multi-master envinroment, we need to make sure that both master
- info and relay log info are prepared to handle events from all
- masters. In such case, we need to execute the code below for each
- master and correctly set the key_info_idx. /Alfranio
*/
necessary_to_configure= mi->check_info();
if (!(ignore_if_no_info && necessary_to_configure))
@@ -440,11 +435,6 @@ void end_info(Master_info* mi)
/*
The previous implementation was not acquiring locks. We do the same here.
However, this is quite strange.
-
- In a multi-master envinroment, we need to make sure that both master
- info and relay log info are prepared to handle events from all
- masters. In such case, we need to execute the code below for each
- master and correctly set the key_info_idx. /Alfranio
*/
mi->end_info();
mi->rli->end_info();
@@ -472,12 +462,6 @@ int remove_info(Master_info* mi)
mi->rli->clear_until_condition();
mi->rli->clear_sql_delay();
- /*
- In a multi-master envinroment, we need to make sure that both master
- info and relay log info are prepared to handle events from all
- masters. In such case, we need to execute the code below for each
- master and correctly set the key_info_idx. /Alfranio
- */
mi->end_info();
mi->rli->end_info();
@@ -536,12 +520,6 @@ int flush_master_info(Master_info* mi, b
mysql_mutex_lock(log_lock);
- /*
- In a multi-master envinroment, we need to make sure that both master
- info and relay log info are prepared to handle events from all
- masters. In such case, we need to execute the code below for each
- master and correctly set the key_info_idx. /Alfranio
- */
int err= (mi->rli->flush_current_log() ||
mi->flush_info(force));
@@ -718,11 +696,6 @@ int terminate_slave_threads(Master_info*
/*
Flushes the master info regardles of the sync_master_info option.
-
- In a multi-master envinroment, we need to make sure that both master
- info and relay log info are prepared to handle events from all
- masters. In such case, we need to execute the code below for each
- master and correctly set the key_info_idx. /Alfranio
*/
if (mi->flush_info(TRUE))
DBUG_RETURN(ER_ERROR_DURING_FLUSH_LOGS);
@@ -3819,7 +3792,6 @@ bool mts_recovery_groups(Relay_log_info
Slave_job_group job_file;
IO_CACHE log;
File file;
- MY_STAT s;
LOG_POS_COORD cp=
{
@@ -3883,9 +3855,7 @@ bool mts_recovery_groups(Relay_log_info
goto err;
}
- DBUG_ASSERT(my_stat(log_name, &s, MYF(0))); // TODO: Alfranio, why my_stat?
my_b_seek(&log, (my_off_t) rli->get_group_relay_log_pos());
-
bitmap_clear_all(groups);
rli->mts_recovery_group_cnt= 0;
for (uint it_job= 0; it_job < above_lwm_jobs.elements; it_job++)
@@ -4125,9 +4095,14 @@ int slave_start_single_worker(Relay_log_
w->wq_overrun_set= FALSE;
set_dynamic(&rli->workers, (uchar*) &w, i);
+#ifdef HAVE_PSI_INTERFACE
mysql_mutex_init(key_mutex_slave_parallel_worker[i], &w->jobs_lock,
MY_MUTEX_INIT_FAST);
mysql_cond_init(key_cond_slave_parallel_worker[i], &w->jobs_cond, NULL);
+#else
+ mysql_mutex_init(NULL, &w->jobs_lock, MY_MUTEX_INIT_FAST);
+ mysql_cond_init(NULL, &w->jobs_cond, NULL);
+#endif
w->curr_group_seen_begin= FALSE;
if (pthread_create(&th, &connection_attrib, handle_slave_worker,
@@ -6991,13 +6966,10 @@ bool change_master(THD* thd, Master_info
in-memory value at restart (thus causing errors, as the old relay log does
not exist anymore).
- In a multi-master envinroment, we need to make sure that both master
- info and relay log info are prepared to handle events from all
- masters. In such case, we need to execute the code below for each
- master and correctly set the key_info_idx. /Alfranio
+ Notice that there are not writes to the rli table as slave is not
+ running.
*/
-
- DBUG_ASSERT(!mi->rli->slave_running); // none writes in rli table
+ DBUG_ASSERT(!mi->rli->slave_running);
ret= mi->rli->flush_info(TRUE);
mysql_cond_broadcast(&mi->data_cond);
mysql_mutex_unlock(&mi->rli->data_lock);
Attachment: [text/bzr-bundle] bzr/andrei.elkin@oracle.com-20110614103520-j8na6paqtqhx33w0.bundle
| Thread |
|---|
| • bzr commit into mysql-next-mr-wl5569 branch (andrei.elkin:3288) | Andrei Elkin | 14 Jun |