Debian Codegraph @

mysql-test/suite/rpl/include/rpl_row_UUID.test

raw
1 #############################################################################
2 # Original Author: JBM #
3 # Original Date: Aug/18/2005 #
4 #############################################################################
5 # TEST: To test the UUID() in rbr #
6 #############################################################################
7
8 # Begin clean up test section
9 connection master;
10
11 --disable_warnings
12 DROP PROCEDURE IF EXISTS test.p1;
13 DROP TABLE IF EXISTS test.t1;
14 --enable_warnings
15
16 # Section 1 test
17
18 eval CREATE TABLE test.t1 (a INT, blob_column LONGBLOB, vchar_column VARCHAR(100), PRIMARY KEY(a)) engine=$engine_type;
19 INSERT INTO test.t1 VALUES(1,UUID(),UUID());
20 delimiter |;
21 create procedure test.p1()
22 begin
23 INSERT INTO test.t1 VALUES(2,UUID(),UUID());
24 INSERT INTO test.t1 VALUES(3,UUID(),UUID());
25 end|
26 delimiter ;|
27
28 CALL test.p1();
29
30 # Now the same thing with a function
31
32 delimiter |;
33 create function test.fn1(x int)
34 returns int
35 begin
36 insert into t1 values (4+x,UUID(),UUID());
37 insert into t1 values (5+x,UUID(),UUID());
38 return 0;
39 end|
40
41 delimiter ;|
42 # test both in SELECT and in INSERT
43 --disable_ps2_protocol
44 select fn1(0);
45 --enable_ps2_protocol
46 eval create table t2 (a int) engine=$engine_type;
47 insert into t2 values(fn1(2));
48
49 sync_slave_with_master;
50 SHOW CREATE TABLE test.t1;
51
52 # Dump the databases and so we can see if they match
53 # Another method would be to use SELECT INTO OUTFILE on master,
54 # then LOAD DATA INFILE in slave, and use a query to compare.
55 # This would have the advantage that it would not assume
56 # the system has a 'diff'
57 --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_master.sql
58 --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_slave.sql
59
60 connection master;
61 # Let's cleanup
62
63 DROP PROCEDURE test.p1;
64 DROP FUNCTION test.fn1;
65 DROP TABLE test.t1;
66 DROP TABLE test.t2;
67
68 # Let's compare. Note: If they match test will pass, if they do not match
69 # the test will show that the diff statement failed and not reject file
70 # will be created. You will need to go to the mysql-test dir and diff
71 # the files your self to see what is not matching :-)
72
73 diff_files $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_master.sql $MYSQLTEST_VARDIR/tmp/rpl_row_UUID_slave.sql;
74
75 # Cleanup dump files.
76 # Long-term "system rm" is not portable; we could live without
77 # this cleanup as no other test will use these files and they'll
78 # be removed at next testsuite run.
79