From: Alexander Barkov Date: April 20 2012 11:06am Subject: bzr push into mysql-trunk branch (alexander.barkov:3705 to 3706) Bug#13976233 List-Archive: http://lists.mysql.com/commits/143593 X-Bug: 13976233 Message-Id: <201204201111.q3KBBlkE002300@acsmt358.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 3706 Alexander Barkov 2012-04-20 Bug#13976233 ASSERTION FAILED: !CHECK_TIME_MMSSFF_RANGE(LTIME), FILE SQL_TIME.CC, LINE 304 Problem: double2lldiv_t() could errorneously return 1,000,000,000 value in "lld->rem" due to limited presicion of "double" arithmetics. Fix: Catch this corner case and put the reminder back into the expecter 0..999,999,999 range. modified: mysql-test/r/type_temporal_fractional.result mysql-test/t/type_temporal_fractional.test strings/decimal.c 3705 Hemant Kumar 2012-04-20 Added "rpl_binlog_n_mix_MTS" to mysql-trunk per push run. modified: mysql-test/collections/default.push === modified file 'mysql-test/r/type_temporal_fractional.result' --- a/mysql-test/r/type_temporal_fractional.result 2012-02-23 16:32:32 +0000 +++ b/mysql-test/r/type_temporal_fractional.result 2012-04-20 11:05:43 +0000 @@ -17256,4 +17256,16 @@ SELECT GREATEST(a,10), LEAST(a,10) FROM GREATEST(a,10) LEAST(a,10) 20010101010101.123456 10.000000 DROP TABLE t1; +# +# Bug#13976233 ASSERTION FAILED: !CHECK_TIME_MMSSFF_RANGE(LTIME), FILE SQL_TIME.CC, LINE 304 +# +SELECT SECOND(4.99999999991e0); +SECOND(4.99999999991e0) +5 +SELECT SECOND(-4.99999999991e0); +SECOND(-4.99999999991e0) +5 +SELECT SECOND(TRUNCATE('5',180)); +SECOND(TRUNCATE('5',180)) +5 # End of 5.6 tests === modified file 'mysql-test/t/type_temporal_fractional.test' --- a/mysql-test/t/type_temporal_fractional.test 2012-02-17 13:55:18 +0000 +++ b/mysql-test/t/type_temporal_fractional.test 2012-04-20 11:05:43 +0000 @@ -7665,4 +7665,12 @@ INSERT INTO t1 VALUES ('2001-01-01 01:01 SELECT GREATEST(a,10), LEAST(a,10) FROM t1; DROP TABLE t1; +--echo # +--echo # Bug#13976233 ASSERTION FAILED: !CHECK_TIME_MMSSFF_RANGE(LTIME), FILE SQL_TIME.CC, LINE 304 +--echo # +SELECT SECOND(4.99999999991e0); +SELECT SECOND(-4.99999999991e0); +SELECT SECOND(TRUNCATE('5',180)); + + --echo # End of 5.6 tests === modified file 'strings/decimal.c' --- a/strings/decimal.c 2012-03-06 14:29:42 +0000 +++ b/strings/decimal.c 2012-04-20 11:05:43 +0000 @@ -1167,6 +1167,17 @@ int double2lldiv_t(double nr, lldiv_t *l lld->quot= (longlong) (nr > 0 ? floor(nr) : ceil(nr)); /* Multiply reminder to 10^9 and store into "rem" */ lld->rem= (longlong) rint((nr - (double) lld->quot) * 1000000000); + /* + Sometimes the expression "(double) 0.999999999xxx * (double) 10e9" + gives 1,000,000,000 instead of 999,999,999 due to lack of double precision. + The callers do not expect lld->rem to be greater than 999,999,999. + Let's catch this corner case and put the "nanounit" (e.g. nanosecond) + value in ldd->rem back into the valid range. + */ + if (lld->rem > 999999999LL) + lld->rem= 999999999LL; + else if (lld->rem < -999999999LL) + lld->rem= -999999999LL; return E_DEC_OK; } No bundle (reason: useless for push emails).