List:Commits« Previous MessageNext Message »
From:Magnus Blåudd Date:October 22 2010 9:01am
Subject:bzr commit into mysql-5.5-telco branch (magnus.blaudd:3094)
View as plain text  
#At file:///home/msvensson/mysql/5.5-telco-wl3733/ based on revid:magnus.blaudd@strippedx10xx

 3094 Magnus Blåudd	2010-10-22
      ndb
       - Apply MCP patch for WL3733 --slave-allow-batching
       - Some question marks inline

    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/mysqld.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	2009-12-22 09:35:56 +0000
+++ b/mysql-test/suite/sys_vars/r/slave_allow_batching_basic.result	2010-10-22 09:01:30 +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	2009-12-22 09:35:56 +0000
+++ b/mysql-test/suite/sys_vars/t/slave_allow_batching_basic.test	2010-10-22 09:01:30 +0000
@@ -23,8 +23,8 @@
 #                                                                              #
 ################################################################################
 
+--source include/not_embedded.inc
 --source include/load_sysvars.inc
-
 ######################################################################## 
 #                    START OF slave_allow_batching TESTS               #
 ######################################################################## 
@@ -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,37 +128,36 @@ 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-10-22 07:42:27 +0000
+++ b/sql/log_event.cc	2010-10-22 09:01:30 +0000
@@ -7508,6 +7508,10 @@ int Rows_log_event::do_add_row_data(ucha
 #endif
 
 #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
+
+#ifndef MCP_WL3733
+extern bool slave_allow_batching;
+#endif
 int Rows_log_event::do_apply_event(Relay_log_info const *rli)
 {
   DBUG_ENTER("Rows_log_event::do_apply_event(Relay_log_info*)");
@@ -7585,6 +7589,19 @@ 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
+    /*
+      Setting thd->option in order to trick ha_ndbcluster into
+      using batching, why can't it look at slave_allow_batching
+      variable directly or implement ndb_slave_allow_batching?
+     */
+    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));
 
@@ -7816,6 +7833,10 @@ int Rows_log_event::do_apply_event(Relay
     }
   } // if (table)
 
+#ifndef MCP_WL3733
+  /* reset OPTION_ALLOW_BATCH as not affect later events */
+  // thd->options&= ~OPTION_ALLOW_BATCH;
+#endif
   
   if (error)
   {
@@ -9150,6 +9171,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/mysqld.h'
--- a/sql/mysqld.h	2010-10-22 07:42:27 +0000
+++ b/sql/mysqld.h	2010-10-22 09:01:30 +0000
@@ -163,7 +163,6 @@ extern ulong slow_launch_threads, slow_l
 extern ulong table_cache_size, table_def_size;
 extern MYSQL_PLUGIN_IMPORT ulong max_connections;
 extern ulong max_connect_errors, connect_timeout;
-extern my_bool slave_allow_batching;
 extern my_bool allow_slave_start;
 extern LEX_CSTRING reason_slave_blocked;
 extern ulong slave_trans_retries;

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2010-10-22 07:42:27 +0000
+++ b/sql/sys_vars.cc	2010-10-22 09:01:30 +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
+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@sun.com-20101022090130-4z27ye2mirzoh63n.bundle
Thread
bzr commit into mysql-5.5-telco branch (magnus.blaudd:3094) Magnus Blåudd22 Oct