List:Commits« Previous MessageNext Message »
From:John David Duncan Date:September 21 2011 8:44am
Subject:bzr push into mysql-5.5-cluster branch (john.duncan:3504 to 3505)
View as plain text  
 3505 John David Duncan	2011-09-21 [merge]
      merge

    added:
      storage/ndb/memcache/README
    modified:
      storage/ndb/memcache/CMakeLists.txt
      storage/ndb/memcache/atomics.cmake
      storage/ndb/memcache/include/ndb_configuration.h
      storage/ndb/memcache/sandbox.sh.in
      storage/ndb/memcache/src/Configuration.cc
      storage/ndb/memcache/src/ndb_configuration.cc
      storage/ndb/memcache/src/ndb_engine.c
 3504 jonas oreland	2011-09-20
      ndb - disable rpl_empty_master_host dur to bug#13003111 - valgrind warning

    modified:
      mysql-test/suite/rpl/t/disabled.def
=== modified file 'storage/ndb/memcache/CMakeLists.txt'
--- a/storage/ndb/memcache/CMakeLists.txt	2011-09-19 10:54:11 +0000
+++ b/storage/ndb/memcache/CMakeLists.txt	2011-09-21 08:30:46 +0000
@@ -148,6 +148,15 @@ install(TARGETS ndb_engine DESTINATION $
 install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ndb_memcache_metadata.sql 
         DESTINATION ${INSTALL_MYSQLSHAREDIR})
 
+### Install the memcache-api directory  ################
+install(DIRECTORY DESTINATION memcache-api)
+install(PROGRAMS sandbox.sh DESTINATION memcache-api)
+install(FILES README DESTINATION memcache-api)
+install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/scripts/ndb_memcache_metadata.sql 
+        DESTINATION memcache-api)
+######################################################## 
+
+
 # Build the library used by the unit tests
 add_library(ndbmemcache SHARED ${NDB_MEMCACHE_SOURCE_FILES})
 target_link_libraries(ndbmemcache ndbclient_static ndbgeneral ${MEMCACHED_UTILITIES_LIBRARY})

=== added file 'storage/ndb/memcache/README'
--- a/storage/ndb/memcache/README	1970-01-01 00:00:00 +0000
+++ b/storage/ndb/memcache/README	2011-09-21 08:30:46 +0000
@@ -0,0 +1,94 @@
+-------------------------------------------------------------------------
+The Memcache API for MySQL Cluster -- October 2011 Release
+-------------------------------------------------------------------------
+
+
+Memcached is a high-performance data cache.  Memcached servers are often 
+expected to serve 100,000 operations per second or more.  
+
+The API is based on Memcached 1.6 from http://www.memcached.org/.
+It is designed to do everything memcached does, with similar performance, 
+and automatically persist data to MySQL Cluster.  
+
+The Memcache API is highly configurable. Multiple memcached servers can connect 
+to multiple clusters and access data from many different tables.  It supports a 
+large number of cache policies, based on the prefix of a memcache key.  Some 
+keys can be stored in local cache only, while other keys are written though 
+synchronously to the database but stored in cacne, and still other keys go 
+directly to the database without using a local cache at all.
+
+In the default configuration, all values will be persistently stored in 
+MySQL Cluster, except keys that begin with "mc:" or "t:" which are treated
+specially.
+
+-------------------------------------------------------------------------
+QUICK START
+-------------------------------------------------------------------------
+
+STARTING THE SERVER
+-------------------
+To create a simple sandbox to demonstrate MySQL Cluster with memcache, 
+run "sandbox.sh start", then continue reading.
+
+Alternately, if you have a running cluster (with room to add a new API node)
+and want to add a memcache server to it, there are two steps.
+ (1) Create the "ndbmemcache" configuration database
+     # mysql -u root < ndb_memcache_metadata.sql
+ (2) Start a memcached server
+     # ../bin/memcached -E ../lib/ndb_engine.so 
+
+It is not possible to start a memcached server until the configuration tables
+have been created.
+
+
+TESTING
+-------
+Once the server is running, if you have installed the libmemcached clients 
+(from http://libmemcached.org), you should be able to run "memcapable" and 
+see all tests pass.
+
+You can also test the installation using mysql-test-run.  From the mysql-test
+directory, run "mysql-test-run.pl --suite=ndb_memcache".  This is a preview 
+release, so test failures are still expected on some platforms.  
+
+If you see a test failure some other problem, please report it on the "Cluster" 
+forum at http://forums.mysql.com/
+
+
+RUN SOME CLIENT COMMANDS 
+--------------------------
+From another window, you can run any sort of memcached client using either the 
+text protocol or the binary protocol -- including plain "telnet".  
+
+$ telnet localhost 11211
+Escape character is '^]'.
+set key1 0 0 4
+abcd
+
+get key1
+
+delete key1
+
+
+-------------------------------------------------------------------------
+THE DEFAULT SERVER ROLE
+-------------------------------------------------------------------------
+
+In the default configuration, all keys except those beginning with "mc:" and
+"t:" are stored in the table called "demo_table" in the ndbmemcache schema.
+
+Keys beginning with "mc:" are stored only in local cache (their cache policy
+is "mc-only").
+
+Keys beginning with "t:" demonstrate using tab-separated values to store data
+in multiple database columns.  These values are stored in "demo_table_tabs". 
+
+
+-------------------------------------------------------------------------
+LIMITATIONS
+-------------------------------------------------------------------------
+
+In this preview release, all data types are supported except for TEXT and BLOB 
+types, and bitfields.  The lack of support for BLOB columns means that stored
+values are limited by the maximum size of a row in MySQL Cluster.  This row size 
+limit is 14,000 bytes.  

=== modified file 'storage/ndb/memcache/atomics.cmake'
--- a/storage/ndb/memcache/atomics.cmake	2011-09-17 23:23:26 +0000
+++ b/storage/ndb/memcache/atomics.cmake	2011-09-21 08:30:46 +0000
@@ -43,7 +43,7 @@ IF(HAVE_GCC_ATOMIC_BUILTINS)
   MESSAGE(STATUS "Using gcc atomic builtins") 
 ELSEIF(HAVE_DARWIN_ATOMICS) 
   MESSAGE(STATUS "Using Darwin OSAtomic") 
-ELSEIF(HAVE_SOALRIS_ATOMICS)
+ELSEIF(HAVE_SOLARIS_ATOMICS)
   MESSAGE(STATUS "Using Solaris <atomic.h>")
 ELSE()
   MESSAGE(FATAL_ERROR "No atomic functions available")

=== modified file 'storage/ndb/memcache/include/ndb_configuration.h'
--- a/storage/ndb/memcache/include/ndb_configuration.h	2011-09-12 10:05:07 +0000
+++ b/storage/ndb/memcache/include/ndb_configuration.h	2011-09-21 08:30:46 +0000
@@ -35,7 +35,7 @@
 DECLARE_FUNCTIONS_WITH_C_LINKAGE
 
 bool connect_to_primary_cluster(const char *connectstring, const char *role);
-bool get_config(const char *role);
+bool get_config();
 bool open_connections_to_all_clusters();
 bool prefetch_dictionary_objects();
 prefix_info_t get_prefix_info_for_key(int nkey, const char *key);

=== modified file 'storage/ndb/memcache/sandbox.sh.in'
--- a/storage/ndb/memcache/sandbox.sh.in	2011-09-19 00:22:10 +0000
+++ b/storage/ndb/memcache/sandbox.sh.in	2011-09-21 08:30:46 +0000
@@ -3,16 +3,21 @@
 prefix=@CMAKE_INSTALL_PREFIX@
 bindir=@INSTALL_BINDIR@
 libexecdir=@INSTALL_SBINDIR@
+libdir=@INSTALL_LIBDIR@
 scriptsdir=@INSTALL_SCRIPTDIR@
 memcachedir=@MEMCACHED_ROOT_DIR@
-homebase=@CMAKE_CURRENT_SOURCE_DIR@
+sourcetree=@CMAKE_CURRENT_SOURCE_DIR@
+installtree=@CMAKE_BINARY_DIR@/memcache-api
 
 MYSQL_PREFIX=$prefix
 MYSQL_BIN=$prefix/$bindir
 MYSQL_LIBEXEC=$prefix/$libexecdir
 MYSQL_SCRIPTS=$prefix/$scriptsdir
+MYSQL_LIB=$prefix/$libdir
 MEMCACHE_BASE=$memcachedir
-HOME_BASE=$homebase
+SOURCE_TREE=$sourcetree
+HOME_BASE=$sourcetree   # fallback to source tree 
+test -d $installtree && HOME_BASE=$installtree  # prefer installed tree
 
 test_paths() {
   test_path $MYSQL_BIN ndb_mgm
@@ -129,14 +134,16 @@ test_pid() {
 
 load_metadata() {
   echo Loading NDB Memcache configuration data
-  $MYSQL_BIN/mysql --connect-timeout=10 -u root \
-    < $HOME_BASE/scripts/ndb_memcache_metadata.sql || exit
+  DDL_SCRIPT=$SOURCE_TREE/scripts/ndb_memcache_metadata.sql
+  $MYSQL_BIN/mysql --connect-timeout=10 -u root < $DDL_SCRIPT || TRY_AGAIN=1
+  test "$TRY_AGAIN" = "1" && $MYSQL_BIN/mysql --connect-timeout=10 \
+    -u root < $DDL_SCRIPT
 }
 
 start_memcached() {
   $MEMCACHE_BASE/bin/memcached -d -v \
     -P $HOME_BASE/sandbox/memcached.pid \
-    -E $MEMCACHE_BASE/lib/ndb_engine.so $1 $2
+    -E $MYSQL_LIB/ndb_engine.so $1 $2
 }
 
 stop_memcached() {

=== modified file 'storage/ndb/memcache/src/Configuration.cc'
--- a/storage/ndb/memcache/src/Configuration.cc	2011-09-12 10:05:07 +0000
+++ b/storage/ndb/memcache/src/Configuration.cc	2011-09-21 08:30:46 +0000
@@ -160,14 +160,12 @@ bool Configuration::readConfiguration() 
   store_default_prefix();
   
   switch(config_version) {
-    case CONFIG_VER_UNSUPPORTED:
-      return false;
     case CONFIG_VER_1_1:
       return cfg_v1_1.read_configuration();
     case CONFIG_VER_1_0:
       return cfg_v1_0.read_configuration();
     default:
-      return cfg0.read_configuration();
+      return false;
   }
 }
 
@@ -305,8 +303,6 @@ config_ver_enum Configuration::get_suppo
       return CONFIG_VER_UNSUPPORTED;      
     }
   }
-  DEBUG_PRINT("v0");
-  logger->log(LOG_WARNING, 0, "Reverting to default v0 configuration.\n");
   return CONFIG_VER_0;
 }  
 
@@ -379,49 +375,3 @@ int Configuration::waitForReconfSignal()
   return reload_waiter(primary_conn, server_role);
 }
 
-
-/*
- *******************  Config Readers **************************
-*/
-
-/*********** VERSION 0 METADATA *******************/
-/* For prototype only                             */
-bool config_v0::read_configuration() {
-  DEBUG_ENTER_METHOD("config_v0::read_configuration");
-
-  conf.onlineReloadFlag = 0;
-    
-  KeyPrefix pfx("");
-  pfx.table = new TableSpec("ndbmemcache.mc_backstore","mkey","string_value");
-
-  pfx.info.usable = 1;
-  pfx.info.cluster_id = 0;
-  pfx.info.use_ndb = 1;
-  
-  /* reads */
-  pfx.info.do_mc_read = 1;
-  pfx.info.do_db_read = 1;
-  
-  /* writes */
-  pfx.info.do_mc_write = 1;
-  pfx.info.do_db_write = 1;
-  
-  /* deletes */
-  pfx.info.do_mc_delete = 1;
-  pfx.info.do_db_delete = 1;
-  
-  /* expire/flush */
-  pfx.info.do_db_flush = 0;
-  
-  /* increment, decrement, cas */
-  pfx.info.has_math_col = 0;
-  pfx.info.has_cas_col = 0;
-  
-  pfx.info.prefix_id = 0;
-  
-  conf.storeConnection("", 300);    // connection 0
-  conf.storePrefix(pfx);            // prefix 0
-
-  return true;
-}
-

=== modified file 'storage/ndb/memcache/src/ndb_configuration.cc'
--- a/storage/ndb/memcache/src/ndb_configuration.cc	2011-09-12 10:05:07 +0000
+++ b/storage/ndb/memcache/src/ndb_configuration.cc	2011-09-21 08:30:46 +0000
@@ -110,7 +110,7 @@ bool read_configuration(Configuration *c
 
 
 /* This function has C linkage */
-bool get_config(const char *) {
+bool get_config() {
   return read_configuration(active_config);
 }
 

=== modified file 'storage/ndb/memcache/src/ndb_engine.c'
--- a/storage/ndb/memcache/src/ndb_engine.c	2011-09-12 10:05:07 +0000
+++ b/storage/ndb/memcache/src/ndb_engine.c	2011-09-21 08:30:46 +0000
@@ -180,18 +180,21 @@ static ENGINE_ERROR_CODE ndb_initialize(
   /* Connect to the Primary cluster */
   if(!(connect_to_primary_cluster(ndb_eng->startup_options.connectstring,
                                   ndb_eng->startup_options.server_role))) {
+     logger->log(LOG_WARNING, 0, "Could not connect to NDB.  Shutting down.\n");
      return ENGINE_FAILED;
   }
   ndb_eng->connected = true;
 
   /* Read configuration */
-  if(!(get_config(ndb_eng->startup_options.server_role)))
+  if(!(get_config())) {
+     logger->log(LOG_WARNING, 0, "Failed to read configuration -- shutting down.\n"
+                 "(Did you run ndb_memcache_metadata.sql?)\n");
      return ENGINE_FAILED;
+  }
 
   /* Connect to additional clusters */
   if(! open_connections_to_all_clusters()) {
-    logger->log(LOG_WARNING, NULL, 
-                "open_connections_to_all_clusters() failed \n");
+    logger->log(LOG_WARNING, 0, "open_connections_to_all_clusters() failed \n");
    return ENGINE_FAILED;
   }
   

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.5-cluster branch (john.duncan:3504 to 3505) John David Duncan22 Sep