List:Commits« Previous MessageNext Message »
From:John David Duncan Date:September 26 2011 3:08am
Subject:bzr push into mysql-5.5-cluster branch (john.duncan:3551 to 3554)
View as plain text  
 3554 John David Duncan	2011-09-25
      work on const-conversion issues found by stricter compiler

    modified:
      storage/ndb/memcache/include/DataTypeHandler.h
      storage/ndb/memcache/src/DataTypeHandler.cc
      storage/ndb/memcache/src/Record.cc
 3553 John David Duncan	2011-09-25
      check for both __i386 and __x86_64

    modified:
      storage/ndb/memcache/src/DataTypeHandler.cc
 3552 John David Duncan	2011-09-25
      Several fixes to ndb/memcache/DataTypeHandler:
        ensure aligned accesses on Sparc.
        returned lengths should not include terminating null character.
        doubles should not be space-padded. 
      New test case for float, double, and decimal.
      Another attempt to work around __func__ on old Sun cc.

    added:
      mysql-test/suite/ndb_memcache/r/type_numeric.result
      mysql-test/suite/ndb_memcache/t/type_numeric.test
    modified:
      mysql-test/suite/ndb_memcache/include/datatypes_tables.inc
      storage/ndb/memcache/include/debug.h
      storage/ndb/memcache/src/DataTypeHandler.cc
 3551 John David Duncan	2011-09-25
      mtr: don't try to run ndb_memcache tests with the embedded server.
      building ndb/memcache: don't disable asserts.

    modified:
      mysql-test/mysql-test-run.pl
      storage/ndb/memcache/CMakeLists.txt
=== modified file 'mysql-test/suite/ndb_memcache/include/datatypes_tables.inc'
--- a/mysql-test/suite/ndb_memcache/include/datatypes_tables.inc	2011-09-12 10:05:07 +0000
+++ b/mysql-test/suite/ndb_memcache/include/datatypes_tables.inc	2011-09-26 01:41:34 +0000
@@ -17,7 +17,7 @@ CREATE TABLE tt005 (mkey binary(20) not 
 CREATE TABLE tt006 (mkey varbinary(32) not null primary key, sval varbinary(32));
 CREATE TABLE tt007 (mkey float not null primary key, sval float);
 CREATE TABLE tt008 (mkey double not null primary key, sval double);
-CREATE TABLE tt009 (mkey decimal not null primary key, sval decimal);
+CREATE TABLE tt009 (mkey decimal(8,2) not null primary key, sval decimal(8,2));
 CREATE TABLE tt010 (mkey date not null primary key, sval date);
 CREATE TABLE tt011 (mkey datetime not null primary key, sval datetime);
 CREATE TABLE tt012 (mkey time not null primary key, sval time);

=== added file 'mysql-test/suite/ndb_memcache/r/type_numeric.result'
--- a/mysql-test/suite/ndb_memcache/r/type_numeric.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb_memcache/r/type_numeric.result	2011-09-26 01:41:34 +0000
@@ -0,0 +1,45 @@
+Table tt007: 
+   1500.01
+   0
+   0.5
+   -1
+   -3.55
+   -15559.4
+Table tt008: 
+   1500.0100000000
+   0.0000000000
+   0.5000000000
+   -1.0000000000
+   -3.5500000000
+   -15559.4100000000
+Table tt009: 
+   1500.01
+   0.00
+   0.50
+   -1.00
+   -3.55
+   -15559.41
+SELECT * FROM tt007 order by mkey;
+mkey	sval
+-11	1500.01
+0	0
+1	0.5
+2	-1
+3	-3.55
+3.6	-15559.4
+SELECT * FROM tt008 order by mkey;
+mkey	sval
+-11	1500.01
+0	0
+1	0.5
+2	-1
+3	-3.55
+3.6	-15559.41
+SELECT * FROM tt009 order by mkey;
+mkey	sval
+-11.00	1500.01
+0.00	0.00
+1.00	0.50
+2.00	-1.00
+3.00	-3.55
+3.60	-15559.41

=== added file 'mysql-test/suite/ndb_memcache/t/type_numeric.test'
--- a/mysql-test/suite/ndb_memcache/t/type_numeric.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/ndb_memcache/t/type_numeric.test	2011-09-26 01:41:34 +0000
@@ -0,0 +1,47 @@
+--source suite/ndb_memcache/include/have_memcache.inc
+
+# Basic data type tests for 
+# tt007 float
+# tt008 double
+# tt009 decimal
+
+--source suite/ndb_memcache/include/memcached_wait_for_ready.inc
+--source suite/ndb_memcache/include/datatypes_tables.inc
+--real_sleep 1
+--perl
+
+use strict;
+use lib "lib";
+use My::Memcache;
+my $mc = My::Memcache::Binary->new();
+my $port = $ENV{MTR_BUILD_THREAD} * 10 + 10000 + 8;
+my $r = $mc->connect("localhost",$port);
+my $cf_gen = $mc->wait_for_reconf(2);
+
+if($cf_gen > 0) {
+
+  foreach my $test ("tt007", "tt008", "tt009") {
+    print "Table $test: \n";
+    
+    $mc->set("$test:0"  ,  0)            || die;  # zero
+    $mc->set("$test:1"  , 0.5)           || die;  # fractional value
+    $mc->set("$test:2"  , -1)            || die;  # negative value
+    $mc->set("$test:3"  , -3.55)         || die;  # negative fractional value
+    $mc->set("$test:3.6", -15559.41)     || die;  # fractional key
+    $mc->set("$test:-11", 1500.01)       || die;  # negative key
+    
+    print "   " . $mc->get("$test:-11") . "\n";
+    print "   " . $mc->get("$test:0")   . "\n";
+    print "   " . $mc->get("$test:1")   . "\n";
+    print "   " . $mc->get("$test:2")   . "\n";
+    print "   " . $mc->get("$test:3")   . "\n";
+    print "   " . $mc->get("$test:3.6") . "\n";
+  }
+}
+
+EOF
+
+SELECT * FROM tt007 order by mkey;
+SELECT * FROM tt008 order by mkey;
+SELECT * FROM tt009 order by mkey;
+

=== modified file 'storage/ndb/memcache/include/DataTypeHandler.h'
--- a/storage/ndb/memcache/include/DataTypeHandler.h	2011-09-24 05:45:06 +0000
+++ b/storage/ndb/memcache/include/DataTypeHandler.h	2011-09-26 02:42:21 +0000
@@ -49,7 +49,7 @@ enum {  /* These can be returned by read
 */
 typedef struct {
   int (*read_int32)(Int32 & result, const void * const buf);
-  int (*write_int32)(Int32 value, const char * buf);
+  int (*write_int32)(Int32 value, void * const buf);
 } NumericHandler;
 
 

=== modified file 'storage/ndb/memcache/include/debug.h'
--- a/storage/ndb/memcache/include/debug.h	2011-09-25 04:37:27 +0000
+++ b/storage/ndb/memcache/include/debug.h	2011-09-26 01:41:34 +0000
@@ -46,7 +46,7 @@
 
 /* Very old Sun compilers do not have __func__ */
 #ifdef __SUNPRO_C
-#if __SUNPRO_C < 0x530 
+#if __SUNPRO_C < 0x600
 #define __func__ "?"
 #endif
 #endif

=== modified file 'storage/ndb/memcache/src/DataTypeHandler.cc'
--- a/storage/ndb/memcache/src/DataTypeHandler.cc	2011-09-24 05:45:06 +0000
+++ b/storage/ndb/memcache/src/DataTypeHandler.cc	2011-09-26 02:42:21 +0000
@@ -38,6 +38,32 @@
 #include "debug.h"
 #include "int3korr.h"
 
+// FOR INTEGER TYPES: x86 allows unaligned access, but most other machines do not.
+// FOR FLOATING POINT TYPES: access must be aligned on all architectures
+#define LOAD_UNALIGNED(Type, x, buf) \
+Type x = *((Type *) buf);
+
+#define STORE_UNALIGNED(Type, x, buf) \
+*((Type *) buf) = (Type) x;
+
+#define LOAD_ALIGNED(Type, x, buf) \
+Type x; \
+memcpy(&x, buf, sizeof(x));
+
+#define STORE_ALIGNED(Type, x, buf) \
+Type tmp_value = (Type) x; \
+memcpy(buf, &tmp_value, sizeof(tmp_value));
+
+#if defined(__i386) || defined(__x86_64)
+#define LOAD_FOR_ARCHITECTURE LOAD_UNALIGNED
+#define STORE_FOR_ARCHITECTURE STORE_UNALIGNED 
+#else
+#define LOAD_FOR_ARCHITECTURE LOAD_ALIGNED
+#define STORE_FOR_ARCHITECTURE STORE_ALIGNED
+#endif
+
+   
+
 extern EXTENSION_LOGGER_DESCRIPTOR *logger;
 
 #define DECODE_ARGS const NdbDictionary::Column *, char * &, const void * const
@@ -50,13 +76,13 @@ typedef int    impl_writeToNdb(ENCODE_AR
 
 /* Implementations for NumericHandlers */
 template<typename INTTYPE> int dth_read32(Int32 &, const void * const);
-template<typename INTTYPE> int dth_write32(Int32, const char *);
+template<typename INTTYPE> int dth_write32(Int32, void * const);
 int dth_read32_year(Int32 &, const void * const);
-int dth_write32_year(Int32, const char *);
+int dth_write32_year(Int32, void * const);
 int dth_read32_medium(Int32 &, const void * const);
-int dth_write32_medium(Int32, const char *);
+int dth_write32_medium(Int32, void * const);
 int dth_read32_medium_unsigned(Int32 &, const void * const);
-int dth_write32_medium_unsigned(Int32, const char *);
+int dth_write32_medium_unsigned(Int32, void * const);
 
 
 /* Implementations for readFromNdb() */
@@ -540,9 +566,10 @@ int dth_encode_char(const NdbDictionary:
 
 /* Using separate templates for signed and unsigned types avoids 
    a compiler warning */
+
 template<typename INTTYPE> size_t dth_length_s(const NdbDictionary::Column *,
                                                const void *buf) {
-  INTTYPE i = *((INTTYPE *) buf);
+  LOAD_FOR_ARCHITECTURE(INTTYPE, i, buf);
   size_t len = (i < 0) ? 2 : 1;  
   for( ; i > 0 ; len++) i = i / 10;
   return len;  
@@ -550,21 +577,22 @@ template<typename INTTYPE> size_t dth_le
 
 template<typename INTTYPE> size_t dth_length_u(const NdbDictionary::Column *,
                                                const void *buf) {
-  INTTYPE i = *((INTTYPE *) buf);
+  LOAD_FOR_ARCHITECTURE(INTTYPE, i, buf);
   size_t len = 1;
   for( ; i > 0 ; len++) i = i / 10;
   return len;  
 }
 
+/* read32: read the value from the buffer into an int32 */
 template<typename INTTYPE> int dth_read32(Int32 &result, const void * const buf) {
-  INTTYPE i = *((INTTYPE *) buf);
+  LOAD_FOR_ARCHITECTURE(INTTYPE, i, buf);
   result = (Int32) i;
   return 1;
 }
 
-template<typename INTTYPE> int dth_write32(Int32 value, const char *buf) {
-  INTTYPE i = (INTTYPE) value;
-  * ((INTTYPE *) buf) = i;
+/* write32: write an int32 into the buffer */
+template<typename INTTYPE> int dth_write32(Int32 value, void *buf) {
+  STORE_FOR_ARCHITECTURE(INTTYPE, value, buf);
   return 1;
 }
 
@@ -583,7 +611,7 @@ template<typename INTTYPE> int dth_write
 int dth_decode_tinyint(const NdbDictionary::Column *col,
                        char * &str, const void *buf) {
   char i = * (char *) buf;
-  return sprintf(str, "%d", (int) i) + 1;  // +1 for null terminator
+  return sprintf(str, "%d", (int) i);
 }
 
 int dth_encode_tinyint(const NdbDictionary::Column *col, size_t len,
@@ -604,7 +632,7 @@ int dth_encode_tinyint(const NdbDictiona
 int dth_decode_tiny_unsigned(const NdbDictionary::Column *col,
                              char * &str, const void *buf) {
   Uint8 i = * (Uint8 *) buf;
-  return sprintf(str, "%d", (int) i) + 1;  // +1 for null terminator
+  return sprintf(str, "%d", (int) i);
 }
 
 int dth_encode_tiny_unsigned(const NdbDictionary::Column *, size_t len, 
@@ -625,7 +653,8 @@ int dth_encode_tiny_unsigned(const NdbDi
 /***** SMALLINT ******/
 int dth_decode_smallint(const NdbDictionary::Column *col,
                         char * &str, const void *buf) {  
-  return sprintf(str, "%hd",* (short *) buf) + 1;  // +1 for null terminator
+  LOAD_FOR_ARCHITECTURE(Int16, shortval, buf);
+  return sprintf(str, "%hd", shortval);
 }
 
 int dth_encode_smallint(const NdbDictionary::Column *col, size_t len, 
@@ -636,16 +665,17 @@ int dth_encode_smallint(const NdbDiction
   if((! safe_strtol(copy_buff, &intval)) || intval > 32767 || intval < -32768) {
     return DTH_NUMERIC_OVERFLOW;
   }
+  STORE_FOR_ARCHITECTURE(Int16, intval, buf);
   
-  *((Int16 *) buf) = (Int16) intval;
   return len;
 }
 
 
 /***** SMALL UNSIGNED ******/
 int dth_decode_small_unsigned(const NdbDictionary::Column *col,
-                              char * &str, const void *buf) {  
-  return sprintf(str, "%hu",* (short *) buf) + 1;  // +1 for null terminator
+                              char * &str, const void *buf) {
+  LOAD_FOR_ARCHITECTURE(Uint16, shortval, buf);
+  return sprintf(str, "%hu", shortval);
 }
 
 int dth_encode_small_unsigned(const NdbDictionary::Column *col, size_t len, 
@@ -656,8 +686,7 @@ int dth_encode_small_unsigned(const NdbD
   if((! safe_strtoul(copy_buff, &intval)) || intval > 65535) {
     return DTH_NUMERIC_OVERFLOW;
   }
-  
-  *((Uint16 *) buf) = (Uint16) intval;
+  STORE_FOR_ARCHITECTURE(Uint16, intval, buf);
   return len;
 }
 
@@ -667,7 +696,7 @@ int dth_decode_mediumint(const NdbDictio
                          char * &str, const void *buf) {
   char * cbuf = (char *) buf;
   int i = sint3korr(cbuf);  
-  return sprintf(str, "%d", i) + 1;  // +1 for null terminator
+  return sprintf(str, "%d", i);
 }
 
 size_t dth_length_mediumint(const NdbDictionary::Column *col, const void *buf) {
@@ -702,7 +731,7 @@ int dth_read32_medium(Int32 &result, con
   return 1;
 }
 
-int dth_write32_medium(Int32 value, const char *buf) {
+int dth_write32_medium(Int32 value, void *buf) {
   Int8 *cbuf = (Int8 *) buf;
   cbuf[0] = (Int8) (value);
   cbuf[1] = (Int8) (value >> 8);
@@ -716,7 +745,7 @@ int dth_decode_medium_unsigned(const Ndb
                                char * &str, const void *buf) {
   char * cbuf = (char *) buf;
   unsigned int i = uint3korr(cbuf);
-  return sprintf(str, "%u", i) + 1;  // +1 for null terminator
+  return sprintf(str, "%u", i);
 }
 
 size_t dth_length_medium_unsigned(const NdbDictionary::Column *, const void *buf) {
@@ -749,7 +778,7 @@ int dth_read32_medium_unsigned(Int32 &re
   return 1;
 }
 
-int dth_write32_medium_unsigned(Int32 value, const char *buf) {
+int dth_write32_medium_unsigned(Int32 value, void *buf) {
   Uint8 *cbuf = (Uint8 *) buf;
   cbuf[0] = (Uint8) (value);
   cbuf[1] = (Uint8) (value >> 8);
@@ -761,72 +790,80 @@ int dth_write32_medium_unsigned(Int32 va
 /***** INT *****/
 int dth_decode_int(const NdbDictionary::Column *col,
                    char * &str, const void *buf) {  
-  return sprintf(str, "%d",* (int *) buf) + 1;  // +1 for null terminator
+  LOAD_FOR_ARCHITECTURE(int, i, buf);
+  return sprintf(str, "%d", i);
 }
 
 int dth_encode_int(const NdbDictionary::Column *col, size_t len, 
                    const char *str, void *buf) {
   MAKE_COPY_BUFFER(32);
+  int intval = 0;
 
-  int *ibuf = (int *) buf;
-  if(safe_strtol(copy_buff, ibuf))
-    return len;
-  else
+  if(! safe_strtol(copy_buff, &intval))
     return DTH_NUMERIC_OVERFLOW;
+
+  STORE_FOR_ARCHITECTURE(int, intval, buf);
+  return len;
 }                                 
 
 
 /***** INT UNSIGNED *****/
 int dth_decode_unsigned(const NdbDictionary::Column *col,
                         char * &str, const void *buf) {  
-  return sprintf(str, "%du",* (Uint32 *) buf) + 1;  // +1 for null terminator
+  LOAD_FOR_ARCHITECTURE(Uint32, i, buf)
+  return sprintf(str, "%du", i);
 }
 
 int dth_encode_unsigned(const NdbDictionary::Column *col, size_t len,
                         const char *str, void *buf) {
   MAKE_COPY_BUFFER(32);
+  Uint32 uintval = 0;
   
-  Uint32 *ibuf = (Uint32 *) buf;
-  if(safe_strtoul(copy_buff, ibuf))
-    return len;
-  else
+  if(! safe_strtoul(copy_buff, &uintval))
     return DTH_NUMERIC_OVERFLOW;
+
+  STORE_FOR_ARCHITECTURE(Uint32, uintval, buf);
+  return len;
 }                                 
 
 
 /***** BIGINT *****/
 int dth_decode_bigint(const NdbDictionary::Column *col,  
                       char * &str, const void *buf) {
-  return sprintf(str, "%"PRId64,* (Int64 *) buf) + 1;  // +1 for null
+  LOAD_FOR_ARCHITECTURE(Int64, int64val, buf);
+  return sprintf(str, "%"PRId64, int64val);
 }
 
 int dth_encode_bigint(const NdbDictionary::Column *col, size_t len,
                       const char *str, void *buf) {
   MAKE_COPY_BUFFER(32);
+  int64_t int64val = 0;
   
-  int64_t *ibuf = (int64_t *) buf;
-  if(safe_strtoll(copy_buff, ibuf)) 
-    return len;
-  else
+  if(! safe_strtoll(copy_buff, &int64val)) 
     return DTH_NUMERIC_OVERFLOW;
+
+  STORE_FOR_ARCHITECTURE(int64_t, int64val, buf);
+  return len;
 }
 
 
 /***** BIGINT UNSIGNED *****/
 int dth_decode_ubigint(const NdbDictionary::Column *col,  
                        char * &str, const void *buf) {
-  return sprintf(str, "%"PRIu64,* (Uint64 *) buf) + 1;  // +1 for null
+  LOAD_FOR_ARCHITECTURE(Uint64, uint64val, buf);
+  return sprintf(str, "%"PRIu64, uint64val);
 }
 
 int dth_encode_ubigint(const NdbDictionary::Column *col, size_t len,
                        const char *str, void *buf) {
   MAKE_COPY_BUFFER(32);
+  uint64_t uint64val = 0;
 
-  uint64_t *ibuf = (uint64_t *) buf;
-  if(safe_strtoull(copy_buff, ibuf))  
-    return len;
-  else 
+  if(! safe_strtoull(copy_buff, &uint64val))  
     return DTH_NUMERIC_OVERFLOW;
+
+  STORE_FOR_ARCHITECTURE(uint64_t, uint64val, buf);
+  return len;
 }                                 
 
 
@@ -853,7 +890,7 @@ int dth_encode_enum(const NdbDictionary:
 int dth_decode_year(const NdbDictionary::Column *, char * &str, const void *buf) {
   Uint8 i = * (Uint8 *) buf;
   int year = i + 1900;
-  return sprintf(str, "%d", year) + 1;  // +1 for null terminator
+  return sprintf(str, "%d", year);
 }
 
 size_t dth_length_year(const NdbDictionary::Column *col, const void *buf) {
@@ -880,7 +917,7 @@ int dth_read32_year(Int32 &result, const
   return 1;
 }
 
-int dth_write32_year(Int32 value, const char *buf) {
+int dth_write32_year(Int32 value, void *buf) {
   if(value < 1900 || value > 2155) 
     return 0;
   Uint8 i = (Uint8) (value - 1900);
@@ -954,7 +991,7 @@ int dth_decode_date(const NdbDictionary:
   tm.month = (encoded_date >> 5 & 15); // four bits
   tm.year  = (encoded_date >> 9);
   
-  return sprintf(str, "%04du-%02du-%02du",tm.year, tm.month, tm.day) + 1;
+  return sprintf(str, "%04du-%02du-%02du",tm.year, tm.month, tm.day);
 }
 
 size_t dth_length_date(const NdbDictionary::Column *col, const void *buf) {
@@ -1025,12 +1062,11 @@ int dth_encode_time(const NdbDictionary:
 /***** DATETIME *****/
 
 int dth_decode_datetime(const NdbDictionary::Column *, char * &str, const void *buf) {
-  Uint64 int_datetime;
   Int32 int_date, int_time;
   time_helper tm = { 0,0,0,0,0,0,0, false };
   
   /* Read the datetime from the buffer */
-  int_datetime = * ((Uint64 *) buf);
+  LOAD_FOR_ARCHITECTURE(Uint64, int_datetime, buf);
   
   /* Factor it out */
   int_date = int_datetime / 1000000;
@@ -1059,7 +1095,7 @@ int dth_encode_datetime(const NdbDiction
   if(! safe_strtoull(copybuff.ptr, &int_datetime)) return DTH_NUMERIC_OVERFLOW;
   
   /* Store it */
-  * ((Uint64 *) buf) = int_datetime;
+  STORE_FOR_ARCHITECTURE(Uint64, int_datetime, buf);
   
   return 1;
 }
@@ -1074,40 +1110,44 @@ int dth_encode_datetime(const NdbDiction
 */ 
 int dth_decode_float(const NdbDictionary::Column *col, 
                      char * &str, const void *buf) {
-  double d = (double) (* (float *) buf);
-  return sprintf(str, "%G", d) + 1;
+  LOAD_ALIGNED(float, fval, buf);
+
+  double dval = fval;
+  return sprintf(str, "%G", dval);
 }
 
 size_t dth_length_float(const NdbDictionary::Column *col,
                         const void *buf) {
   char stack_copy[16];
-  double d = (double) (* (float *) buf);
-  return snprintf(stack_copy, 16, "%G", d) + 1;
+  LOAD_ALIGNED(float, fval, buf);
+  double dval = fval;
+  return snprintf(stack_copy, 16, "%G", dval);
 }
 
 int dth_decode_double(const NdbDictionary::Column *col, 
                      char * &str, const void *buf) {
-  double d = (* (double *) buf);
-  return sprintf(str, "%-20.10F", d) + 1;
+  LOAD_ALIGNED(double, dval, buf);
+  return sprintf(str, "%.10F", dval);
 }
 
 size_t dth_length_double(const NdbDictionary::Column *col,
                          const void *buf) {
   char stack_copy[30];
-  double d = (* (double *) buf);
-  return snprintf(stack_copy, 30, "%-20.10F", d) + 1;
+  LOAD_ALIGNED(double, dval, buf);
+  return snprintf(stack_copy, 30, "%.10F", dval);
 }
 
-template <typename T> int dth_encode_fp(const NdbDictionary::Column *col, 
-                                        size_t len, const char *str, void *buf) {
+template <typename FPTYPE> int dth_encode_fp(const NdbDictionary::Column *col, 
+                                             size_t len, const char *str, 
+                                             void *buf) {
   MAKE_COPY_BUFFER(64);
   errno = 0;
-  double d = strtod(copy_buff, NULL);
+  double dval = strtod(copy_buff, NULL);
   if(errno == ERANGE) {
     return DTH_NUMERIC_OVERFLOW;
   }
   
-  *((T *) buf) = (T) d;
+  STORE_ALIGNED(FPTYPE, dval, buf);
   return len;
 }
 
@@ -1119,12 +1159,12 @@ int dth_decode_decimal(const NdbDictiona
   int prec  = col->getPrecision();
   int len = scale + prec + 3;
   decimal_bin2str(buf, col->getSizeInBytes(), prec, scale, str, len);
-  return len;
+  return strlen(str);
 }
 
 size_t dth_length_decimal(const NdbDictionary::Column *col,
                            const void *buf) {
-  return col->getScale() + col->getPrecision() + 3; // sign, point, and terminator
+  return col->getScale() + col->getPrecision() + 2; // 2 for sign and point
 }
 
 int dth_encode_decimal(const NdbDictionary::Column *col, size_t len, 
@@ -1133,5 +1173,11 @@ int dth_encode_decimal(const NdbDictiona
   int scale = col->getScale();
   int prec  = col->getPrecision();
   int r = decimal_str2bin(str, len, prec, scale, buf, col->getSizeInBytes());
-  return (r == 0) ? len : DTH_NUMERIC_OVERFLOW;
+  if(r == E_DEC_OK || r == E_DEC_TRUNCATED) {
+    return len;
+  }
+  else {
+    DEBUG_PRINT("deicmal_str2bin() returns %d", r);
+    return DTH_NUMERIC_OVERFLOW;
+  }
 }

=== modified file 'storage/ndb/memcache/src/Record.cc'
--- a/storage/ndb/memcache/src/Record.cc	2011-09-24 05:45:06 +0000
+++ b/storage/ndb/memcache/src/Record.cc	2011-09-26 02:42:21 +0000
@@ -214,7 +214,7 @@ int Record::getIntValue(int id, char *da
 bool Record::setIntValue(int id, int value, char *data) const {
   int index = map[id];
   NumericHandler * h = handlers[index]->native_handler;
-  const char * buffer = data + specs[index].offset;
+  char * buffer = data + specs[index].offset;
   
   if(h) {
     return (h->write_int32(value,buffer) > 0);

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