From 4b1da38b13592083503b4edbc06a3c64c6473efe Mon Sep 17 00:00:00 2001 From: "tsmith@sita.local" <> Date: Mon, 9 Jul 2007 13:18:27 -0600 Subject: [PATCH] rpl_misc_functions.result, rpl_misc_functions.test: Backport from 5.1 a fix to make this test deterministic --- mysql-test/r/rpl_misc_functions.result | 19 ++++++++++--------- mysql-test/t/rpl_misc_functions.test | 23 ++++++++++++----------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/mysql-test/r/rpl_misc_functions.result b/mysql-test/r/rpl_misc_functions.result index ca7403316b1..a8e5520ca8f 100644 --- a/mysql-test/r/rpl_misc_functions.result +++ b/mysql-test/r/rpl_misc_functions.result @@ -20,11 +20,12 @@ select * from t1, t2 where (t1.id=t2.id) and not(t1.i=t2.i and t1.r1=t2.r1 and t id i r1 r2 p id i r1 r2 p drop table t1; DROP TABLE IF EXISTS t1; -CREATE TABLE t1 (col_a double default NULL); +CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, +col_a DOUBLE DEFAULT NULL); CREATE PROCEDURE test_replication_sp1() BEGIN -INSERT INTO t1 VALUES (rand()), (rand()); -INSERT INTO t1 VALUES (rand()); +INSERT INTO t1 (col_a) VALUES (rand()), (rand()); +INSERT INTO t1 (col_a) VALUES (rand()); END| CREATE PROCEDURE test_replication_sp2() BEGIN @@ -37,18 +38,18 @@ RETURN (rand() + rand()); END| CALL test_replication_sp1(); CALL test_replication_sp2(); -INSERT INTO t1 VALUES (test_replication_sf()); -INSERT INTO t1 VALUES (test_replication_sf()); -INSERT INTO t1 VALUES (test_replication_sf()); +INSERT INTO t1 (col_a) VALUES (test_replication_sf()); +INSERT INTO t1 (col_a) VALUES (test_replication_sf()); +INSERT INTO t1 (col_a) VALUES (test_replication_sf()); select * from t1 into outfile "../tmp/t1_slave.txt"; create temporary table t1_slave select * from t1 where 1=0; load data infile '../tmp/t1_slave.txt' into table t1_slave; -select count(*) into @aux from t1, t1_slave -where ABS(t1.col_a - t1_slave.col_a) < 0.0001 ; +select count(*) into @aux from t1 join t1_slave using (id) +where ABS(t1.col_a - t1_slave.col_a) < 0.0000001 ; SELECT @aux; @aux 12 +DROP TABLE t1, t1_slave; DROP PROCEDURE test_replication_sp1; DROP PROCEDURE test_replication_sp2; DROP FUNCTION test_replication_sf; -DROP TABLE t1, t1_slave; diff --git a/mysql-test/t/rpl_misc_functions.test b/mysql-test/t/rpl_misc_functions.test index b87fff919b2..1c94471c975 100644 --- a/mysql-test/t/rpl_misc_functions.test +++ b/mysql-test/t/rpl_misc_functions.test @@ -43,15 +43,16 @@ drop table t1; DROP TABLE IF EXISTS t1; --enable_warnings -CREATE TABLE t1 (col_a double default NULL); +CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, + col_a DOUBLE DEFAULT NULL); DELIMITER |; # Use a SP that calls rand() multiple times CREATE PROCEDURE test_replication_sp1() BEGIN - INSERT INTO t1 VALUES (rand()), (rand()); - INSERT INTO t1 VALUES (rand()); + INSERT INTO t1 (col_a) VALUES (rand()), (rand()); + INSERT INTO t1 (col_a) VALUES (rand()); END| # Use a SP that calls another SP to call rand() multiple times @@ -73,9 +74,9 @@ DELIMITER ;| # the master to those on the slave. CALL test_replication_sp1(); CALL test_replication_sp2(); -INSERT INTO t1 VALUES (test_replication_sf()); -INSERT INTO t1 VALUES (test_replication_sf()); -INSERT INTO t1 VALUES (test_replication_sf()); +INSERT INTO t1 (col_a) VALUES (test_replication_sf()); +INSERT INTO t1 (col_a) VALUES (test_replication_sf()); +INSERT INTO t1 (col_a) VALUES (test_replication_sf()); --sync_slave_with_master @@ -90,24 +91,24 @@ load data infile '../tmp/t1_slave.txt' into table t1_slave; # Compare master and slave temp table, use subtraction # for floating point comparison of "double" -select count(*) into @aux from t1, t1_slave -where ABS(t1.col_a - t1_slave.col_a) < 0.0001 ; +select count(*) into @aux from t1 join t1_slave using (id) +where ABS(t1.col_a - t1_slave.col_a) < 0.0000001 ; SELECT @aux; if (`SELECT @aux <> 12 OR @aux IS NULL`) { --echo # ERROR: We expected to get count(*) = 12. - SELECT col_a FROM t1; - SELECT col_a FROM t1_slave; + SELECT id, col_a FROM t1; + SELECT id, col_a FROM t1_slave; --echo # abort exit; } # Cleanup connection master; +DROP TABLE t1, t1_slave; DROP PROCEDURE test_replication_sp1; DROP PROCEDURE test_replication_sp2; DROP FUNCTION test_replication_sf; -DROP TABLE t1, t1_slave; --sync_slave_with_master