List:Commits« Previous MessageNext Message »
From:magnus.blaudd Date:November 27 2012 4:27pm
Subject:bzr push into mysql-trunk-cluster branch (magnus.blaudd:3578 to 3579)
View as plain text  
 3579 magnus.blaudd@stripped	2012-11-27 [merge]
      Merge 7.3 -> trunk-cluster

    modified:
      sql/sql_show.cc
      storage/ndb/CMakeLists.txt
      storage/ndb/memcache/include/DataTypeHandler.h
      storage/ndb/memcache/src/DataTypeHandler.cc
      storage/ndb/memcache/src/ExpireTime.cc
      storage/ndb/memcache/src/Record.cc
      storage/ndb/src/common/util/NdbSqlUtil.cpp
      storage/ndb/src/mgmsrv/ConfigManager.cpp
      storage/ndb/test/ndbapi/testMgmd.cpp
 3578 magnus.blaudd@stripped	2012-11-26 [merge]
      Merge

    modified:
      mysql-test/suite/ndb/t/ndb_many_fragments.test
      mysql-test/suite/ndb/t/test_mgmd.test
      mysql-test/suite/ndb_memcache/t/basic.test
      mysql-test/suite/ndb_memcache/t/external_values.test
      mysql-test/suite/ndb_memcache/t/lib_ascii.test
      mysql-test/suite/ndb_memcache/t/lib_binary.test
      mysql-test/suite/ndb_memcache/t/math1.test
      mysql-test/suite/ndb_memcache/t/math2.test
      mysql-test/suite/ndb_memcache/t/math3.test
      mysql-test/suite/ndb_memcache/t/mpart_key.test
      mysql-test/suite/ndb_memcache/t/reconf1.test
      mysql-test/suite/ndb_memcache/t/tsv1.test
      mysql-test/suite/ndb_memcache/t/tsv2.test
      mysql-test/suite/ndb_memcache/t/ttls_flags.test
      mysql-test/suite/ndb_memcache/t/type_char.test
      mysql-test/suite/ndb_memcache/t/type_numeric.test
      mysql-test/suite/ndb_memcache/t/type_signed.test
      mysql-test/suite/ndb_memcache/t/type_unsigned.test
      mysql-test/suite/ndb_memcache/t/unique_idx.test
      sql/ha_ndbcluster.cc
      sql/ha_ndbcluster_binlog.cc
      sql/ha_ndbcluster_push.cc
      sql/ndb_local_schema.cc
      storage/ndb/CMakeLists.txt
=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2012-11-21 12:44:48 +0000
+++ b/sql/sql_show.cc	2012-11-27 16:26:06 +0000
@@ -3425,8 +3425,9 @@ end:
   /* Restore original LEX value, statement's arena and THD arena values. */
   lex_end(thd->lex);
 
-  if (i_s_arena.free_list)
-    i_s_arena.free_items();
+  // Free items, before restoring backup_arena below.
+  DBUG_ASSERT(i_s_arena.free_list == NULL);
+  thd->free_items();
 
   /*
     For safety reset list of open temporary tables before closing

=== modified file 'storage/ndb/CMakeLists.txt'
--- a/storage/ndb/CMakeLists.txt	2012-11-23 14:18:01 +0000
+++ b/storage/ndb/CMakeLists.txt	2012-11-27 16:26:06 +0000
@@ -47,6 +47,7 @@ MACRO(NDB_CHECK_MYSQL_CLUSTER version_st
   ENDIF()
 ENDMACRO()
 
+NDB_CHECK_MYSQL_CLUSTER(${VERSION})
 
 # Temporarily remove -Werror from compiler flags until
 # storage/ndb/ can be built with it
@@ -57,8 +58,19 @@ IF(CMAKE_CXX_FLAGS)
   STRING(REPLACE "-Werror" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
 ENDIF()
 
-
-NDB_CHECK_MYSQL_CLUSTER(${VERSION})
+# Disable specific types of warnings for storage/ndb
+# if the compiler supports the flag
+IF(CMAKE_COMPILER_IS_GNUCXX)
+  INCLUDE(CheckCXXCompilerFlag)
+  FOREACH(warning "unused-but-set-variable")
+    CHECK_CXX_COMPILER_FLAG("-Wno-${warning}" flag_supported)
+    IF(flag_supported)
+      MESSAGE(STATUS "Disabling -W${warning} warning")
+      SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-${warning}")
+      SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-${warning}")
+    ENDIF()
+  ENDFOREACH()
+ENDIF()
 
 #
 # Add the ndbcluster plugin

=== modified file 'storage/ndb/memcache/include/DataTypeHandler.h'
--- a/storage/ndb/memcache/include/DataTypeHandler.h	2011-09-29 19:13:43 +0000
+++ b/storage/ndb/memcache/include/DataTypeHandler.h	2012-11-16 02:35:56 +0000
@@ -81,8 +81,10 @@ enum {  /* These can be returned by read
    All functions return 1 on success and DTH_xxx values on error 
 */
 typedef struct {
-  int (*read_int32)(Int32 & result, const void * const buf);
-  int (*write_int32)(Int32 value, void * const buf);
+  int (*read_int32)(Int32 & result, const void * const buf, 
+                    const NdbDictionary::Column *);
+  int (*write_int32)(Int32 value, void * const buf,
+                     const NdbDictionary::Column *);
 } NumericHandler;
 
 

=== modified file 'storage/ndb/memcache/src/DataTypeHandler.cc'
--- a/storage/ndb/memcache/src/DataTypeHandler.cc	2011-10-12 02:44:38 +0000
+++ b/storage/ndb/memcache/src/DataTypeHandler.cc	2012-11-21 19:07:03 +0000
@@ -44,21 +44,26 @@ extern EXTENSION_LOGGER_DESCRIPTOR *logg
 #define DECODE_ARGS const NdbDictionary::Column *, char * &, const void * const
 #define SFDLEN_ARGS const NdbDictionary::Column *, const void * const
 #define ENCODE_ARGS const NdbDictionary::Column *, size_t, const char *, void * const
+#define NATIVE_READ_ARGS  Int32 &, const void * const, const NdbDictionary::Column *
+#define NATIVE_WRITE_ARGS Int32, void * const,  const NdbDictionary::Column *
 
 typedef int    impl_readFromNdb(DECODE_ARGS);
 typedef size_t impl_getStringifiedLength(SFDLEN_ARGS);
 typedef int    impl_writeToNdb(ENCODE_ARGS);
+typedef int    impl_read32(NATIVE_READ_ARGS);
+typedef int    impl_write32(NATIVE_WRITE_ARGS);
 
 /* Implementations for NumericHandlers */
-template<typename INTTYPE> int dth_read32(Int32 &, const void * const);
-template<typename INTTYPE> int dth_write32(Int32, void * const);
-int dth_read32_year(Int32 &, const void * const);
-int dth_write32_year(Int32, void * const);
-int dth_read32_medium(Int32 &, const void * const);
-int dth_write32_medium(Int32, void * const);
-int dth_read32_medium_unsigned(Int32 &, const void * const);
-int dth_write32_medium_unsigned(Int32, void * const);
-
+template<typename INTTYPE> int dth_read32(NATIVE_READ_ARGS);
+template<typename INTTYPE> int dth_write32(NATIVE_WRITE_ARGS);
+impl_read32  dth_read32_year;
+impl_write32 dth_write32_year;
+impl_read32  dth_read32_medium;
+impl_write32 dth_write32_medium;
+impl_read32  dth_read32_medium_unsigned;
+impl_write32 dth_write32_medium_unsigned;
+impl_read32  dth_read32_timestamp2;
+impl_write32 dth_write32_timestamp2;
 
 /* Implementations for readFromNdb() */
 impl_readFromNdb dth_decode_unsupported; 
@@ -83,6 +88,7 @@ impl_readFromNdb dth_decode_datetime;
 impl_readFromNdb dth_decode_float; 
 impl_readFromNdb dth_decode_double; 
 impl_readFromNdb dth_decode_decimal; 
+impl_readFromNdb dth_decode_timestamp2;
 
 
 /* Implementations for impl_getStringifiedLength() */
@@ -104,7 +110,7 @@ impl_getStringifiedLength dth_length_dat
 impl_getStringifiedLength dth_length_float;
 impl_getStringifiedLength dth_length_double;
 impl_getStringifiedLength dth_length_decimal;
-
+impl_getStringifiedLength dth_length_timestamp2;
 
 /* Implementations for writeToNdb() */
 impl_writeToNdb dth_encode_unsupported;
@@ -128,6 +134,7 @@ impl_writeToNdb dth_encode_time;
 impl_writeToNdb dth_encode_datetime;
 template<typename T> int dth_encode_fp(ENCODE_ARGS);
 impl_writeToNdb dth_encode_decimal;
+impl_writeToNdb dth_encode_timestamp2;
 
 /* Native Numeric Handlers */
 NumericHandler dth_native_int8   = { dth_read32<Int8>,  dth_write32<Int8>  };
@@ -140,6 +147,8 @@ NumericHandler dth_native_year   = { dth
 NumericHandler dth_native_medium = { dth_read32_medium, dth_write32_medium };
 NumericHandler dth_native_medium_unsigned = 
                  { dth_read32_medium_unsigned, dth_write32_medium_unsigned };
+NumericHandler dth_native_timestamp2 = 
+                  { dth_read32_timestamp2, dth_write32_timestamp2};
 
 
 /***** Singleton Handlers *****/
@@ -319,6 +328,13 @@ DataTypeHandler Handler_Decimal = {
   false
 };
 
+DataTypeHandler Handler_Timestamp2 = { 
+  dth_decode_timestamp2,
+  dth_length_timestamp2,
+  dth_encode_timestamp2,
+  & dth_native_timestamp2,
+  false
+};
 
 /*
  * getDataTypeHandlerForColumn() 
@@ -379,6 +395,9 @@ DataTypeHandler * getDataTypeHandlerForC
 
     case NdbDictionary::Column::Datetime:
       return & Handler_Datetime;
+
+    case NdbDictionary::Column::Timestamp2:
+      return & Handler_Timestamp2;
       
     case NdbDictionary::Column::Float:
       return & Handler_Float;
@@ -538,14 +557,16 @@ template<typename INTTYPE> size_t dth_le
 }
 
 /* read32: read the value from the buffer into an int32 */
-template<typename INTTYPE> int dth_read32(Int32 &result, const void * const buf) {
+template<typename INTTYPE> int dth_read32(Int32 &result, const void * const buf,
+                                          const NdbDictionary::Column *) {
   LOAD_ALIGNED_DATA(INTTYPE, i, buf);
   result = (Int32) i;
   return 1;
 }
 
 /* write32: write an int32 into the buffer */
-template<typename INTTYPE> int dth_write32(Int32 value, void *buf) {
+template<typename INTTYPE> int dth_write32(Int32 value, void *buf,
+                                           const NdbDictionary::Column *) {
   STORE_ALIGNED_DATA(INTTYPE, value, buf);
   return 1;
 }
@@ -680,12 +701,13 @@ int dth_encode_mediumint(const NdbDictio
   return len;
 }
 
-int dth_read32_medium(Int32 &result, const void * const buf) {
+int dth_read32_medium(Int32 &result, const void * const buf, 
+                      const NdbDictionary::Column *) {
   result = sint3korr((char *) buf);
   return 1;
 }
 
-int dth_write32_medium(Int32 value, void *buf) {
+int dth_write32_medium(Int32 value, void *buf, const NdbDictionary::Column *) {
   Int8 *cbuf = (Int8 *) buf;
   cbuf[0] = (Int8) (value);
   cbuf[1] = (Int8) (value >> 8);
@@ -727,12 +749,14 @@ int dth_encode_medium_unsigned(const Ndb
   return len;
 }
 
-int dth_read32_medium_unsigned(Int32 &result, const void * const buf) {
+int dth_read32_medium_unsigned(Int32 &result, const void * const buf,
+                               const NdbDictionary::Column *) {
   result = uint3korr((char *) buf);
   return 1;
 }
 
-int dth_write32_medium_unsigned(Int32 value, void *buf) {
+int dth_write32_medium_unsigned(Int32 value, void *buf,
+                                const NdbDictionary::Column *) {
   Uint8 *cbuf = (Uint8 *) buf;
   cbuf[0] = (Uint8) (value);
   cbuf[1] = (Uint8) (value >> 8);
@@ -865,13 +889,14 @@ int dth_encode_year(const NdbDictionary:
   return len;
 }
 
-int dth_read32_year(Int32 &result, const void * const buf) {
+int dth_read32_year(Int32 &result, const void * const buf, 
+                    const NdbDictionary::Column *) {
   Uint8 i = *((Uint8 *) buf);
   result = ((Int32) i) + 1900;
   return 1;
 }
 
-int dth_write32_year(Int32 value, void *buf) {
+int dth_write32_year(Int32 value, void *buf, const NdbDictionary::Column *) {
   if(value < 1900 || value > 2155) 
     return 0;
   Uint8 i = (Uint8) (value - 1900);
@@ -938,7 +963,7 @@ int dth_decode_date(const NdbDictionary:
   time_helper tm = { 0,0,0,0,0,0,0, false };
 
   /* Read the encoded date from the buffer */
-  dth_read32_medium_unsigned(encoded_date, buf);
+  dth_read32_medium_unsigned(encoded_date, buf, 0);
 
   /* Unpack the encoded date */
   tm.day   = (encoded_date & 31);  // five bits
@@ -972,7 +997,7 @@ int dth_encode_date(const NdbDictionary:
   encoded_date = (tm.year << 9) | (tm.month << 5) | tm.day;
 
   /* Store the encoded value as an UNSIGNED MEDIUM */
-  return dth_write32_medium_unsigned(encoded_date, (char *) buf);
+  return dth_write32_medium_unsigned(encoded_date, (char *) buf, 0);
 }
 
 
@@ -983,7 +1008,7 @@ int dth_decode_time(const NdbDictionary:
   time_helper tm = { 0,0,0,0,0,0,0, false };
   
   /* Read the integer time from the buffer */
-  dth_read32_medium(int_time, buf);
+  dth_read32_medium(int_time, buf, 0);
   
   /* Factor it out */
   factor_HHMMSS(& tm, int_time);
@@ -1009,7 +1034,7 @@ int dth_encode_time(const NdbDictionary:
   if(! safe_strtol(copybuff.ptr, &int_time)) return DTH_NUMERIC_OVERFLOW;
       
   /* Store the HHMMSS int as a MEDIUM INT */
-  return dth_write32_medium(int_time, (char *) buf);
+  return dth_write32_medium(int_time, (char *) buf, 0);
 }
 
 
@@ -1054,6 +1079,133 @@ int dth_encode_datetime(const NdbDiction
   return 1;
 }
 
+/***** wl#946 MySQL 5.6: sub-second temporal types ******/
+
+/* buf points to the fractional part */
+int getFraction(const NdbDictionary::Column *col, const void *buf) {
+  int prec  = col->getPrecision();
+  int r = 0;
+  
+  switch(prec) {
+    case 0:
+      break;
+    case 1:
+      dth_read32<Uint8>(r, buf, col);
+      r /= 10;
+      break;
+    case 2:
+      dth_read32<Uint8>(r, buf, col);
+      break;
+    case 3:
+      dth_read32<Uint16>(r, buf, col);
+      r /= 10;
+      break;
+    case 4:
+      dth_read32<Uint16>(r, buf, col);
+      break;
+    case 5:
+      dth_read32_medium_unsigned(r, buf, col);
+      r /= 10;
+      break;
+    case 6:
+      dth_read32_medium_unsigned(r, buf, col);
+      break;
+  }
+    
+  return r;
+}
+
+
+void setFraction(const NdbDictionary::Column *col, int microsec, void *buf) {
+  int val = 0;
+  int prec  = col->getPrecision();
+  
+  switch(prec) {
+    case 6:
+    case 5:
+      val = microsec;
+      dth_write32_medium_unsigned(val, buf, col);
+      break;
+    case 4:
+    case 3:
+      val = microsec / 100;
+      dth_write32<Uint16>(val, buf, col);
+      break;
+    case 2:
+    case 1:
+      val = microsec / 10000;
+      dth_write32<Uint8>(val, buf, col);
+      break;      
+    case 0:
+      break; 
+  }
+
+  return;
+}
+
+
+/***** TIMESTAMP2 *****/
+
+int dth_decode_timestamp2(const NdbDictionary::Column *col, char * &str, 
+                          const void *buf) {
+  int whole, fraction, len;
+  const char * fspbuf = (char *) buf + 4;
+  
+  /* Get the whole number part */
+  dth_read32<Uint32>(whole, buf, col);
+  
+  /* Get the fractional part */
+  fraction = getFraction(col, fspbuf);
+
+  if(fraction) {
+    len = sprintf(str, "%d.%d", whole, fraction);
+  }
+  else {
+    len = printf(str, "%d", whole);
+  }
+  return len;
+}
+
+size_t dth_length_timestamp2(const NdbDictionary::Column *col, const void *buf) {
+  size_t len;
+  int prec = col->getPrecision();
+  
+  len = dth_length_u<Uint32>(col, buf);
+  if(prec > 0) {
+    len += 1;     /* for decimal point */
+    len += prec;  
+  }
+
+  return len;
+}
+
+int dth_encode_timestamp2(const NdbDictionary::Column *col, size_t len, 
+                          const char *str, void *buf) {
+  /* TODO: Implement this */
+  return len;
+}
+
+/* Read a timestamp into an int32.
+   The fractional part is ignored.
+*/
+int dth_read32_timestamp2(int &result, const void * const buf,
+                          const NdbDictionary::Column *) {
+  LOAD_ALIGNED_DATA(unsigned int, i, buf);
+  result = (Int32) i;
+  return 1;
+}
+
+/* Write a timestamp from an int32.
+   The fractional part is set to zero.
+*/   
+int dth_write32_timestamp2(Int32 value, void *buf, 
+                           const NdbDictionary::Column *col) {
+  int r = dth_write32<unsigned int>(value, buf, col);
+  char * fspbuf = (char *) buf + 4;
+  setFraction(col, 0, fspbuf);
+  return r;
+}                           
+
 
 /***** FLOAT and DOUBLE *****/
 

=== modified file 'storage/ndb/memcache/src/ExpireTime.cc'
--- a/storage/ndb/memcache/src/ExpireTime.cc	2011-12-16 10:04:43 +0000
+++ b/storage/ndb/memcache/src/ExpireTime.cc	2012-11-16 02:35:56 +0000
@@ -47,6 +47,10 @@ ExpireTime::ExpireTime(workitem *i) :
 }
 
 
+/*  stored_item_has_expired() 
+    If the timestamp is a MySQL 5.6 fractional-second timestamp,
+    only the integer part is considered.
+*/
 bool ExpireTime::stored_item_has_expired(Operation &op) {  
   SERVER_CORE_API * SERVER = item->pipeline->engine->server.core;
   time_t stored_exptime;

=== modified file 'storage/ndb/memcache/src/Record.cc'
--- a/storage/ndb/memcache/src/Record.cc	2012-04-14 00:53:04 +0000
+++ b/storage/ndb/memcache/src/Record.cc	2012-11-16 02:35:56 +0000
@@ -264,10 +264,11 @@ int Record::getIntValue(int id, char *da
   int idx = map[id];
   NumericHandler * h = handlers[idx]->native_handler;
   const char * buffer = data + specs[idx].offset;
+  const NdbDictionary::Column * col = specs[idx].column;
   int i = 0;
   
   if(h) {
-    if(h->read_int32(i, buffer) < 0) return 0;
+    if(h->read_int32(i, buffer, col) < 0) return 0;
   }
   else {
     logger->log(LOG_WARNING, 0, "getIntValue() failed for column %s - "
@@ -287,9 +288,10 @@ bool Record::setIntValue(int id, int val
 
   NumericHandler * h = handlers[idx]->native_handler;
   char * buffer = data + specs[idx].offset;
+  const NdbDictionary::Column * col = specs[idx].column;
   
   if(h) {
-    return (h->write_int32(value,buffer) > 0);
+    return (h->write_int32(value, buffer, col) > 0);
   } 
   else {
     logger->log(LOG_WARNING, 0, "setIntValue() failed for column %s - "

=== modified file 'storage/ndb/src/common/util/NdbSqlUtil.cpp'
--- a/storage/ndb/src/common/util/NdbSqlUtil.cpp	2012-04-03 11:45:57 +0000
+++ b/storage/ndb/src/common/util/NdbSqlUtil.cpp	2012-11-27 12:31:09 +0000
@@ -1607,18 +1607,6 @@ static uint maxfrac[1 + maxprec] = {
 };
 
 static uint
-getrand()
-{
-  union {
-    uint32 n;
-    uchar b[4];
-  };
-  for (int i = 0; i < 4; i++)
-    b[i] = (uchar)ndb_rand();
-  return n;
-}
-
-static uint
 getrand(uint m)
 {
   assert(m != 0);
@@ -2010,7 +1998,7 @@ static int
 testmain()
 {
   ndb_init();
-  struct { char* env; int* val; } opt[] = {
+  struct { const char* env; int* val; } opt[] = {
     { "TEST_NDB_SQL_UTIL_SEED", &seed },
     { "TEST_NDB_SQL_UTIL_LOOPS", &loops },
     { "TEST_NDB_SQL_UTIL_VERBOSE", &verbose },

=== modified file 'storage/ndb/src/mgmsrv/ConfigManager.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigManager.cpp	2012-03-21 15:31:47 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigManager.cpp	2012-11-23 09:42:42 +0000
@@ -2078,7 +2078,7 @@ ConfigManager::fetch_config(void)
 
   if (tmp == NULL) {
     g_eventLogger->error("%s", m_config_retriever.getErrorString());
-    DBUG_RETURN(false);
+    DBUG_RETURN(NULL);
   }
 
   DBUG_RETURN(new Config(tmp));

=== modified file 'storage/ndb/test/ndbapi/testMgmd.cpp'
--- a/storage/ndb/test/ndbapi/testMgmd.cpp	2012-03-27 09:47:51 +0000
+++ b/storage/ndb/test/ndbapi/testMgmd.cpp	2012-11-23 09:40:14 +0000
@@ -227,12 +227,12 @@ public:
   const BaseString connectstring(const Properties& config)
   {
     const char* hostname;
-    if (!get_section_string(config, m_name.c_str(), "HostName", &hostname))
-      return false;
+    require(!get_section_string(config, m_name.c_str(),
+                                "HostName", &hostname));
 
     Uint32 port;
-    if (!get_section_uint32(config, m_name.c_str(), "PortNumber", &port))
-      return false;
+    require(!get_section_uint32(config, m_name.c_str(),
+                                "PortNumber", &port));
 
     BaseString constr;
     constr.assfmt("%s:%d", hostname, port);

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-cluster branch (magnus.blaudd:3578 to 3579) magnus.blaudd27 Nov