3239 Alfranio Correia 2010-12-09
WL#5599
Created worker_info_repository option.
added:
mysql-test/include/not_worker_info_table.inc
mysql-test/suite/sys_vars/r/worker_info_repository_basic.result
mysql-test/suite/sys_vars/t/worker_info_repository_basic.test
modified:
mysql-test/r/mysqld--help-notwin.result
mysql-test/r/mysqld--help-win.result
sql/rpl_info_factory.cc
sql/rpl_info_factory.h
sql/rpl_slave.cc
sql/sys_vars.cc
3238 Alfranio Correia 2010-12-08
WL#5599
Fixed test case.
modified:
mysql-test/r/information_schema.result
3237 Alfranio Correia 2010-12-08
WL#5599
Removed unnecessary quicksort implementation.
modified:
sql/rpl_rli_pdb.h
sql/rpl_slave.cc
=== added file 'mysql-test/include/not_worker_info_table.inc'
--- a/mysql-test/include/not_worker_info_table.inc 1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/not_worker_info_table.inc 2010-12-09 13:23:19 +0000
@@ -0,0 +1,4 @@
+if (`SELECT @@GLOBAL.worker_info_repository = 'TABLE'`)
+{
+ skip Test cannot run with worker.info repository table;
+}
=== modified file 'mysql-test/r/information_schema.result'
--- a/mysql-test/r/information_schema.result 2010-12-08 00:33:48 +0000
+++ b/mysql-test/r/information_schema.result 2010-12-08 23:04:43 +0000
@@ -877,7 +877,7 @@ AND table_name not like 'ndb%' AND table
GROUP BY TABLE_SCHEMA;
table_schema count(*)
information_schema 30
-mysql 25
+mysql 26
create table t1 (i int, j int);
create trigger trg1 before insert on t1 for each row
begin
=== modified file 'mysql-test/r/mysqld--help-notwin.result'
--- a/mysql-test/r/mysqld--help-notwin.result 2010-12-08 01:30:32 +0000
+++ b/mysql-test/r/mysqld--help-notwin.result 2010-12-09 13:23:19 +0000
@@ -767,6 +767,9 @@ The following options may be given as th
-V, --version Output version information and exit.
--wait-timeout=# The number of seconds the server waits for activity on a
connection before closing it
+ --worker-info-repository=name
+ Defines the type of the repository for the worker
+ information.
Variables (--variable-name=value)
abort-slave-event-count 0
@@ -1002,6 +1005,7 @@ transaction-prealloc-size 4096
updatable-views-with-limit YES
verbose TRUE
wait-timeout 28800
+worker-info-repository FILE
To see what values a running MySQL server is using, type
'mysqladmin variables' instead of 'mysqld --verbose --help'.
=== modified file 'mysql-test/r/mysqld--help-win.result'
--- a/mysql-test/r/mysqld--help-win.result 2010-12-08 01:30:32 +0000
+++ b/mysql-test/r/mysqld--help-win.result 2010-12-09 13:23:19 +0000
@@ -771,6 +771,9 @@ The following options may be given as th
-V, --version Output version information and exit.
--wait-timeout=# The number of seconds the server waits for activity on a
connection before closing it
+ --worker-info-repository=name
+ Defines the type of the repository for the worker
+ information.
Variables (--variable-name=value)
abort-slave-event-count 0
@@ -1008,6 +1011,7 @@ transaction-prealloc-size 4096
updatable-views-with-limit YES
verbose TRUE
wait-timeout 28800
+worker-info-repository FILE
To see what values a running MySQL server is using, type
'mysqladmin variables' instead of 'mysqld --verbose --help'.
=== added file 'mysql-test/suite/sys_vars/r/worker_info_repository_basic.result'
--- a/mysql-test/suite/sys_vars/r/worker_info_repository_basic.result 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/worker_info_repository_basic.result 2010-12-09 13:23:19 +0000
@@ -0,0 +1,44 @@
+'#---------------------BS_STVARS_002_01----------------------#'
+SELECT @@GLOBAL.worker_info_repository;
+@@GLOBAL.worker_info_repository
+FILE
+SELECT COUNT(@@GLOBAL.worker_info_repository);
+COUNT(@@GLOBAL.worker_info_repository)
+1
+1 Expected
+SELECT COUNT(@@SESSION.worker_info_repository);
+ERROR HY000: Variable 'worker_info_repository' is a GLOBAL variable
+'#---------------------BS_STVARS_002_02----------------------#'
+SET @@GLOBAL.worker_info_repository= "TABLE";
+ERROR HY000: Variable 'worker_info_repository' is a read only variable
+SELECT @@GLOBAL.worker_info_repository;
+@@GLOBAL.worker_info_repository
+FILE
+'#---------------------BS_STVARS_002_03----------------------#'
+SELECT @@GLOBAL.worker_info_repository = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='worker_info_repository';
+@@GLOBAL.worker_info_repository = VARIABLE_VALUE
+1
+1 Expected
+SELECT COUNT(@@GLOBAL.worker_info_repository);
+COUNT(@@GLOBAL.worker_info_repository)
+1
+1 Expected
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='worker_info_repository';
+COUNT(VARIABLE_VALUE)
+1
+1 Expected
+'#---------------------BS_STVARS_002_05----------------------#'
+SELECT COUNT(@@worker_info_repository);
+COUNT(@@worker_info_repository)
+1
+1 Expected
+SELECT COUNT(@@local.worker_info_repository);
+ERROR HY000: Variable 'worker_info_repository' is a GLOBAL variable
+SELECT COUNT(@@GLOBAL.worker_info_repository);
+COUNT(@@GLOBAL.worker_info_repository)
+1
+1 Expected
=== added file 'mysql-test/suite/sys_vars/t/worker_info_repository_basic.test'
--- a/mysql-test/suite/sys_vars/t/worker_info_repository_basic.test 1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/worker_info_repository_basic.test 2010-12-09 13:23:19 +0000
@@ -0,0 +1,76 @@
+############## mysql-test\t\worker_info_repository_basic.test #################
+# #
+# Variable Name: worker_info_repository #
+# Scope: Global #
+# Access Type: Static #
+# Data Type: enumeration #
+# #
+# #
+# Creation Date: 2010-12-09 #
+# Author : Alfranio Correia #
+# #
+# #
+# Description:Test Cases of System Variable worker_info_repository #
+# that checks the behavior of this variable in the following ways #
+# * Value Check #
+# * Scope Check #
+# #
+# Reference: #
+# http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html #
+# #
+###############################################################################
+--source include/not_worker_info_table.inc
+
+--echo '#---------------------BS_STVARS_002_01----------------------#'
+####################################################################
+# Displaying default value #
+####################################################################
+SELECT @@GLOBAL.worker_info_repository;
+
+SELECT COUNT(@@GLOBAL.worker_info_repository);
+--echo 1 Expected
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@SESSION.worker_info_repository);
+
+--echo '#---------------------BS_STVARS_002_02----------------------#'
+####################################################################
+# Check if Value can set #
+####################################################################
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SET @@GLOBAL.worker_info_repository= "TABLE";
+
+SELECT @@GLOBAL.worker_info_repository;
+
+
+--echo '#---------------------BS_STVARS_002_03----------------------#'
+#################################################################
+# Check if the value in GLOBAL Table matches value in variable #
+#################################################################
+SELECT @@GLOBAL.worker_info_repository = VARIABLE_VALUE
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='worker_info_repository';
+--echo 1 Expected
+
+SELECT COUNT(@@GLOBAL.worker_info_repository);
+--echo 1 Expected
+
+SELECT COUNT(VARIABLE_VALUE)
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
+WHERE VARIABLE_NAME='worker_info_repository';
+--echo 1 Expected
+
+
+--echo '#---------------------BS_STVARS_002_05----------------------#'
+################################################################################
+# Check if worker_info_repository can be accessed with and without @@ sign #
+################################################################################
+
+SELECT COUNT(@@worker_info_repository);
+--echo 1 Expected
+
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT COUNT(@@local.worker_info_repository);
+
+SELECT COUNT(@@GLOBAL.worker_info_repository);
+--echo 1 Expected
=== modified file 'sql/rpl_info_factory.cc'
--- a/sql/rpl_info_factory.cc 2010-12-08 01:30:32 +0000
+++ b/sql/rpl_info_factory.cc 2010-12-09 13:23:19 +0000
@@ -28,7 +28,6 @@
#define NUMBER_OF_FIELDS_TO_IDENTIFY_COORDINATOR 1
#define NUMBER_OF_FIELDS_TO_IDENTIFY_WORKER 2
-
/**
Creates both a Master info and a Relay log info repository whose types are
defined as parameters.
@@ -414,7 +413,7 @@ bool Rpl_info_factory::change_engine(Rpl
DBUG_RETURN(FALSE);
}
-Slave_worker *Rpl_info_factory::create_worker(uint rli_option, Relay_log_info *rli, uint worker_id)
+Slave_worker *Rpl_info_factory::create_worker(uint worker_option, Relay_log_info *rli, uint worker_id)
{
DBUG_ENTER("Rpl_info_factory::create_worker");
@@ -444,12 +443,12 @@ Slave_worker *Rpl_info_factory::create_w
key_info_idx[1]= worker_id;
worker->set_idx_info(key_info_idx, NUMBER_OF_FIELDS_TO_IDENTIFY_WORKER);
- DBUG_ASSERT(rli_option == RLI_REPOSITORY_FILE ||
- rli_option == RLI_REPOSITORY_TABLE ||
- rli_option == RLI_REPOSITORY_DUMMY);
+ DBUG_ASSERT(worker_option == WORKER_REPOSITORY_FILE ||
+ worker_option == WORKER_REPOSITORY_TABLE ||
+ worker_option == WORKER_REPOSITORY_DUMMY);
- if (rli_option == RLI_REPOSITORY_FILE ||
- rli_option == RLI_REPOSITORY_TABLE)
+ if (worker_option == WORKER_REPOSITORY_FILE ||
+ worker_option == WORKER_REPOSITORY_TABLE)
{
/*
Now we instantiate all info repos and later decide which one to take,
@@ -470,10 +469,10 @@ Slave_worker *Rpl_info_factory::create_w
only TABLES as repositories. /Alfranio
*/
if (decide_repository(worker, &w_table, &w_file,
- rli_option == MI_REPOSITORY_TABLE, &msg))
+ worker_option == MI_REPOSITORY_TABLE, &msg))
goto err;
- if ((rli_option == RLI_REPOSITORY_TABLE) &&
+ if ((worker_option == RLI_REPOSITORY_TABLE) &&
change_engine(static_cast<Rpl_info_table *>(w_table),
relay_log_info_engine, &msg))
goto err;
=== modified file 'sql/rpl_info_factory.h'
--- a/sql/rpl_info_factory.h 2010-11-30 02:08:01 +0000
+++ b/sql/rpl_info_factory.h 2010-12-09 13:23:19 +0000
@@ -41,6 +41,14 @@ enum enum_rli_repository
};
extern ulong opt_rli_repository_id;
+enum enum_worker_repository
+{
+ WORKER_REPOSITORY_FILE= 0,
+ WORKER_REPOSITORY_TABLE= 1,
+ WORKER_REPOSITORY_DUMMY= 2
+};
+extern ulong opt_worker_repository_id;
+
#define MI_SCHEMA "mysql"
#define MI_TABLE "slave_master_info"
=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc 2010-12-08 16:15:41 +0000
+++ b/sql/rpl_slave.cc 2010-12-09 13:23:19 +0000
@@ -3922,7 +3922,7 @@ int slave_start_single_worker(Relay_log_
uint k;
pthread_t th;
Slave_worker *w=
- Rpl_info_factory::create_worker(opt_rli_repository_id, rli, i);
+ Rpl_info_factory::create_worker(opt_worker_repository_id, rli, i);
Slave_job_item empty= {NULL};
w->c_rli= rli;
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2010-12-08 00:33:48 +0000
+++ b/sql/sys_vars.cc 2010-12-09 13:23:19 +0000
@@ -416,7 +416,11 @@ static Sys_var_mybool Sys_binlog_direct(
static const char *repository_names[]=
{
- "FILE", "TABLE", 0
+ "FILE", "TABLE",
+#ifndef DBUG_OFF
+ "DUMMY",
+#endif
+ 0
};
ulong opt_mi_repository_id;
@@ -433,6 +437,13 @@ static Sys_var_enum Sys_rli_repository(
, READ_ONLY GLOBAL_VAR(opt_rli_repository_id), CMD_LINE(REQUIRED_ARG),
repository_names, DEFAULT(0));
+ulong opt_worker_repository_id;
+static Sys_var_enum Sys_worker_repository(
+ "worker_info_repository",
+ "Defines the type of the repository for the worker information."
+ , READ_ONLY GLOBAL_VAR(opt_worker_repository_id), CMD_LINE(REQUIRED_ARG),
+ repository_names, DEFAULT(0));
+
static Sys_var_mybool Sys_binlog_rows_query(
"binlog_rows_query_log_events",
"Allow writing of Rows_query_log events into binary log.",
Attachment: [text/bzr-bundle] bzr/alfranio.correia@oracle.com-20101209132319-vra0xr293jed7lei.bundle
| Thread |
|---|
| • bzr push into mysql-next-mr-wl5569 branch (alfranio.correia:3237 to 3239)WL#5599 | Alfranio Correia | 9 Dec |