#At file:///data0/magnus/mysql/5.5-telco-7.0/ based on revid:magnus.blaudd@strippedhz3
3217 Magnus Blåudd 2011-02-21
ndb
- add MCP patch for WL3733 slave_allow_batching
- update sys_vars.slave_allow_batching testcase
modified:
mysql-test/suite/sys_vars/r/slave_allow_batching_basic.result
mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test
sql/log_event.cc
sql/sql_priv.h
sql/sys_vars.cc
=== modified file 'mysql-test/suite/sys_vars/r/slave_allow_batching_basic.result'
--- a/mysql-test/suite/sys_vars/r/slave_allow_batching_basic.result 2010-10-27 11:32:32 +0000
+++ b/mysql-test/suite/sys_vars/r/slave_allow_batching_basic.result 2011-02-21 13:17:25 +0000
@@ -1,11 +1,101 @@
SET @global_start_value = @@global.slave_allow_batching;
-ERROR HY000: Unknown system variable 'slave_allow_batching'
+SELECT @global_start_value;
+@global_start_value
+0
'#--------------------FN_DYNVARS_145_01------------------------#'
+SET @@global.slave_allow_batching = 1;
+SET @@global.slave_allow_batching = DEFAULT;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+0
'#---------------------FN_DYNVARS_145_02-------------------------#'
+SET slave_allow_batching = 1;
+ERROR HY000: Variable 'slave_allow_batching' is a GLOBAL variable and should be set with SET GLOBAL
+SELECT @@slave_allow_batching;
+@@slave_allow_batching
+0
+SELECT global.slave_allow_batching;
+ERROR 42S02: Unknown table 'global' in field list
+SET global slave_allow_batching = 1;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+1
'#--------------------FN_DYNVARS_145_03------------------------#'
+SET @@global.slave_allow_batching = 0;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+0
+SET @@global.slave_allow_batching = 1;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+1
'#--------------------FN_DYNVARS_145_04-------------------------#'
+SET @@global.slave_allow_batching = -1;
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of '-1'
+SET @@global.slave_allow_batching = 2;
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of '2'
+SET @@global.slave_allow_batching = "T";
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of 'T'
+SET @@global.slave_allow_batching = "Y";
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of 'Y'
+SET @@global.slave_allow_batching = YES;
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of 'YES'
+SET @@global.slave_allow_batching = ONN;
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of 'ONN'
+SET @@global.slave_allow_batching = OOF;
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of 'OOF'
+SET @@global.slave_allow_batching = 0FF;
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of '0FF'
+SET @@global.slave_allow_batching = ' 1';
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of ' 1'
+SET @@global.slave_allow_batching = NO;
+ERROR 42000: Variable 'slave_allow_batching' can't be set to the value of 'NO'
'#-------------------FN_DYNVARS_145_05----------------------------#'
+SET @@session.slave_allow_batching = 0;
+ERROR HY000: Variable 'slave_allow_batching' is a GLOBAL variable and should be set with SET GLOBAL
+SET @@slave_allow_batching = 0;
+ERROR HY000: Variable 'slave_allow_batching' is a GLOBAL variable and should be set with SET GLOBAL
+SET @@local.slave_allow_batching = 0;
+ERROR HY000: Variable 'slave_allow_batching' is a GLOBAL variable and should be set with SET GLOBAL
+SELECT @@session.slave_allow_batching;
+ERROR HY000: Variable 'slave_allow_batching' is a GLOBAL variable
+SELECT @@local.slave_allow_batching;
+ERROR HY000: Variable 'slave_allow_batching' is a GLOBAL variable
'#----------------------FN_DYNVARS_145_06------------------------#'
+SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
+count(VARIABLE_VALUE)
+1
'#----------------------FN_DYNVARS_145_07------------------------#'
+SELECT @@global.slave_allow_batching = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
+@@global.slave_allow_batching = VARIABLE_VALUE
+0
+Warnings:
+Warning 1292 Truncated incorrect DOUBLE value: 'ON'
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+1
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
+VARIABLE_VALUE
+ON
'#---------------------FN_DYNVARS_145_08-------------------------#'
+SET @@global.slave_allow_batching = OFF;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+0
+SET @@global.slave_allow_batching = ON;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+1
'#---------------------FN_DYNVARS_145_09----------------------#'
+SET @@global.slave_allow_batching = TRUE;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+1
+SET @@global.slave_allow_batching = FALSE;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+0
+SET @@global.slave_allow_batching = @global_start_value;
+SELECT @@global.slave_allow_batching;
+@@global.slave_allow_batching
+0
=== modified file 'mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test'
--- a/mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test 2010-10-27 11:32:32 +0000
+++ b/mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test 2011-02-21 13:17:25 +0000
@@ -34,31 +34,31 @@
# Saving initial value of slave_allow_batching in a temporary variable #
################################################################################
---Error ER_UNKNOWN_SYSTEM_VARIABLE
SET @global_start_value = @@global.slave_allow_batching;
+SELECT @global_start_value;
--echo '#--------------------FN_DYNVARS_145_01------------------------#'
########################################################################
# Display the DEFAULT value of slave_allow_batching #
########################################################################
-#SET @@global.slave_allow_batching = 1;
-#SET @@global.slave_allow_batching = DEFAULT;
-#SELECT @@global.slave_allow_batching;
+SET @@global.slave_allow_batching = 1;
+SET @@global.slave_allow_batching = DEFAULT;
+SELECT @@global.slave_allow_batching;
--echo '#---------------------FN_DYNVARS_145_02-------------------------#'
#############################################################################
# Check if slave_allow_batching can be accessed with and without @@ sign #
#############################################################################
-#--Error ER_GLOBAL_VARIABLE
-#SET slave_allow_batching = 1;
-#SELECT @@slave_allow_batching;
-#--Error ER_UNKNOWN_TABLE
-#SELECT global.slave_allow_batching;
-#
-#SET global slave_allow_batching = 1;
-#SELECT @@global.slave_allow_batching;
+--Error ER_GLOBAL_VARIABLE
+SET slave_allow_batching = 1;
+SELECT @@slave_allow_batching;
+--Error ER_UNKNOWN_TABLE
+SELECT global.slave_allow_batching;
+
+SET global slave_allow_batching = 1;
+SELECT @@global.slave_allow_batching;
--echo '#--------------------FN_DYNVARS_145_03------------------------#'
@@ -66,10 +66,10 @@ SET @global_start_value = @@global.slave
# Change the value of slave_allow_batching to a valid value #
########################################################################
-#SET @@global.slave_allow_batching = 0;
-#SELECT @@global.slave_allow_batching;
-#SET @@global.slave_allow_batching = 1;
-#SELECT @@global.slave_allow_batching;
+SET @@global.slave_allow_batching = 0;
+SELECT @@global.slave_allow_batching;
+SET @@global.slave_allow_batching = 1;
+SELECT @@global.slave_allow_batching;
--echo '#--------------------FN_DYNVARS_145_04-------------------------#'
@@ -77,26 +77,26 @@ SET @global_start_value = @@global.slave
# Change the value of slave_allow_batching to invalid value #
###########################################################################
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.slave_allow_batching = -1;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.slave_allow_batching = 2;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.slave_allow_batching = "T";
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.slave_allow_batching = "Y";
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.slave_allow_batching = YES;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.slave_allow_batching = ONN;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.slave_allow_batching = OOF;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.slave_allow_batching = 0FF;
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.slave_allow_batching = ' 1';
-#--Error ER_WRONG_VALUE_FOR_VAR
-#SET @@global.slave_allow_batching = NO;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = 2;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = "T";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = "Y";
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = YES;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = ONN;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = OOF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = 0FF;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = ' 1';
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.slave_allow_batching = NO;
--echo '#-------------------FN_DYNVARS_145_05----------------------------#'
@@ -104,23 +104,23 @@ SET @global_start_value = @@global.slave
# Test if accessing session slave_allow_batching gives error #
###########################################################################
-#--Error ER_GLOBAL_VARIABLE
-#SET @@session.slave_allow_batching = 0;
-#--Error ER_GLOBAL_VARIABLE
-#SET @@slave_allow_batching = 0;
-#--Error ER_GLOBAL_VARIABLE
-#SET @@local.slave_allow_batching = 0;
-#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-#SELECT @@session.slave_allow_batching;
-#--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
-#SELECT @@local.slave_allow_batching;
+--Error ER_GLOBAL_VARIABLE
+SET @@session.slave_allow_batching = 0;
+--Error ER_GLOBAL_VARIABLE
+SET @@slave_allow_batching = 0;
+--Error ER_GLOBAL_VARIABLE
+SET @@local.slave_allow_batching = 0;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@session.slave_allow_batching;
+--Error ER_INCORRECT_GLOBAL_LOCAL_VAR
+SELECT @@local.slave_allow_batching;
--echo '#----------------------FN_DYNVARS_145_06------------------------#'
#########################################################################
# Check if the value in SESSION Table contains variable value #
#########################################################################
-#SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
+SELECT count(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
--echo '#----------------------FN_DYNVARS_145_07------------------------#'
@@ -128,38 +128,37 @@ SET @global_start_value = @@global.slave
# Check if the value in GLOBAL Table matches value in variable #
#########################################################################
-#SELECT IF(@@global.slave_allow_batching, "ON", "OFF") = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
-#SELECT @@global.slave_allow_batching;
-#SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
-#--echo 'Bug: value in information schema does not match'
+SELECT @@global.slave_allow_batching = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
+SELECT @@global.slave_allow_batching;
+SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='slave_allow_batching';
--echo '#---------------------FN_DYNVARS_145_08-------------------------#'
###################################################################
# Check if ON and OFF values can be used on variable #
###################################################################
-#SET @@global.slave_allow_batching = OFF;
-#SELECT @@global.slave_allow_batching;
-#SET @@global.slave_allow_batching = ON;
-#SELECT @@global.slave_allow_batching;
+SET @@global.slave_allow_batching = OFF;
+SELECT @@global.slave_allow_batching;
+SET @@global.slave_allow_batching = ON;
+SELECT @@global.slave_allow_batching;
--echo '#---------------------FN_DYNVARS_145_09----------------------#'
###################################################################
# Check if TRUE and FALSE values can be used on variable #
###################################################################
-#SET @@global.slave_allow_batching = TRUE;
-#SELECT @@global.slave_allow_batching;
-#SET @@global.slave_allow_batching = FALSE;
-#SELECT @@global.slave_allow_batching;
+SET @@global.slave_allow_batching = TRUE;
+SELECT @@global.slave_allow_batching;
+SET @@global.slave_allow_batching = FALSE;
+SELECT @@global.slave_allow_batching;
##############################
# Restore initial value #
##############################
-#SET @@global.slave_allow_batching = @global_start_value;
-#SELECT @@global.slave_allow_batching;
+SET @@global.slave_allow_batching = @global_start_value;
+SELECT @@global.slave_allow_batching;
###############################################################
# END OF slave_allow_batching TESTS #
-###############################################################
+###############################################################
=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc 2010-11-16 12:37:26 +0000
+++ b/sql/log_event.cc 2011-02-21 13:17:25 +0000
@@ -7590,6 +7590,12 @@ int Rows_log_event::do_apply_event(Relay
thd->variables.option_bits|= OPTION_RELAXED_UNIQUE_CHECKS;
else
thd->variables.option_bits&= ~OPTION_RELAXED_UNIQUE_CHECKS;
+#ifndef MCP_WL3733
+ if (slave_allow_batching)
+ thd->variables.option_bits|= OPTION_ALLOW_BATCH;
+ else
+ thd->variables.option_bits&= ~OPTION_ALLOW_BATCH;
+#endif
/* A small test to verify that objects have consistent types */
DBUG_ASSERT(sizeof(thd->variables.option_bits) == sizeof(OPTION_RELAXED_UNIQUE_CHECKS));
@@ -7821,7 +7827,11 @@ int Rows_log_event::do_apply_event(Relay
}
} // if (table)
-
+#ifndef MCP_WL3733
+ /* reset OPTION_ALLOW_BATCH as not affect later events */
+ thd->variables.option_bits&= ~OPTION_ALLOW_BATCH;
+#endif
+
if (error)
{
slave_rows_error_report(ERROR_LEVEL, error, rli, thd, table,
@@ -9152,6 +9162,24 @@ int Rows_log_event::find_row(const Relay
table->s->reclength) == 0);
*/
+
+#ifndef MCP_WL3733
+ /*
+ Ndb does not need read before delete/update (and no updates are sent)
+ if primary key specified
+
+ (Actually uniquekey will also do, but pk will be in each
+ row if table has pk)
+
+ Also set ignore no key, as we don't really know if row exists...
+ */
+ if (table->file->ht->db_type == DB_TYPE_NDBCLUSTER)
+ {
+ table->file->extra(HA_EXTRA_IGNORE_NO_KEY);
+ DBUG_RETURN(0);
+ }
+#endif
+
DBUG_PRINT("info",("locating record using primary key (position)"));
int error= table->file->rnd_pos_by_record(table->record[0]);
if (error)
=== modified file 'sql/sql_priv.h'
--- a/sql/sql_priv.h 2011-02-21 12:09:15 +0000
+++ b/sql/sql_priv.h 2011-02-21 13:17:25 +0000
@@ -144,6 +144,14 @@
*/
#define OPTION_MASTER_SQL_ERROR (1ULL << 35)
+#ifndef MCP_WL3733
+/*
+ Dont report errors for individual rows,
+ But just report error on commit (or read ofcourse)
+ Note! Reserved for use in MySQL Cluster
+*/
+#define OPTION_ALLOW_BATCH (ULL(1) << 36) // THD, intern (slave)
+#endif
/* The rest of the file is included in the server only */
#ifndef MYSQL_CLIENT
=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc 2010-11-25 15:15:07 +0000
+++ b/sql/sys_vars.cc 2011-02-21 13:17:25 +0000
@@ -2392,6 +2392,14 @@ static Sys_var_ulong Sys_profiling_histo
VALID_RANGE(0, 100), DEFAULT(15), BLOCK_SIZE(1));
#endif
+#ifndef MCP_WL3733
+my_bool slave_allow_batching;
+static Sys_var_mybool Sys_slave_allow_batching(
+ "slave_allow_batching", "Allow slave to batch requests",
+ GLOBAL_VAR(slave_allow_batching),
+ CMD_LINE(OPT_ARG), DEFAULT(FALSE));
+#endif
+
static Sys_var_harows Sys_select_limit(
"sql_select_limit",
"The maximum number of rows to return from SELECT statements",
Attachment: [text/bzr-bundle] bzr/magnus.blaudd@oracle.com-20110221131725-o3f4bqxkwr2rkrj4.bundle