1source include/have_tokudb.inc;
2source include/have_innodb.inc;
3
4create table tt (id int primary key, x int) engine = tokudb;
5insert into tt values (1,0),(2,-pow(2,31)),(3,pow(2,31)-1);
6create table ti like tt;
7alter table ti engine=innodb;
8insert into ti select * from tt;
9
10set tokudb_enable_fast_update=1;
11source ../include/setup_fast_update_upsert.inc;
12
13update tt set x=x+1 where id=1;
14update ti set x=x+1 where id=1;
15let $diff_tables = test.tt, test.ti;
16source include/diff_tables.inc;
17
18update tt set x=x-2 where id=1;
19update ti set x=x-2 where id=1;
20let $diff_tables = test.tt, test.ti;
21source include/diff_tables.inc;
22
23update tt set x=x+1 where id=1;
24update ti set x=x+1 where id=1;
25let $diff_tables = test.tt, test.ti;
26source include/diff_tables.inc;
27
28update tt set x=x-1 where id=2;
29update ti set x=x-1 where id=2;
30let $diff_tables = test.tt, test.ti;
31source include/diff_tables.inc;
32
33update tt set x=x+1 where id=2;
34update ti set x=x+1 where id=2;
35let $diff_tables = test.tt, test.ti;
36source include/diff_tables.inc;
37
38update tt set x=x+1 where id=3;
39update ti set x=x+1 where id=3;
40let $diff_tables = test.tt, test.ti;
41source include/diff_tables.inc;
42
43update tt set x=x-1 where id=3;
44update ti set x=x-1 where id=3;
45let $diff_tables = test.tt, test.ti;
46source include/diff_tables.inc;
47
48# test clip at maximum
49insert into tt values (4,pow(2,31)-10);
50insert into ti values (4,pow(2,31)-10);
51update tt set x=x+20 where id=4;
52update ti set x=x+20 where id=4;
53let $diff_tables = test.tt, test.ti;
54source include/diff_tables.inc;
55
56insert into tt values (5,pow(2,31)-10);
57insert into ti values (5,pow(2,31)-10);
58update tt set x=x - -20 where id=5;
59update ti set x=x - -20 where id=5;
60let $diff_tables = test.tt, test.ti;
61source include/diff_tables.inc;
62
63# test clip at minimum
64insert into tt values (6,-pow(2,31)+10);
65insert into ti values (6,-pow(2,31)+10);
66update tt set x=x-20 where id=6;
67update ti set x=x-20 where id=6;
68let $diff_tables = test.tt, test.ti;
69source include/diff_tables.inc;
70
71insert into tt values (7,-pow(2,31)+10);
72insert into ti values (7,-pow(2,31)+10);
73update tt set x=x + -20 where id=7;
74update ti set x=x + -20 where id=7;
75let $diff_tables = test.tt, test.ti;
76source include/diff_tables.inc;
77
78
79drop table tt, ti;
80
81
82
83