3594 Tor Didriksen 2011-08-29
BUG#12911710 - VALGRIND FAILURE IN ROW-DEBUG:PERFSCHEMA.SOCKET_SUMMARY_BY_INSTANCE_FUNC
Converting the number zero to binary and back yielded the number zero,
but with no digits, i.e. zero precision.
This made the multiply algorithm go haywire in various ways.
@ include/decimal.h
Document struct st_decimal_t
@ mysql-test/r/type_newdecimal.result
New test case (valgrind warnings)
@ mysql-test/t/type_newdecimal.test
New test case (valgrind warnings)
@ sql/my_decimal.h
Remove the HAVE_purify enabled/disabled code.
@ strings/decimal.c
Make a proper zero, with non-zero precision.
modified:
include/decimal.h
mysql-test/r/type_newdecimal.result
mysql-test/t/type_newdecimal.test
sql/my_decimal.h
strings/decimal.c
3593 Tor Didriksen 2011-08-29 [merge]
local merge
modified:
mysql-test/suite/innodb_plugin/r/innodb-index.result
mysql-test/suite/innodb_plugin/t/innodb-index.test
storage/innobase/btr/btr0btr.c
storage/innobase/btr/btr0cur.c
storage/innobase/buf/buf0buf.c
storage/innobase/fsp/fsp0fsp.c
storage/innobase/include/btr0btr.h
storage/innobase/include/btr0cur.h
storage/innobase/include/buf0buf.h
storage/innobase/include/fsp0fsp.h
storage/innobase/include/mtr0mtr.h
storage/innobase/include/mtr0mtr.ic
storage/innobase/mtr/mtr0mtr.c
storage/innobase/row/row0ins.c
storage/innobase/row/row0row.c
storage/innobase/row/row0upd.c
storage/innobase/trx/trx0undo.c
storage/innodb_plugin/ChangeLog
storage/innodb_plugin/btr/btr0btr.c
storage/innodb_plugin/btr/btr0cur.c
storage/innodb_plugin/buf/buf0buf.c
storage/innodb_plugin/fsp/fsp0fsp.c
storage/innodb_plugin/include/btr0btr.h
storage/innodb_plugin/include/btr0cur.h
storage/innodb_plugin/include/buf0buf.h
storage/innodb_plugin/include/fsp0fsp.h
storage/innodb_plugin/include/mtr0mtr.h
storage/innodb_plugin/include/mtr0mtr.ic
storage/innodb_plugin/include/trx0undo.h
storage/innodb_plugin/mtr/mtr0mtr.c
storage/innodb_plugin/row/row0ins.c
storage/innodb_plugin/row/row0row.c
storage/innodb_plugin/row/row0upd.c
storage/innodb_plugin/trx/trx0rec.c
storage/innodb_plugin/trx/trx0undo.c
=== modified file 'include/decimal.h'
--- a/include/decimal.h 2007-05-24 10:24:36 +0000
+++ b/include/decimal.h 2011-08-29 09:24:36 +0000
@@ -21,6 +21,15 @@ typedef enum
decimal_round_mode;
typedef int32 decimal_digit_t;
+/**
+ intg is the number of *decimal* digits (NOT number of decimal_digit_t's !)
+ before the point
+ frac is the number of decimal digits after the point
+ len is the length of buf (length of allocated space) in decimal_digit_t's,
+ not in bytes
+ sign false means positive, true means negative
+ buf is an array of decimal_digit_t's
+ */
typedef struct st_decimal_t {
int intg, frac, len;
my_bool sign;
=== modified file 'mysql-test/r/type_newdecimal.result'
--- a/mysql-test/r/type_newdecimal.result 2010-11-11 09:46:49 +0000
+++ b/mysql-test/r/type_newdecimal.result 2011-08-29 09:24:36 +0000
@@ -1927,3 +1927,14 @@ f1
0.000000000000000000000000
DROP TABLE IF EXISTS t1;
End of 5.1 tests
+#
+# BUG#12911710 - VALGRIND FAILURE IN
+# ROW-DEBUG:PERFSCHEMA.SOCKET_SUMMARY_BY_INSTANCE_FUNC
+#
+CREATE TABLE t1(d1 DECIMAL(60,0) NOT NULL,
+d2 DECIMAL(60,0) NOT NULL);
+INSERT INTO t1 (d1, d2) VALUES(0.0, 0.0);
+SELECT d1 * d2 FROM t1;
+d1 * d2
+0
+DROP TABLE t1;
=== modified file 'mysql-test/t/type_newdecimal.test'
--- a/mysql-test/t/type_newdecimal.test 2010-11-11 09:46:49 +0000
+++ b/mysql-test/t/type_newdecimal.test 2011-08-29 09:24:36 +0000
@@ -1526,3 +1526,17 @@ DROP TABLE IF EXISTS t1;
--echo End of 5.1 tests
+
+--echo #
+--echo # BUG#12911710 - VALGRIND FAILURE IN
+--echo # ROW-DEBUG:PERFSCHEMA.SOCKET_SUMMARY_BY_INSTANCE_FUNC
+--echo #
+
+CREATE TABLE t1(d1 DECIMAL(60,0) NOT NULL,
+ d2 DECIMAL(60,0) NOT NULL);
+
+INSERT INTO t1 (d1, d2) VALUES(0.0, 0.0);
+SELECT d1 * d2 FROM t1;
+
+DROP TABLE t1;
+
=== modified file 'sql/my_decimal.h'
--- a/sql/my_decimal.h 2011-07-03 15:47:37 +0000
+++ b/sql/my_decimal.h 2011-08-29 09:24:36 +0000
@@ -101,12 +101,8 @@ public:
{
len= DECIMAL_BUFF_LENGTH;
buf= buffer;
-#if !defined (HAVE_purify) && !defined(DBUG_OFF)
- /* Set buffer to 'random' value to find wrong buffer usage */
- for (uint i= 0; i < DECIMAL_BUFF_LENGTH; i++)
- buffer[i]= i;
-#endif
}
+
my_decimal()
{
init();
=== modified file 'strings/decimal.c'
--- a/strings/decimal.c 2011-07-03 15:47:37 +0000
+++ b/strings/decimal.c 2011-08-29 09:24:36 +0000
@@ -1423,11 +1423,18 @@ int bin2decimal(const uchar *from, decim
buf++;
}
my_afree(d_copy);
+
+ /*
+ No digits? We have read the number zero, of unspecified precision.
+ Make it a proper zero, with non-zero precision.
+ */
+ if (to->intg == 0 && to->frac == 0)
+ decimal_make_zero(to);
return error;
err:
my_afree(d_copy);
- decimal_make_zero(((decimal_t*) to));
+ decimal_make_zero(to);
return(E_DEC_BAD_NUM);
}
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.1 branch (tor.didriksen:3593 to 3594) Bug#12911710 | Tor Didriksen | 29 Aug |