List:Commits« Previous MessageNext Message »
From:Li-Bing.Song Date:July 14 2010 3:22pm
Subject:bzr commit into mysql-next-mr-rpl-merge branch (Li-Bing.Song:3007)
View as plain text  
#At file:///home/anders/work/bzrwork1/wt1/mysql-next-mr-rpl-merge/ based on revid:alfranio.correia@stripped

 3007 Li-Bing.Song@stripped	2010-07-14 [merge]
      Manual merge
      Improve the system variable description.
      Add code to initialize server_uuid for embedded server.

    added:
      mysql-test/r/server_uuid_embedded.result
      mysql-test/t/server_uuid_embedded.test
    modified:
      libmysqld/lib_sql.cc
      sql/sys_vars.cc
=== modified file 'libmysqld/lib_sql.cc'
--- a/libmysqld/lib_sql.cc	2010-06-10 11:43:32 +0000
+++ b/libmysqld/lib_sql.cc	2010-07-14 15:20:39 +0000
@@ -542,6 +542,16 @@ int init_embedded_server(int argc, char 
     return 1;
   }
 
+  /*
+    Each server should have one UUID. We will create it automatically, if it
+    does not exist.
+   */
+  if (!opt_bootstrap && init_server_auto_options())
+  {
+    mysql_server_end();
+    return 1;
+  }
+
   error_handler_hook = my_message_sql;
 
   acl_error= 0;

=== added file 'mysql-test/r/server_uuid_embedded.result'
--- a/mysql-test/r/server_uuid_embedded.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/server_uuid_embedded.result	2010-07-14 15:04:32 +0000
@@ -0,0 +1,10 @@
+
+# Case 1:
+# @@SERVER_UUID is readonly.
+-----------------------------------------------------------------------------
+SET GLOBAL SERVER_UUID= UUID();
+ERROR HY000: Variable 'server_uuid' is a read only variable
+
+# Case 2:
+# SERVER_UUID is not null
+-----------------------------------------------------------------------------

=== added file 'mysql-test/t/server_uuid_embedded.test'
--- a/mysql-test/t/server_uuid_embedded.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/server_uuid_embedded.test	2010-07-14 15:04:32 +0000
@@ -0,0 +1,31 @@
+##############################################################################
+# WL#4677 Unique Server Ids for Replication Topology (UUIDs)                 #
+# 
+# Each server has a UUID generated by server itself. It is stored in auto.cnf
+# in @@DATADIR directory. 
+#
+# @@SERVER_UUID is a readonly system variable, it is initialized as the
+# server's UUID when starting. Users can get the server's UUID from
+# @@SERVER_UUID.
+#
+# This test case tests whether the server's UUID can be generated, stored,
+# initialized correctly.
+##############################################################################
+source include/is_embedded.inc;
+
+--echo
+--echo # Case 1:
+--echo # @@SERVER_UUID is readonly.
+--echo -----------------------------------------------------------------------------
+--error 1238
+SET GLOBAL SERVER_UUID= UUID();
+
+--echo
+--echo # Case 2:
+--echo # SERVER_UUID is not null
+--echo -----------------------------------------------------------------------------
+--let $server_uuid= query_get_value(SELECT @@SERVER_UUID, @@SERVER_UUID, 1)
+if (`SELECT '$server_uuid' = ''`)
+{
+  --echo server's UUID is null
+}

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2010-06-23 09:56:24 +0000
+++ b/sql/sys_vars.cc	2010-07-14 15:20:39 +0000
@@ -585,9 +585,6 @@ static Sys_var_dbug Sys_dbug(
        ON_CHECK(check_has_super));
 #endif
 
-static Sys_var_charptr Sys_server_uuid("server_uuid", "UUID of the server",
-       READ_ONLY GLOBAL_VAR(server_uuid_ptr),
-       NO_CMD_LINE, IN_FS_CHARSET, DEFAULT(server_uuid));
 /**
   @todo
     When updating myisam_delay_key_write, we should do a 'flush tables'
@@ -1767,6 +1764,12 @@ static Sys_var_ulong Sys_server_id(
        VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1), NO_MUTEX_GUARD,
        NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_server_id));
 
+static Sys_var_charptr Sys_server_uuid(
+       "server_uuid",
+       "Uniquely identifies the server instance in the universe",
+       READ_ONLY GLOBAL_VAR(server_uuid_ptr),
+       NO_CMD_LINE, IN_FS_CHARSET, DEFAULT(server_uuid));
+
 static Sys_var_mybool Sys_slave_compressed_protocol(
        "slave_compressed_protocol",
        "Use compression on master/slave protocol",


Attachment: [text/bzr-bundle] bzr/li-bing.song@sun.com-20100714152039-8afcf0ndd62cnqp4.bundle
Thread
bzr commit into mysql-next-mr-rpl-merge branch (Li-Bing.Song:3007) Li-Bing.Song14 Jul