List:Commits« Previous MessageNext Message »
From:Mikael Ronstrom Date:September 14 2012 1:02pm
Subject:bzr push into mysql-5.5-cluster-7.2 branch (mikael.ronstrom:3971 to 3974)
View as plain text  
 3974 Mikael Ronstrom	2012-09-14
      Removed debug printouts

    modified:
      sql/ha_ndbcluster.cc
 3973 Mikael Ronstrom	2012-09-14
      More tests added, fixed bug

    added:
      mysql-test/suite/ndb/r/ndb_recv_thread_activation_threshold_basic.result
      mysql-test/suite/ndb/t/ndb_recv_thread_activation_threshold_basic.test
    modified:
      mysql-test/suite/ndb/t/ndb_recv_thread_cpu_mask_basic.test
      sql/ha_ndbcluster.cc
      storage/ndb/src/ndbapi/TransporterFacade.cpp
 3972 Mikael Ronstrom	2012-09-14
      Remove parameter for number of receive threads which isn't used

    modified:
      sql/ha_ndbcluster.cc
 3971 Mikael Ronstrom	2012-09-13
      Added support for unlocking receive threads from locking to CPUs

    modified:
      mysql-test/suite/ndb/r/ndb_recv_thread_cpu_mask_basic.result
      mysql-test/suite/ndb/t/ndb_recv_thread_cpu_mask_basic.test
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster_connection.cc
      storage/ndb/include/ndbapi/ndb_cluster_connection.hpp
      storage/ndb/include/portlib/NdbThread.h
      storage/ndb/src/ndbapi/TransporterFacade.cpp
      storage/ndb/src/ndbapi/TransporterFacade.hpp
      storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
=== added file 'mysql-test/suite/ndb/r/ndb_recv_thread_activation_threshold_basic.result'
--- a/mysql-test/suite/ndb/r/ndb_recv_thread_activation_threshold_basic.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/r/ndb_recv_thread_activation_threshold_basic.result	revid:mikael.ronstrom@stripped
@@ -0,0 +1,81 @@
+SET @global_start_value = @@global.ndb_recv_thread_activation_threshold;
+SELECT @global_start_value;
+@global_start_value
+8
+'#--------------------FN_DYNVARS_183_01------------------------#'
+SET @@global.ndb_recv_thread_activation_threshold = 1;
+SET @@global.ndb_recv_thread_activation_threshold = DEFAULT;
+SELECT @@global.ndb_recv_thread_activation_threshold;
+@@global.ndb_recv_thread_activation_threshold
+1
+'#---------------------FN_DYNVARS_183_02-------------------------#'
+SET @@global.ndb_recv_thread_activation_threshold = NULL;
+ERROR 42000: Incorrect argument type to variable 'ndb_recv_thread_activation_threshold'
+SET @@global.ndb_recv_thread_activation_threshold = '';
+ERROR 42000: Incorrect argument type to variable 'ndb_recv_thread_activation_threshold'
+'#--------------------FN_DYNVARS_183_03------------------------#'
+SET @@global.ndb_recv_thread_activation_threshold = 0;
+SELECT @@global.ndb_recv_thread_activation_threshold;
+@@global.ndb_recv_thread_activation_threshold
+0
+SET @@global.ndb_recv_thread_activation_threshold = 4;
+SELECT @@global.ndb_recv_thread_activation_threshold;
+@@global.ndb_recv_thread_activation_threshold
+4
+SET @@global.ndb_recv_thread_activation_threshold = 8;
+SELECT @@global.ndb_recv_thread_activation_threshold;
+@@global.ndb_recv_thread_activation_threshold
+8
+SET @@global.ndb_recv_thread_activation_threshold = 12;
+SELECT @@global.ndb_recv_thread_activation_threshold;
+@@global.ndb_recv_thread_activation_threshold
+12
+SET @@global.ndb_recv_thread_activation_threshold = 16;
+SELECT @@global.ndb_recv_thread_activation_threshold;
+@@global.ndb_recv_thread_activation_threshold
+16
+'#--------------------FN_DYNVARS_183_04-------------------------#'
+SET @@global.ndb_recv_thread_activation_threshold = -1;
+ERROR 42000: Variable 'ndb_recv_thread_activation_threshold' can't be set to the value of '-1'
+SET @@global.ndb_recv_thread_activation_threshold = 17;
+ERROR 42000: Variable 'ndb_recv_thread_activation_threshold' can't be set to the value of '17'
+SET @@global.ndb_recv_thread_activation_threshold = READUNCOMMITTED;
+ERROR 42000: Incorrect argument type to variable 'ndb_recv_thread_activation_threshold'
+SET @@global.ndb_recv_thread_activation_threshold = 'REPEATABLE';
+ERROR 42000: Incorrect argument type to variable 'ndb_recv_thread_activation_threshold'
+SET @@global.ndb_recv_thread_activation_threshold = OFF;
+ERROR 42000: Incorrect argument type to variable 'ndb_recv_thread_activation_threshold'
+SET @@global.ndb_recv_thread_activation_threshold = ON;
+ERROR 42000: Incorrect argument type to variable 'ndb_recv_thread_activation_threshold'
+SET @@global.ndb_recv_thread_activation_threshold = 'NON-SERIALIZABLE';
+ERROR 42000: Incorrect argument type to variable 'ndb_recv_thread_activation_threshold'
+'#----------------------FN_DYNVARS_183_06------------------------#'
+SELECT @@global.ndb_recv_thread_activation_threshold = VARIABLE_VALUE 
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+WHERE VARIABLE_NAME='ndb_recv_thread_activation_threshold';
+@@global.ndb_recv_thread_activation_threshold = VARIABLE_VALUE
+1
+'#---------------------FN_DYNVARS_183_07-------------------------#'
+SET @@global.ndb_recv_thread_activation_threshold = 0;
+SET @@global.ndb_recv_thread_activation_threshold = 1;
+SET @@global.ndb_recv_thread_activation_threshold = 2;
+SET @@global.ndb_recv_thread_activation_threshold = 0.4;
+ERROR 42000: Incorrect argument type to variable 'ndb_recv_thread_activation_threshold'
+'#---------------------FN_DYNVARS_183_08----------------------#'
+SET @@global.ndb_recv_thread_activation_threshold = TRUE;
+SET @@global.ndb_recv_thread_activation_threshold = FALSE;
+'#---------------------FN_DYNVARS_183_09----------------------#'
+SET ndb_recv_thread_activation_threshold = 1;
+ERROR HY000: Variable 'ndb_recv_thread_activation_threshold' is a GLOBAL variable and should be set with SET GLOBAL
+SET global.ndb_recv_thread_activation_threshold = 3;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ndb_recv_thread_activation_threshold = 3' at line 1
+SET session ndb_recv_thread_activation_threshold = 4;
+ERROR HY000: Variable 'ndb_recv_thread_activation_threshold' is a GLOBAL variable and should be set with SET GLOBAL
+SET global ndb_recv_thread_activation_threshold = 5;
+SELECT @@global.ndb_recv_thread_activation_threshold;
+@@global.ndb_recv_thread_activation_threshold
+5
+SET @@global.ndb_recv_thread_activation_threshold = @global_start_value;
+SELECT @@global.ndb_recv_thread_activation_threshold;
+@@global.ndb_recv_thread_activation_threshold
+8

=== added file 'mysql-test/suite/ndb/t/ndb_recv_thread_activation_threshold_basic.test'
--- a/mysql-test/suite/ndb/t/ndb_recv_thread_activation_threshold_basic.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb/t/ndb_recv_thread_activation_threshold_basic.test	revid:mikael.ronstrom@stripped
@@ -0,0 +1,164 @@
+## mysql-test\suite\ndb\t\ndb_recv_thread_activation_threshold_basic.test #####
+#                                                                             #
+# Variable Name: ndb_recv_thread_activation_threshold_basic                   #
+# Scope: GLOBAL                                                               #
+# Access Type: Dynamic                                                        #
+# Data Type:integer                                                           #
+# Default Value: 8                                                            #
+# Valid Values: 0-16                                                          #
+#                                                                             #
+#                                                                             #
+# Creation Date: 2012-09-14                                                   #
+# Author:  Mikael Ronstrom                                                    #
+#                                                                             #
+# Description: Test Cases of Dynamic System Variable                          #
+#              ndb_recv_thread_activation_threshold                           #
+#              that checks the behavior of this variable in the following ways#
+#              * Default Value                                                #
+#              * Valid & Invalid values                                       #
+#              * Scope & Access method                                        #
+#              * Data Integrity                                               #
+#                                                                             #
+# Reference: http://dev.mysql.com/doc/refman/5.5/en/                          #
+#  mysql-cluster-params-overview.html
+#                                                                             #
+###############################################################################
+
+--source include/load_sysvars.inc
+
+######################################################################## 
+#   START OF ndb_recv_thread_activation_threshold TESTS                #
+######################################################################## 
+
+
+##############################################################################
+# Saving initial value of ndb_recv_thread_activation_threshold in a          #
+# temporary variable                                                         #
+##############################################################################
+
+SET @global_start_value = @@global.ndb_recv_thread_activation_threshold;
+SELECT @global_start_value;
+
+--echo '#--------------------FN_DYNVARS_183_01------------------------#'
+####################################################################
+# Display the DEFAULT value of ndb_recv_thread_activation_threshold#
+####################################################################
+
+SET @@global.ndb_recv_thread_activation_threshold = 1;
+SET @@global.ndb_recv_thread_activation_threshold = DEFAULT;
+SELECT @@global.ndb_recv_thread_activation_threshold;
+
+--echo '#---------------------FN_DYNVARS_183_02-------------------------#'
+######################################################### 
+#      Check if NULL or empty value is accepted         #
+######################################################### 
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.ndb_recv_thread_activation_threshold = NULL;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.ndb_recv_thread_activation_threshold = '';
+
+--echo '#--------------------FN_DYNVARS_183_03------------------------#'
+#####################################################################
+#  Change the value of ndb_recv_thread_activation_threshold to a    #
+#  valid value                                                      #
+#####################################################################
+
+SET @@global.ndb_recv_thread_activation_threshold = 0;
+SELECT @@global.ndb_recv_thread_activation_threshold;
+
+SET @@global.ndb_recv_thread_activation_threshold = 4;
+SELECT @@global.ndb_recv_thread_activation_threshold;
+
+SET @@global.ndb_recv_thread_activation_threshold = 8;
+SELECT @@global.ndb_recv_thread_activation_threshold;
+
+SET @@global.ndb_recv_thread_activation_threshold = 12;
+SELECT @@global.ndb_recv_thread_activation_threshold;
+
+SET @@global.ndb_recv_thread_activation_threshold = 16;
+SELECT @@global.ndb_recv_thread_activation_threshold;
+
+--echo '#--------------------FN_DYNVARS_183_04-------------------------#'
+#######################################################################
+# Change the value of ndb_recv_thread_activation_threshold to invalid #
+# value                                                               #
+#######################################################################
+
+# for global scope
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.ndb_recv_thread_activation_threshold = -1;
+--Error ER_WRONG_VALUE_FOR_VAR
+SET @@global.ndb_recv_thread_activation_threshold = 17;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.ndb_recv_thread_activation_threshold = READUNCOMMITTED;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.ndb_recv_thread_activation_threshold = 'REPEATABLE';
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.ndb_recv_thread_activation_threshold = OFF;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.ndb_recv_thread_activation_threshold = ON;
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.ndb_recv_thread_activation_threshold = 'NON-SERIALIZABLE';
+
+--echo '#----------------------FN_DYNVARS_183_06------------------------#'
+######################################################################### 
+#     Check if the value in GLOBAL Table matches value in variable      #
+#########################################################################
+
+SELECT @@global.ndb_recv_thread_activation_threshold = VARIABLE_VALUE 
+FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 
+WHERE VARIABLE_NAME='ndb_recv_thread_activation_threshold';
+
+--echo '#---------------------FN_DYNVARS_183_07-------------------------#'
+################################################################### 
+#        Check if numbers can be used on variable                 #
+################################################################### 
+
+# test if variable accepts 0,1,2
+SET @@global.ndb_recv_thread_activation_threshold = 0;
+
+SET @@global.ndb_recv_thread_activation_threshold = 1;
+
+SET @@global.ndb_recv_thread_activation_threshold = 2;
+
+--Error ER_WRONG_TYPE_FOR_VAR
+SET @@global.ndb_recv_thread_activation_threshold = 0.4;
+
+--echo '#---------------------FN_DYNVARS_183_08----------------------#'
+################################################################### 
+#      Check if TRUE and FALSE values can be used on variable     #
+################################################################### 
+
+SET @@global.ndb_recv_thread_activation_threshold = TRUE;
+SET @@global.ndb_recv_thread_activation_threshold = FALSE;
+
+--echo '#---------------------FN_DYNVARS_183_09----------------------#'
+######################################################################## 
+# Check if ndb_recv_thread_activation_threshold can be accessed with   #
+# and without @@ sign                                                  #
+########################################################################
+
+--Error ER_GLOBAL_VARIABLE
+SET ndb_recv_thread_activation_threshold = 1;
+
+--Error ER_PARSE_ERROR
+SET global.ndb_recv_thread_activation_threshold = 3;
+#using SET SESSION|GLOBAL syntax
+--Error ER_GLOBAL_VARIABLE
+SET session ndb_recv_thread_activation_threshold = 4;
+
+SET global ndb_recv_thread_activation_threshold = 5;
+SELECT @@global.ndb_recv_thread_activation_threshold;
+
+##############################
+#   Restore initial value    #
+##############################
+
+SET @@global.ndb_recv_thread_activation_threshold = @global_start_value;
+SELECT @@global.ndb_recv_thread_activation_threshold;
+
+####################################################################
+#        END OF ndb_recv_thread_activation_threshold TESTS         #
+####################################################################

=== modified file 'mysql-test/suite/ndb/t/ndb_recv_thread_cpu_mask_basic.test'
--- a/mysql-test/suite/ndb/t/ndb_recv_thread_cpu_mask_basic.test	revid:mikael.ronstrom@stripped
+++ b/mysql-test/suite/ndb/t/ndb_recv_thread_cpu_mask_basic.test	revid:mikael.ronstrom@stripped
@@ -40,7 +40,7 @@ SELECT @global_start_value;
 
 --echo '#--------------------FN_DYNVARS_183_01------------------------#'
 ####################################################################
-#                    Display the DEFAULT value of tx_isolation     #
+#        Display the DEFAULT value of ndb_recv_thread_cpu_mask     #
 ####################################################################
 
 SET @@global.ndb_recv_thread_cpu_mask = '1';
@@ -75,7 +75,7 @@ SELECT @@global.ndb_recv_thread_cpu_mask
 
 --echo '#--------------------FN_DYNVARS_183_04-------------------------#'
 #######################################################################
-#               Change the value of tx_isolation to invalid value     #
+#   Change the value of ndb_recv_thread_cpu_mask to invalid value     #
 #######################################################################
 
 # for global scope
@@ -134,7 +134,8 @@ SET @@global.ndb_recv_thread_cpu_mask = 
 
 --echo '#---------------------FN_DYNVARS_183_09----------------------#'
 ######################################################################## 
-# Check if tx_isolation can be accessed with and without @@ sign       #
+# Check if ndb_recv_thread_cpu_mask can be accessed with and without   #
+# @@ sign                                                              #
 ########################################################################
 
 --Error ER_GLOBAL_VARIABLE
@@ -159,4 +160,3 @@ SELECT @@global.ndb_recv_thread_cpu_mask
 ####################################################################
 #        END OF ndb_recv_thread_cpu_mask TESTS                     #
 ####################################################################
-

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	revid:mikael.ronstrom@stripped
+++ b/sql/ha_ndbcluster.cc	revid:mikael.ronstrom@stripped
@@ -75,7 +75,6 @@ static ulong opt_ndb_wait_connected;
 ulong opt_ndb_wait_setup;
 static ulong opt_ndb_cache_check_time;
 static uint opt_ndb_cluster_connection_pool;
-static uint opt_ndb_num_recv_threads;
 static uint opt_ndb_recv_thread_activation_threshold;
 static char* opt_ndb_recv_thread_cpu_mask;
 static char* opt_ndb_index_stat_option;
@@ -11943,7 +11942,7 @@ static int ndbcluster_init(void *p)
                          (global_opti_node_select & 1),
                          opt_ndb_connectstring,
                          opt_ndb_nodeid,
-                         opt_ndb_num_recv_threads,
+                         1,
                          opt_ndb_recv_thread_activation_threshold))
   {
     DBUG_PRINT("error", ("Could not initiate connection to cluster"));
@@ -17116,19 +17115,29 @@ static MYSQL_SYSVAR_UINT(
   0                                  /* block */
 );
 
-#define MAX_NUM_RECV_THREADS 4
-static MYSQL_SYSVAR_UINT(
-  num_recv_threads,   /* name */
-  opt_ndb_num_recv_threads,/* var */
-  PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
-  "Number of receive threads per cluster connection",
-  NULL,                              /* check func. */
-  NULL,                              /* update func. */
-  1,                                 /* default */
-  1,                                 /* min */
-  MAX_NUM_RECV_THREADS,              /* max */
-  0                                  /* block */
-);
+#define MIN_ACTIVATION_THRESHOLD 0
+#define MAX_ACTIVATION_THRESHOLD 16
+
+static
+int
+ndb_recv_thread_activation_threshold_check(MYSQL_THD thd,
+                                           struct st_mysql_sys_var *var,
+                                           void *save,
+                                           struct st_mysql_value *value)
+{
+  long long int_buf;
+  int val = (int)value->val_int(value, &int_buf);
+  int new_val = (int)int_buf;
+
+  if (val != 0 || 
+      new_val < MIN_ACTIVATION_THRESHOLD ||
+      new_val > MAX_ACTIVATION_THRESHOLD)
+  {
+    return 1;
+  }
+  opt_ndb_recv_thread_activation_threshold = new_val;
+  return 0;
+}
 
 static
 void
@@ -17148,11 +17157,11 @@ static MYSQL_SYSVAR_UINT(
   "Activation threshold when receive thread takes over the polling "
   "of the cluster connection (measured in concurrently active "
   "threads)",
-  NULL,                                        /* check func. */
+  ndb_recv_thread_activation_threshold_check,  /* check func. */
   ndb_recv_thread_activation_threshold_update, /* update func. */
   8,                                           /* default */
-  0,                                           /* min */
-  16,                                          /* max */
+  MIN_ACTIVATION_THRESHOLD,                    /* min */
+  MAX_ACTIVATION_THRESHOLD,                    /* max */
   0                                            /* block */
 );
 
@@ -17160,7 +17169,7 @@ static MYSQL_SYSVAR_UINT(
 /* Definitions needed for receive thread cpu mask config variable */
 static const int ndb_recv_thread_cpu_mask_option_buf_size = 512;
 char ndb_recv_thread_cpu_mask_option_buf[ndb_recv_thread_cpu_mask_option_buf_size];
-Uint16 recv_thread_cpuid_array[MAX_NUM_RECV_THREADS * MAX_CLUSTER_CONNECTIONS];
+Uint16 recv_thread_cpuid_array[1 * MAX_CLUSTER_CONNECTIONS];
 
 static
 int
@@ -17201,7 +17210,7 @@ ndb_recv_thread_cpu_mask_check_str(const
        i = bitmask.find(i + 1))
   {
     if (recv_thread_num_cpus ==
-        MAX_NUM_RECV_THREADS * MAX_CLUSTER_CONNECTIONS)
+        1 * MAX_CLUSTER_CONNECTIONS)
     {
       sql_print_information("Trying to set too many CPU's in "
                             "ndb_recv_thread_cpu_mask, ignored"
@@ -17221,7 +17230,7 @@ void
 ndb_recv_thread_cpu_mask_update()
 {
   ndb_set_recv_thread_cpu(recv_thread_cpuid_array,
-                          opt_ndb_num_recv_threads,
+                          1,
                           recv_thread_num_cpus);
 }
 
@@ -17523,7 +17532,6 @@ static struct st_mysql_sys_var* system_v
   MYSQL_SYSVAR(wait_connected),
   MYSQL_SYSVAR(wait_setup),
   MYSQL_SYSVAR(cluster_connection_pool),
-  MYSQL_SYSVAR(num_recv_threads),
   MYSQL_SYSVAR(recv_thread_activation_threshold),
   MYSQL_SYSVAR(recv_thread_cpu_mask),
   MYSQL_SYSVAR(report_thresh_binlog_mem_usage),

=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.cpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.cpp	revid:mikael.ronstrom@stripped
+++ b/storage/ndb/src/ndbapi/TransporterFacade.cpp	revid:mikael.ronstrom@stripped
@@ -653,7 +653,6 @@ TransporterFacade::become_poll_owner(trp
   unlock_poll_mutex();
   if (poll_owner)
   {
-    clnt->m_poll.m_poll_owner = true;
     return true;
   }
   return false;
@@ -768,7 +767,7 @@ void TransporterFacade::threadMainReceiv
     {
       /*
          We only take the step to become poll owner in receive thread if
-         we are sufficiently active, at least 16 threads active.
+         we are sufficiently active, at least e.g. 16 threads active.
       */
       if (m_num_active_clients > min_active_clients_recv_thread)
       {

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster-7.2 branch (mikael.ronstrom:3971 to 3974) Mikael Ronstrom15 Sep