[Commits] Rev 3859: Merge of patch for MDEV-6411 from maria-5.5-galera. in lp:~maria-captains/maria/maria-10.0-galera

Nirbhay Choubey nirbhay at skysql.com
Wed Jul 9 18:07:51 EEST 2014


At lp:~maria-captains/maria/maria-10.0-galera

------------------------------------------------------------
revno: 3859
revision-id: nirbhay at skysql.com-20140709150723-rdphpx4b4y58wqdw
parent: jplindst at mariadb.org-20140704085909-mlzn1cr2xjatgujg
committer: Nirbhay Choubey <nirbhay at skysql.com>
branch nick: maria-10.0-galera_6411
timestamp: Wed 2014-07-09 11:07:23 -0400
message:
  Merge of patch for MDEV-6411 from maria-5.5-galera.
-------------- next part --------------
=== modified file 'mysql-test/suite/wsrep/r/variables.result'
--- a/mysql-test/suite/wsrep/r/variables.result	2014-05-22 22:31:04 +0000
+++ b/mysql-test/suite/wsrep/r/variables.result	2014-07-09 15:07:23 +0000
@@ -11,6 +11,7 @@
 ERROR HY000: Variable 'wsrep_replicate_myisam' is a GLOBAL variable and should be set with SET GLOBAL
 SET GLOBAL wsrep_replicate_myisam= ON;
 SET GLOBAL wsrep_replicate_myisam= OFF;
+SET GLOBAL wsrep_provider=none;
 #
 # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of
 # variables when using "_"
@@ -144,7 +145,7 @@
 call mtr.add_suppression("WSREP: Failed to get provider options");
 SELECT @@global.wsrep_provider;
 @@global.wsrep_provider
-none
+libgalera_smm.so
 SELECT @@global.wsrep_slave_threads;
 @@global.wsrep_slave_threads
 1
@@ -160,7 +161,7 @@
 
 SELECT @@global.wsrep_provider;
 @@global.wsrep_provider
-/usr/lib/galera/libgalera_smm.so
+libgalera_smm.so
 SELECT @@global.wsrep_cluster_address;
 @@global.wsrep_cluster_address
 NULL
@@ -177,7 +178,7 @@
 # Wait for applier threads to get created.
 SELECT @@global.wsrep_provider;
 @@global.wsrep_provider
-/usr/lib/galera/libgalera_smm.so
+libgalera_smm.so
 SELECT @@global.wsrep_cluster_address;
 @@global.wsrep_cluster_address
 gcomm://
@@ -201,4 +202,21 @@
 SET GLOBAL wsrep_provider= none;
 SET GLOBAL wsrep_cluster_address= '';
 SET GLOBAL wsrep_provider_options= '';
+#
+# MDEV#6411: Setting set @@global.wsrep_sst_auth=NULL causes crash
+#
+SET @wsrep_sst_auth_saved= @@global.wsrep_sst_auth;
+SET @@global.wsrep_sst_auth= 'user:pass';
+SELECT @@global.wsrep_sst_auth;
+@@global.wsrep_sst_auth
+********
+SET @@global.wsrep_sst_auth= '';
+SELECT @@global.wsrep_sst_auth;
+@@global.wsrep_sst_auth
+
+SET @@global.wsrep_sst_auth= NULL;
+SELECT @@global.wsrep_sst_auth;
+@@global.wsrep_sst_auth
+NULL
+SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved;
 # End of test.

=== modified file 'mysql-test/suite/wsrep/t/variables.test'
--- a/mysql-test/suite/wsrep/t/variables.test	2014-05-22 22:31:04 +0000
+++ b/mysql-test/suite/wsrep/t/variables.test	2014-07-09 15:07:23 +0000
@@ -19,6 +19,7 @@
 
 # Reset it back.
 SET GLOBAL wsrep_replicate_myisam= OFF;
+SET GLOBAL wsrep_provider=none;
 
 --echo #
 --echo # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of
@@ -27,6 +28,10 @@
 
 CALL mtr.add_suppression("WSREP: Could not open saved state file for reading.*");
 
+--disable_query_log
+eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
+--enable_query_log
+
 --replace_column 2 #
 SHOW GLOBAL STATUS LIKE 'wsrep%';
 
@@ -40,6 +45,7 @@
 --echo # Should show nothing.
 SHOW STATUS LIKE 'x';
 
+# Reset it back.
 SET GLOBAL wsrep_provider=none;
 
 --echo #
@@ -59,6 +65,7 @@
 --replace_column 2 #
 SHOW STATUS LIKE 'wsrep_last_committed';
 
+# Reset it back.
 SET GLOBAL wsrep_provider=none;
 
 --echo
@@ -67,6 +74,12 @@
 --echo #
 call mtr.add_suppression("safe_mutex: Found wrong usage of mutex 'LOCK_wsrep_slave_threads' and 'LOCK_global_system_variables'");
 call mtr.add_suppression("WSREP: Failed to get provider options");
+
+--disable_query_log
+eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
+--enable_query_log
+
+--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
 SELECT @@global.wsrep_provider;
 SELECT @@global.wsrep_slave_threads;
 SELECT @@global.wsrep_cluster_address;
@@ -77,6 +90,8 @@
 --disable_query_log
 eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER';
 --enable_query_log
+
+--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
 SELECT @@global.wsrep_provider;
 SELECT @@global.wsrep_cluster_address;
 SHOW STATUS LIKE 'threads_connected';
@@ -88,6 +103,8 @@
 SET GLOBAL wsrep_cluster_address= 'gcomm://';
 --echo # Wait for applier threads to get created.
 sleep 3; 
+
+--replace_regex /.*libgalera_smm.*/libgalera_smm.so/
 SELECT @@global.wsrep_provider;
 SELECT @@global.wsrep_cluster_address;
 SHOW STATUS LIKE 'threads_connected';
@@ -107,4 +124,17 @@
 SET GLOBAL wsrep_cluster_address= '';
 SET GLOBAL wsrep_provider_options= '';
 
+--echo #
+--echo # MDEV#6411: Setting set @@global.wsrep_sst_auth=NULL causes crash
+--echo #
+SET @wsrep_sst_auth_saved= @@global.wsrep_sst_auth;
+SET @@global.wsrep_sst_auth= 'user:pass';
+SELECT @@global.wsrep_sst_auth;
+SET @@global.wsrep_sst_auth= '';
+SELECT @@global.wsrep_sst_auth;
+SET @@global.wsrep_sst_auth= NULL;
+SELECT @@global.wsrep_sst_auth;
+SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved;
+
 --echo # End of test.
+

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2014-06-19 17:12:38 +0000
+++ b/sql/mysqld.cc	2014-07-09 15:07:23 +0000
@@ -1959,7 +1959,7 @@
   close_connections();
 #ifdef WITH_WSREP
   if (wsrep_inited == 1)
-    wsrep_deinit();
+    wsrep_deinit(true);
 #endif
   if (sig != MYSQL_KILL_SIGNAL &&
       sig != 0)
@@ -2071,7 +2071,7 @@
 
     /* In bootstrap mode we deinitialize wsrep here. */
     if (opt_bootstrap && wsrep_inited)
-      wsrep_deinit();
+      wsrep_deinit(true);
   }
 #endif // WITH_WSREP
   clean_up(!opt_abort && (exit_code || !opt_bootstrap)); /* purecov: inspected */

=== modified file 'sql/wsrep_mysqld.cc'
--- a/sql/wsrep_mysqld.cc	2014-07-04 08:41:09 +0000
+++ b/sql/wsrep_mysqld.cc	2014-07-09 15:07:23 +0000
@@ -720,7 +720,7 @@
 }
 
 
-void wsrep_deinit()
+void wsrep_deinit(bool free_options)
 {
   DBUG_ASSERT(wsrep_inited == 1);
   wsrep_unload(wsrep);
@@ -729,6 +729,11 @@
   provider_version[0]= '\0';
   provider_vendor[0]=  '\0';
   wsrep_inited= 0;
+
+  if (free_options)
+  {
+    wsrep_sst_auth_free();
+  }
 }
 
 void wsrep_recover()

=== modified file 'sql/wsrep_mysqld.h'
--- a/sql/wsrep_mysqld.h	2014-06-19 22:48:20 +0000
+++ b/sql/wsrep_mysqld.h	2014-07-09 15:07:23 +0000
@@ -124,7 +124,7 @@
 void wsrep_filter_new_cluster (int* argc, char* argv[]);
 
 int  wsrep_init();
-void wsrep_deinit();
+void wsrep_deinit(bool free_options);
 void wsrep_recover();
 bool wsrep_before_SE(); // initialize wsrep before storage
                         // engines (true) or after (false)

=== modified file 'sql/wsrep_sst.cc'
--- a/sql/wsrep_sst.cc	2014-05-21 18:32:57 +0000
+++ b/sql/wsrep_sst.cc	2014-07-09 15:07:23 +0000
@@ -123,31 +123,44 @@
 {
     return 0;
 }
+
 static bool sst_auth_real_set (const char* value)
 {
-    const char* v = strdup (value);
-
-    if (v)
+  const char* v= NULL;
+
+  if (value)
+  {
+    v= my_strdup(value, MYF(0));
+  }
+  else                                          // its NULL
+  {
+    wsrep_sst_auth_free();
+    return 0;
+  }
+
+  if (v)
+  {
+    // set sst_auth_real
+    if (sst_auth_real) { my_free((void *) sst_auth_real); }
+    sst_auth_real = v;
+
+    // mask wsrep_sst_auth
+    if (strlen(sst_auth_real))
     {
-        if (sst_auth_real) free (const_cast<char*>(sst_auth_real));
-        sst_auth_real = v;
-
-        if (strlen(sst_auth_real))
-        {
-          if (wsrep_sst_auth)
-          {
-            my_free ((void*)wsrep_sst_auth);
-            wsrep_sst_auth = my_strdup(WSREP_SST_AUTH_MASK, MYF(0));
-            //strncpy (wsrep_sst_auth, WSREP_SST_AUTH_MASK,
-            //     sizeof(wsrep_sst_auth) - 1);
-          }
-          else
-            wsrep_sst_auth = my_strdup (WSREP_SST_AUTH_MASK, MYF(0));
-        }
-        return 0;
+      if (wsrep_sst_auth) { my_free((void*) wsrep_sst_auth); }
+      wsrep_sst_auth= my_strdup(WSREP_SST_AUTH_MASK, MYF(0));
     }
+    return 0;
+  }
+  return 1;
+}
 
-    return 1;
+void wsrep_sst_auth_free()
+{
+  if (wsrep_sst_auth) { my_free((void *) wsrep_sst_auth); }
+  if (sst_auth_real) { my_free((void *) sst_auth_real); }
+  wsrep_sst_auth= NULL;
+  sst_auth_real= NULL;
 }
 
 bool wsrep_sst_auth_update (sys_var *self, THD* thd, enum_var_type type)

=== modified file 'sql/wsrep_sst.h'
--- a/sql/wsrep_sst.h	2013-11-05 22:29:37 +0000
+++ b/sql/wsrep_sst.h	2014-07-09 15:07:23 +0000
@@ -31,6 +31,7 @@
 extern bool wsrep_sst_wait();
 /*! Signals wsrep that initialization is complete, writesets can be applied */
 extern void wsrep_sst_continue();
+extern void wsrep_sst_auth_free();
 
 extern void wsrep_SE_init_grab();   /*! grab init critical section */
 extern void wsrep_SE_init_wait();   /*! wait for SE init to complete */

=== modified file 'sql/wsrep_var.cc'
--- a/sql/wsrep_var.cc	2014-06-20 01:55:19 +0000
+++ b/sql/wsrep_var.cc	2014-07-09 15:07:23 +0000
@@ -239,7 +239,7 @@
   mysql_mutex_lock(&LOCK_global_system_variables);
 
   if (wsrep_inited == 1)
-    wsrep_deinit();
+    wsrep_deinit(false);
 
   char* tmp= strdup(wsrep_provider); // wsrep_init() rewrites provider 
                                      //when fails



More information about the commits mailing list