Commit a9b40a8c authored by bell@51.0.168.192.in-addr.arpa's avatar bell@51.0.168.192.in-addr.arpa

Merge 51.0.168.192.in-addr.arpa:/Users/bell/mysql/bk/mysql-5.0

into 51.0.168.192.in-addr.arpa:/Users/bell/mysql/bk/work-repl-5.0
parents a867465e f55e2002
......@@ -102,3 +102,10 @@ select * from t1 procedure analyse();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.v " \\ 1 19 0 0 3.7619 NULL ENUM('"','""','"c','\'\0\\"','\'','\'\'','\'b','a\0\0\0b','a\0','a""""b','a\'\'\'\'b','abc','abc\'def\\hij"klm\0opq','a\\\\\\\\b','b\'','c"','d\\','The\ZEnd','\\','\\d','\\\\') NOT NULL
drop table t1;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
select * from t1 procedure analyse();
Field_name Min_value Max_value Min_length Max_length Empties_or_zeros Nulls Avg_value_or_avg_length Std Optimal_fieldtype
test.t1.df 1.1 2.2 8 8 0 0 1.650000000 0.302500000 ENUM('1.1','2.2') NOT NULL
drop table t1;
......@@ -187,3 +187,19 @@ timediff(cast('2004-12-30 12:00:00' as time), '12:00:00')
select timediff(cast('1 12:00:00' as time), '12:00:00');
timediff(cast('1 12:00:00' as time), '12:00:00')
24:00:00
select cast('1.2' as decimal(3,2));
cast('1.2' as decimal(3,2))
1.20
select 1e18 * cast('1.2' as decimal(3,2));
1e18 * cast('1.2' as decimal(3,2))
1.2e+18
select cast(cast('1.2' as decimal(3,2)) as signed);
cast(cast('1.2' as decimal(3,2)) as signed)
1
set @v1=1e18;
select cast(@v1 as decimal(22, 2));
cast(@v1 as decimal(22, 2))
1000000000000000000.00
select cast(-1e18 as decimal(22,2));
cast(-1e18 as decimal(22,2))
-1000000000000000000.00
......@@ -769,3 +769,38 @@ show columns from t2;
Field Type Null Key Default Extra
f2 datetime NO 0000-00-00 00:00:00
drop table t2, t1;
create table t2 (ff double);
insert into t2 values (2.2);
select cast(sum(distinct ff) as decimal(5,2)) from t2;
cast(sum(distinct ff) as decimal(5,2))
2.20
select cast(sum(distinct ff) as signed) from t2;
cast(sum(distinct ff) as signed)
2
select cast(variance(ff) as decimal(10,3)) from t2;
cast(variance(ff) as decimal(10,3))
0.000
select cast(min(ff) as decimal(5,2)) from t2;
cast(min(ff) as decimal(5,2))
2.20
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
select cast(sum(distinct df) as signed) from t1;
cast(sum(distinct df) as signed)
3
select cast(min(df) as signed) from t1;
cast(min(df) as signed)
0
select 1e8 * sum(distinct df) from t1;
1e8 * sum(distinct df)
330000000
select 1e8 * min(df) from t1;
1e8 * min(df)
110000000
create table t3 (ifl int);
insert into t3 values(1), (2);
select cast(min(ifl) as decimal(5,2)) from t3;
cast(min(ifl) as decimal(5,2))
1.00
drop table t1, t2, t3;
......@@ -1798,3 +1798,5 @@ Variable_name Value
innodb_thread_sleep_delay 10000
create table t1 (v varchar(16384)) engine=innodb;
ERROR 42000: Column length too big for column 'v' (max = 255); use BLOB instead
create table t1 (a bit, key(a)) engine=innodb;
ERROR 42000: The storage engine for the table doesn't support BIT FIELD
......@@ -1150,3 +1150,15 @@ drop table t1;
set storage_engine=MyISAM;
create table t1 (v varchar(65535));
ERROR 42000: Row size too large. The maximum row size for the used table type, not counting BLOBs, is 65535. You have to change some columns to TEXT or BLOBs
create table t1 (a int) engine=myisam;
drop table if exists t1;
Warnings:
Error 2 Can't find file: 't1' (errno: 2)
create table t1 (a int) engine=myisam;
drop table t1;
Got one of the listed errors
create table t1 (a int) engine=myisam;
drop table t1;
Got one of the listed errors
drop table t1;
ERROR 42S02: Unknown table 't1'
......@@ -180,7 +180,7 @@ select * from t4;
ERROR 42S02: Table 'test.t4' doesn't exist
drop table if exists t4;
Warnings:
Note 1051 Unknown table 't4'
Error 155 Table 'test.t4' doesn't exist
drop table t5;
ERROR 42S02: Unknown table 't5'
drop table if exists t5;
......
......@@ -72,3 +72,11 @@ show status like "Qcache_hits";
Variable_name Value
Qcache_hits 0
drop table t1, t2;
set GLOBAL query_cache_size=0;
set GLOBAL ndb_cache_check_time=0;
reset query cache;
flush status;
set GLOBAL query_cache_size=0;
set GLOBAL ndb_cache_check_time=0;
reset query cache;
flush status;
......@@ -6,7 +6,9 @@ drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
create table t1 (a int) engine=myisam;
flush tables;
drop table t1;
drop table if exists t1;
Warnings:
Error 2 Can't find file: 't1' (errno: 2)
create table t1 (a int, unique(a)) engine=myisam;
set sql_log_bin=0;
insert into t1 values(2);
......
......@@ -92,3 +92,120 @@ count(*)
100
unlock tables;
drop table if exists t1,t2,t3,t4;
slave stop;
reset master;
create table t1 (n int) engine=innodb;
begin;
commit;
drop table t1;
show binlog events in 'master-bin.000001';
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 4 Format_desc 1 96 Server ver: VERSION, Binlog ver: 4
master-bin.000001 96 Query 1 197 use `test`; create table t1 (n int) engine=innodb
master-bin.000001 197 Query 1 266 use `test`; BEGIN
master-bin.000001 266 Query 1 94 use `test`; insert into t1 values(100 + 4)
master-bin.000001 360 Query 1 187 use `test`; insert into t1 values(99 + 4)
master-bin.000001 453 Query 1 280 use `test`; insert into t1 values(98 + 4)
master-bin.000001 546 Query 1 373 use `test`; insert into t1 values(97 + 4)
master-bin.000001 639 Query 1 466 use `test`; insert into t1 values(96 + 4)
master-bin.000001 732 Query 1 559 use `test`; insert into t1 values(95 + 4)
master-bin.000001 825 Query 1 652 use `test`; insert into t1 values(94 + 4)
master-bin.000001 918 Query 1 745 use `test`; insert into t1 values(93 + 4)
master-bin.000001 1011 Query 1 838 use `test`; insert into t1 values(92 + 4)
master-bin.000001 1104 Query 1 931 use `test`; insert into t1 values(91 + 4)
master-bin.000001 1197 Query 1 1024 use `test`; insert into t1 values(90 + 4)
master-bin.000001 1290 Query 1 1117 use `test`; insert into t1 values(89 + 4)
master-bin.000001 1383 Query 1 1210 use `test`; insert into t1 values(88 + 4)
master-bin.000001 1476 Query 1 1303 use `test`; insert into t1 values(87 + 4)
master-bin.000001 1569 Query 1 1396 use `test`; insert into t1 values(86 + 4)
master-bin.000001 1662 Query 1 1489 use `test`; insert into t1 values(85 + 4)
master-bin.000001 1755 Query 1 1582 use `test`; insert into t1 values(84 + 4)
master-bin.000001 1848 Query 1 1675 use `test`; insert into t1 values(83 + 4)
master-bin.000001 1941 Query 1 1768 use `test`; insert into t1 values(82 + 4)
master-bin.000001 2034 Query 1 1861 use `test`; insert into t1 values(81 + 4)
master-bin.000001 2127 Query 1 1954 use `test`; insert into t1 values(80 + 4)
master-bin.000001 2220 Query 1 2047 use `test`; insert into t1 values(79 + 4)
master-bin.000001 2313 Query 1 2140 use `test`; insert into t1 values(78 + 4)
master-bin.000001 2406 Query 1 2233 use `test`; insert into t1 values(77 + 4)
master-bin.000001 2499 Query 1 2326 use `test`; insert into t1 values(76 + 4)
master-bin.000001 2592 Query 1 2419 use `test`; insert into t1 values(75 + 4)
master-bin.000001 2685 Query 1 2512 use `test`; insert into t1 values(74 + 4)
master-bin.000001 2778 Query 1 2605 use `test`; insert into t1 values(73 + 4)
master-bin.000001 2871 Query 1 2698 use `test`; insert into t1 values(72 + 4)
master-bin.000001 2964 Query 1 2791 use `test`; insert into t1 values(71 + 4)
master-bin.000001 3057 Query 1 2884 use `test`; insert into t1 values(70 + 4)
master-bin.000001 3150 Query 1 2977 use `test`; insert into t1 values(69 + 4)
master-bin.000001 3243 Query 1 3070 use `test`; insert into t1 values(68 + 4)
master-bin.000001 3336 Query 1 3163 use `test`; insert into t1 values(67 + 4)
master-bin.000001 3429 Query 1 3256 use `test`; insert into t1 values(66 + 4)
master-bin.000001 3522 Query 1 3349 use `test`; insert into t1 values(65 + 4)
master-bin.000001 3615 Query 1 3442 use `test`; insert into t1 values(64 + 4)
master-bin.000001 3708 Query 1 3535 use `test`; insert into t1 values(63 + 4)
master-bin.000001 3801 Query 1 3628 use `test`; insert into t1 values(62 + 4)
master-bin.000001 3894 Query 1 3721 use `test`; insert into t1 values(61 + 4)
master-bin.000001 3987 Query 1 3814 use `test`; insert into t1 values(60 + 4)
master-bin.000001 4080 Query 1 3907 use `test`; insert into t1 values(59 + 4)
master-bin.000001 4173 Query 1 4000 use `test`; insert into t1 values(58 + 4)
master-bin.000001 4266 Query 1 4093 use `test`; insert into t1 values(57 + 4)
master-bin.000001 4359 Query 1 4186 use `test`; insert into t1 values(56 + 4)
master-bin.000001 4452 Query 1 4279 use `test`; insert into t1 values(55 + 4)
master-bin.000001 4545 Query 1 4372 use `test`; insert into t1 values(54 + 4)
master-bin.000001 4638 Query 1 4465 use `test`; insert into t1 values(53 + 4)
master-bin.000001 4731 Query 1 4558 use `test`; insert into t1 values(52 + 4)
master-bin.000001 4824 Query 1 4651 use `test`; insert into t1 values(51 + 4)
master-bin.000001 4917 Query 1 4744 use `test`; insert into t1 values(50 + 4)
master-bin.000001 5010 Query 1 4837 use `test`; insert into t1 values(49 + 4)
master-bin.000001 5103 Query 1 4930 use `test`; insert into t1 values(48 + 4)
master-bin.000001 5196 Query 1 5023 use `test`; insert into t1 values(47 + 4)
master-bin.000001 5289 Query 1 5116 use `test`; insert into t1 values(46 + 4)
master-bin.000001 5382 Query 1 5209 use `test`; insert into t1 values(45 + 4)
master-bin.000001 5475 Query 1 5302 use `test`; insert into t1 values(44 + 4)
master-bin.000001 5568 Query 1 5395 use `test`; insert into t1 values(43 + 4)
master-bin.000001 5661 Query 1 5488 use `test`; insert into t1 values(42 + 4)
master-bin.000001 5754 Query 1 5581 use `test`; insert into t1 values(41 + 4)
master-bin.000001 5847 Query 1 5674 use `test`; insert into t1 values(40 + 4)
master-bin.000001 5940 Query 1 5767 use `test`; insert into t1 values(39 + 4)
master-bin.000001 6033 Query 1 5860 use `test`; insert into t1 values(38 + 4)
master-bin.000001 6126 Query 1 5953 use `test`; insert into t1 values(37 + 4)
master-bin.000001 6219 Query 1 6046 use `test`; insert into t1 values(36 + 4)
master-bin.000001 6312 Query 1 6139 use `test`; insert into t1 values(35 + 4)
master-bin.000001 6405 Query 1 6232 use `test`; insert into t1 values(34 + 4)
master-bin.000001 6498 Query 1 6325 use `test`; insert into t1 values(33 + 4)
master-bin.000001 6591 Query 1 6418 use `test`; insert into t1 values(32 + 4)
master-bin.000001 6684 Query 1 6511 use `test`; insert into t1 values(31 + 4)
master-bin.000001 6777 Query 1 6604 use `test`; insert into t1 values(30 + 4)
master-bin.000001 6870 Query 1 6697 use `test`; insert into t1 values(29 + 4)
master-bin.000001 6963 Query 1 6790 use `test`; insert into t1 values(28 + 4)
master-bin.000001 7056 Query 1 6883 use `test`; insert into t1 values(27 + 4)
master-bin.000001 7149 Query 1 6976 use `test`; insert into t1 values(26 + 4)
master-bin.000001 7242 Query 1 7069 use `test`; insert into t1 values(25 + 4)
master-bin.000001 7335 Query 1 7162 use `test`; insert into t1 values(24 + 4)
master-bin.000001 7428 Query 1 7255 use `test`; insert into t1 values(23 + 4)
master-bin.000001 7521 Query 1 7348 use `test`; insert into t1 values(22 + 4)
master-bin.000001 7614 Query 1 7441 use `test`; insert into t1 values(21 + 4)
master-bin.000001 7707 Query 1 7534 use `test`; insert into t1 values(20 + 4)
master-bin.000001 7800 Query 1 7627 use `test`; insert into t1 values(19 + 4)
master-bin.000001 7893 Query 1 7720 use `test`; insert into t1 values(18 + 4)
master-bin.000001 7986 Query 1 7813 use `test`; insert into t1 values(17 + 4)
master-bin.000001 8079 Query 1 7906 use `test`; insert into t1 values(16 + 4)
master-bin.000001 8172 Query 1 7999 use `test`; insert into t1 values(15 + 4)
master-bin.000001 8265 Query 1 8092 use `test`; insert into t1 values(14 + 4)
master-bin.000001 8358 Query 1 8185 use `test`; insert into t1 values(13 + 4)
master-bin.000001 8451 Query 1 8278 use `test`; insert into t1 values(12 + 4)
master-bin.000001 8544 Query 1 8371 use `test`; insert into t1 values(11 + 4)
master-bin.000001 8637 Query 1 8464 use `test`; insert into t1 values(10 + 4)
master-bin.000001 8730 Query 1 8556 use `test`; insert into t1 values(9 + 4)
master-bin.000001 8822 Query 1 8648 use `test`; insert into t1 values(8 + 4)
master-bin.000001 8914 Query 1 8740 use `test`; insert into t1 values(7 + 4)
master-bin.000001 9006 Query 1 8832 use `test`; insert into t1 values(6 + 4)
master-bin.000001 9098 Query 1 8924 use `test`; insert into t1 values(5 + 4)
master-bin.000001 9190 Query 1 9016 use `test`; insert into t1 values(4 + 4)
master-bin.000001 9282 Query 1 9108 use `test`; insert into t1 values(3 + 4)
master-bin.000001 9374 Query 1 9200 use `test`; insert into t1 values(2 + 4)
master-bin.000001 9466 Query 1 9292 use `test`; insert into t1 values(1 + 4)
master-bin.000001 9558 Xid 1 9319 COMMIT /* xid=146 */
master-bin.000001 9585 Rotate 1 9629 master-bin.000002;pos=4
show binlog events in 'master-bin.000002';
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000002 4 Format_desc 1 96 Server ver: VERSION, Binlog ver: 4
master-bin.000002 96 Query 1 173 use `test`; drop table t1
......@@ -2276,3 +2276,39 @@ pass userid parentid parentgroup childid groupname grouptypeid crse categoryid c
1 5141 12 group2 12 group2 5 1 2 88 Oct04
1 5141 12 group2 12 group2 5 1 2 89 Oct04
drop table if exists t1, t2, t3, t4, t5;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
select * from t1 where df <= all (select avg(df) from t1 group by df);
df
1.1
select * from t1 where df >= all (select avg(df) from t1 group by df);
df
2.2
drop table t1;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
select 1.1 * exists(select * from t1);
1.1 * exists(select * from t1)
1.1
drop table t1;
CREATE TABLE t1 (
grp int(11) default NULL,
a decimal(10,2) default NULL);
insert into t1 values (1, 1), (2, 2), (2, 3), (3, 4), (3, 5), (3, 6), (NULL, NULL);
select * from t1;
grp a
1 1.00
2 2.00
2 3.00
3 4.00
3 5.00
3 6.00
NULL NULL
select min(a) from t1 group by grp;
min(a)
NULL
1.00
2.00
4.00
drop table t1;
......@@ -44,8 +44,6 @@ t1 CREATE TABLE `t1` (
`a` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a bit, key(a)) engine=innodb;
ERROR 42000: The storage engine for the table doesn't support BIT FIELD
create table t1 (a bit(64));
insert into t1 values
(b'1111111111111111111111111111111111111111111111111111111111111111'),
......
......@@ -47,3 +47,11 @@ create table t1 (v varchar(128));
insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd');
select * from t1 procedure analyse();
drop table t1;
#decimal-related test
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
select * from t1 procedure analyse();
drop table t1;
......@@ -118,3 +118,11 @@ select date_add(cast('2004-12-30 12:00:00' as date), interval 0 hour);
select timediff(cast('2004-12-30 12:00:00' as time), '12:00:00');
# Still we should not throw away "days" part of time value
select timediff(cast('1 12:00:00' as time), '12:00:00');
#decimal-related additions
select cast('1.2' as decimal(3,2));
select 1e18 * cast('1.2' as decimal(3,2));
select cast(cast('1.2' as decimal(3,2)) as signed);
set @v1=1e18;
select cast(@v1 as decimal(22, 2));
select cast(-1e18 as decimal(22,2));
......@@ -492,3 +492,25 @@ drop table t2;
create table t2 select f2 from (select now() f2 from t1) a;
show columns from t2;
drop table t2, t1;
# decimal-related tests
create table t2 (ff double);
insert into t2 values (2.2);
select cast(sum(distinct ff) as decimal(5,2)) from t2;
select cast(sum(distinct ff) as signed) from t2;
select cast(variance(ff) as decimal(10,3)) from t2;
select cast(min(ff) as decimal(5,2)) from t2;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
select cast(sum(distinct df) as signed) from t1;
select cast(min(df) as signed) from t1;
select 1e8 * sum(distinct df) from t1;
select 1e8 * min(df) from t1;
create table t3 (ifl int);
insert into t3 values(1), (2);
select cast(min(ifl) as decimal(5,2)) from t3;
drop table t1, t2, t3;
......@@ -1278,3 +1278,7 @@ show variables like "innodb_thread_sleep_delay";
# InnoDB specific varchar tests
--error 1074
create table t1 (v varchar(16384)) engine=innodb;
# The following should be moved to type_bit.test when innodb will support it
--error 1178
create table t1 (a bit, key(a)) engine=innodb;
......@@ -539,3 +539,20 @@ eval set storage_engine=$default;
# MyISAM specific varchar tests
--error 1118
create table t1 (v varchar(65535));
#
# Test how DROP TABLE works if the index or data file doesn't exists
create table t1 (a int) engine=myisam;
system rm ./var/master-data/test/t1.MYI ;
drop table if exists t1;
create table t1 (a int) engine=myisam;
system rm ./var/master-data/test/t1.MYI ;
--error 1051,6
drop table t1;
create table t1 (a int) engine=myisam;
system rm ./var/master-data/test/t1.MYD ;
--error 1105,6
drop table t1;
--error 1051
drop table t1;
......@@ -68,4 +68,14 @@ show status like "Qcache_hits";
drop table t1, t2;
# Turn off and reset query cache on server1 and server2
connection server1;
set GLOBAL query_cache_size=0;
set GLOBAL ndb_cache_check_time=0;
reset query cache;
flush status;
connection server2;
set GLOBAL query_cache_size=0;
set GLOBAL ndb_cache_check_time=0;
reset query cache;
flush status;
......@@ -9,7 +9,7 @@ source include/master-slave.inc;
create table t1 (a int) engine=myisam;
flush tables;
system rm ./var/master-data/test/t1.MYI ;
drop table t1;
drop table if exists t1;
save_master_pos;
connection slave;
sync_with_master;
......
......@@ -152,3 +152,31 @@ unlock tables;
connection master;
drop table if exists t1,t2,t3,t4;
sync_slave_with_master;
#
# now the same in a transaction
#
slave stop; # we don't need it anymore
connection master;
reset master;
let $1=100;
--disable_warnings
create table t1 (n int) engine=innodb;
--enable_warnings
begin;
--disable_query_log
while ($1)
{
eval insert into t1 values($1 + 4);
dec $1;
}
--enable_query_log
commit;
drop table t1;
let $VERSION=`select version()`;
--replace_result $VERSION VERSION
show binlog events in 'master-bin.000001';
--replace_result $VERSION VERSION
show binlog events in 'master-bin.000002';
......@@ -1543,3 +1543,26 @@ group by
drop table if exists t1, t2, t3, t4, t5;
#decimal-related tests
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
select * from t1 where df <= all (select avg(df) from t1 group by df);
select * from t1 where df >= all (select avg(df) from t1 group by df);
drop table t1;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
select 1.1 * exists(select * from t1);
drop table t1;
CREATE TABLE t1 (
grp int(11) default NULL,
a decimal(10,2) default NULL);
insert into t1 values (1, 1), (2, 2), (2, 3), (3, 4), (3, 5), (3, 6), (NULL, NULL);
select * from t1;
select min(a) from t1 group by grp;
drop table t1;
......@@ -26,9 +26,6 @@ create table t1 (a bit(0));
show create table t1;
drop table t1;
--error 1178
create table t1 (a bit, key(a)) engine=innodb;
create table t1 (a bit(64));
insert into t1 values
(b'1111111111111111111111111111111111111111111111111111111111111111'),
......
......@@ -2245,10 +2245,10 @@ void Dbdict::checkSchemaStatus(Signal* signal)
restartCreateTab(signal, tableId, oldEntry, false);
return;
}//if
}
ndbrequire(ok);
break;
}
}
case SchemaFile::DROP_TABLE_STARTED:
jam();
case SchemaFile::DROP_TABLE_COMMITTED:{
......
......@@ -32,7 +32,8 @@ testTransactions \
testDeadlock \
test_event ndbapi_slow_select testReadPerf testLcp \
testPartitioning \
testBitfield
testBitfield \
DbCreate DbAsyncGenerator
#flexTimedAsynch
#testBlobs
......@@ -73,6 +74,8 @@ testReadPerf_SOURCES = testReadPerf.cpp
testLcp_SOURCES = testLcp.cpp
testPartitioning_SOURCES = testPartitioning.cpp
testBitfield_SOURCES = testBitfield.cpp
DbCreate_SOURCES= bench/mainPopulate.cpp bench/dbPopulate.cpp bench/userInterface.cpp
DbAsyncGenerator_SOURCES= bench/mainAsyncGenerator.cpp bench/asyncGenerator.cpp bench/ndb_async2.cpp
INCLUDES_LOC = -I$(top_srcdir)/ndb/include/kernel
......
This diff is collapsed.
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef DBGENERATOR_H
#define DBGENERATOR_H
/***************************************************************
* I N C L U D E D F I L E S *
***************************************************************/
#include "testData.h"
#include "userInterface.h"
/***************************************************************
* M A C R O S *
***************************************************************/
/***************************************************************/
/* C O N S T A N T S */
/***************************************************************/
/***************************************************************
* D A T A S T R U C T U R E S *
***************************************************************/
/***************************************************************
* P U B L I C F U N C T I O N S *
***************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
extern void asyncGenerator(ThreadData *d, int parallellism,
int millisSendPoll,
int minEventSendPoll,
int forceSendPoll);
#ifdef __cplusplus
}
#endif
/***************************************************************
* E X T E R N A L D A T A *
***************************************************************/
#endif /* DBGENERATOR_H */
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/***************************************************************
* I N C L U D E D F I L E S *
***************************************************************/
#include <ndb_global.h>
#include "userInterface.h"
#include "dbPopulate.h"
#include <NdbOut.hpp>
#include <random.h>
/***************************************************************
* L O C A L C O N S T A N T S *
***************************************************************/
/***************************************************************
* L O C A L D A T A S T R U C T U R E S *
***************************************************************/
/***************************************************************
* L O C A L F U N C T I O N S *
***************************************************************/
static void getRandomSubscriberData(int subscriberNo,
SubscriberNumber number,
SubscriberName name);
static void populate(char *title,
int count,
void (*func)(UserHandle*,int),
UserHandle *uh);
static void populateServers(UserHandle *uh, int count);
static void populateSubscribers(UserHandle *uh, int count);
static void populateGroups(UserHandle *uh, int count);
/***************************************************************
* L O C A L D A T A *
***************************************************************/
static SequenceValues permissionsDefinition[] = {
{90, 1},
{10, 0},
{0, 0}
};
/***************************************************************
* P U B L I C D A T A *
***************************************************************/
/***************************************************************
****************************************************************
* L O C A L F U N C T I O N S C O D E S E C T I O N *
****************************************************************
***************************************************************/
static void getRandomSubscriberData(int subscriberNo,
SubscriberNumber number,
SubscriberName name)
{
char sbuf[SUBSCRIBER_NUMBER_LENGTH + 1];
sprintf(sbuf, "%.*d", SUBSCRIBER_NUMBER_LENGTH, subscriberNo);
memcpy(number, sbuf, SUBSCRIBER_NUMBER_LENGTH);
memset(name, myRandom48(26)+'A', SUBSCRIBER_NAME_LENGTH);
}
static void populate(char *title,
int count,
void (*func)(UserHandle*, int),
UserHandle *uh)
{
ndbout_c("Populating %d '%s' ... ",count, title);
/* fflush(stdout); */
func(uh,count);
ndbout_c("done");
}
static void populateServers(UserHandle *uh, int count)
{
int i, j;
int len;
char tmp[80];
int suffix_length = 1;
ServerName serverName;
SubscriberSuffix suffix;
int commitCount = 0;
for(i = 0; i < SUBSCRIBER_NUMBER_SUFFIX_LENGTH; i++)
suffix_length *= 10;
for(i = 0; i < count; i++) {
sprintf(tmp, "-Server %d-", i);
len = strlen(tmp);
for(j = 0; j < SERVER_NAME_LENGTH; j++){
serverName[j] = tmp[j % len];
}
/* serverName[j] = 0; not null-terminated */
for(j = 0; j < suffix_length; j++){
char sbuf[SUBSCRIBER_NUMBER_SUFFIX_LENGTH + 1];
sprintf(sbuf, "%.*d", SUBSCRIBER_NUMBER_SUFFIX_LENGTH, j);
memcpy(suffix, sbuf, SUBSCRIBER_NUMBER_SUFFIX_LENGTH);
userDbInsertServer(uh, i, suffix, serverName);
commitCount ++;
if((commitCount % OP_PER_TRANS) == 0)
userDbCommit(uh);
}
}
if((commitCount % OP_PER_TRANS) != 0)
userDbCommit(uh);
}
static void populateSubscribers(UserHandle *uh, int count)
{
SubscriberNumber number;
SubscriberName name;
int i, j, k;
int res;
SequenceValues values[NO_OF_GROUPS+1];
RandomSequence seq;
for(i = 0; i < NO_OF_GROUPS; i++) {
values[i].length = 1;
values[i].value = i;
}
values[i].length = 0;
values[i].value = 0;
if( initSequence(&seq, values) != 0 ) {
ndbout_c("could not set the sequence of random groups");
exit(0);
}
#define RETRIES 25
for(i = 0; i < count; i+= OP_PER_TRANS) {
for(j = 0; j<RETRIES; j++){
for(k = 0; k<OP_PER_TRANS && i+k < count; k++){
getRandomSubscriberData(i+k, number, name);
userDbInsertSubscriber(uh, number, getNextRandom(&seq), name);
}
res = userDbCommit(uh);
if(res == 0)
break;
if(res != 1){
ndbout_c("Terminating");
exit(0);
}
}
if(j == RETRIES){
ndbout_c("Terminating");
exit(0);
}
}
}
static void populateGroups(UserHandle *uh, int count)
{
int i;
int j;
int len;
RandomSequence seq;
Permission allow[NO_OF_GROUPS];
ServerBit serverBit;
GroupName groupName;
char tmp[80];
int commitCount = 0;
if( initSequence(&seq, permissionsDefinition) != 0 ) {
ndbout_c("could not set the sequence of random permissions");
exit(0);
}
for(i = 0; i < NO_OF_GROUPS; i++)
allow[i] = 0;
for(i = 0; i < NO_OF_SERVERS; i++) {
serverBit = 1 << i;
for(j = 0; j < NO_OF_GROUPS; j++ ) {
if( getNextRandom(&seq) )
allow[j] |= serverBit;
}
}
for(i = 0; i < NO_OF_GROUPS; i++) {
sprintf(tmp, "-Group %d-", i);
len = strlen(tmp);
for(j = 0; j < GROUP_NAME_LENGTH; j++) {
groupName[j] = tmp[j % len];
}
/* groupName[j] = 0; not null-terminated */
userDbInsertGroup(uh,
i,
groupName,
allow[i],
allow[i],
allow[i]);
commitCount ++;
if((commitCount % OP_PER_TRANS) == 0)
userDbCommit(uh);
}
if((commitCount % OP_PER_TRANS) != 0)
userDbCommit(uh);
}
/***************************************************************
****************************************************************
* P U B L I C F U N C T I O N S C O D E S E C T I O N *
****************************************************************
***************************************************************/
void dbPopulate(UserHandle *uh)
{
populate("servers", NO_OF_SERVERS, populateServers, uh);
populate("subscribers", NO_OF_SUBSCRIBERS, populateSubscribers, uh);
populate("groups", NO_OF_GROUPS, populateGroups, uh);
}
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef DBPOPULATE_H
#define DBPOPULATE_H
/***************************************************************
* I N C L U D E D F I L E S *
***************************************************************/
#include "userInterface.h"
/***************************************************************
* M A C R O S *
***************************************************************/
/***************************************************************/
/* C O N S T A N T S */
/***************************************************************/
/***************************************************************
* D A T A S T R U C T U R E S *
***************************************************************/
/***************************************************************
* P U B L I C F U N C T I O N S *
***************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
extern void dbPopulate(UserHandle *uh);
#ifdef __cplusplus
}
#endif
/***************************************************************
* E X T E R N A L D A T A *
***************************************************************/
#endif /* DBPOPULATE_H */
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef MACROS_H
#define MACROS_H
#include <ndb_global.h>
#include <NdbOut.hpp>
#define ERROR(x) {ndbout_c((x));}
#define ERROR1(x,y) {ndbout_c((x), (y));}
#define ERROR2(x,y,z) {ndbout_c((x), (y), (z));}
#define ERROR3(x,y,z,u) {ndbout_c((x), (y), (z), (u));}
#define ERROR4(x,y,z,u,w) {ndbout_c((x), (y), (z), (u), (w));}
#define INIT_RANDOM(x) srand48((x))
#define UI_RANDOM(x) ((unsigned int)(lrand48()%(x)))
#define ASSERT(cond, message) \
{ if(!(cond)) { ERROR(message); exit(-1); }}
#ifdef DEBUG_ON
#define DEBUG(x) {ndbout_c((x));}
#define DEBUG1(x,y) {ndbout_c((x), (y));}
#define DEBUG2(x,y,z) {ndbout_c((x), (y), (z));}
#define DEBUG3(x,y,z,u) {ndbout_c((x), (y), (z), (u));}
#define DEBUG4(x,y,z,u,w) {ndbout_c((x), (y), (z), (u), (w));}
#define DEBUG5(x,y,z,u,w, v) {ndbout_c((x), (y), (z), (u), (w), (v));}
#else
#define DEBUG(x)
#define DEBUG1(x,y)
#define DEBUG2(x,y,z)
#define DEBUG3(x,y,z,u)
#define DEBUG4(x,y,z,u,w)
#define DEBUG5(x,y,z,u,w, v)
#endif
#endif
This diff is collapsed.
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
#include <ndb_opts.h>
#include "userInterface.h"
#include "dbPopulate.h"
#include <NdbMain.h>
#include <NdbOut.hpp>
#include <random.h>
#include <NDBT.hpp>
#ifdef __cplusplus
extern "C" {
#endif
int useTableLogging;
#ifdef __cplusplus
}
#endif
static void usage()
{
}
static
void usage(const char *prog)
{
ndbout_c(
"Usage: %s [-l]\n"
" -l Use logging and checkpointing on tables\n",
prog);
exit(1);
}
NDB_STD_OPTS_VARS;
NDB_COMMAND(DbCreate, "DbCreate", "DbCreate", "DbCreate", 16384)
{
ndb_init();
int i;
UserHandle *uh;
useTableLogging = 0;
for(i = 1; i<argc; i++){
if(strcmp(argv[i], "-l") == 0){
useTableLogging = 1;
} else {
usage(argv[0]);
return 0;
}
}
ndbout_c("Using %s tables",
useTableLogging ? "logging" : "temporary");
myRandom48Init(0x3e6f);
uh = userDbConnect(1, "TEST_DB");
dbPopulate(uh);
userDbDisconnect(uh);
return NDBT_ProgramExit(NDBT_OK);
}
This diff is collapsed.
This diff is collapsed.
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef NDB_ERROR_H
#define NDB_ERROR_H
#include <ndb_global.h>
#include <NdbOut.hpp>
#include "userInterface.h"
#include <NdbError.hpp>
#include <NdbApi.hpp>
#define error_handler(x,y, z) { \
ndbout << x << " " << y << endl; \
exit(-1); }
#define CHECK_MINUS_ONE(x, y, z) if(x == -1) \
error_handler(y,(z->getNdbError()), 0)
inline
void
CHECK_ALLOWED_ERROR(const char * str,
const ThreadData * td,
const struct NdbError & error){
char buf[100];
snprintf(buf, sizeof(buf), "subscriber = %.*s ",
SUBSCRIBER_NUMBER_LENGTH,
td->transactionData.number);
ndbout << str << " " << error << endl
<< buf;
showTime();
switch(error.classification) {
case NdbError::TimeoutExpired:
case NdbError::OverloadError:
case NdbError::TemporaryResourceError:
case NdbError::NodeRecoveryError:
break;
default:
if(error.status != NdbError::TemporaryError)
exit(-1);
}
}
inline
void
CHECK_NULL(void * null,
const char * str,
const ThreadData * td,
const struct NdbError & err){
if(null == 0){
CHECK_ALLOWED_ERROR(str, td, err);
exit(-1);
}
}
inline
void
CHECK_NULL(void * null, const char* msg, NdbConnection* obj)
{
if(null == 0)
{
error_handler(msg, obj->getNdbError(), 0);
}
}
#endif
/* Copyright (C) 2003 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef NDB_SCHEMA_H
#define NDB_SCHEMA_H
#include "testDefinitions.h"
#define SUBSCRIBER_TABLE "SUBSCRIBER"
#define SUBSCRIBER_NUMBER "NUMBER"
#define SUBSCRIBER_LOCATION "LOCATION"
#define SUBSCRIBER_NAME "NAME"
#define SUBSCRIBER_GROUP "GROUP_ID"
#define SUBSCRIBER_SESSIONS "SESSIONS"
#define SUBSCRIBER_CHANGED_BY "CHANGED_BY"
#define SUBSCRIBER_CHANGED_TIME "CHANGED_TIME"
#define SERVER_TABLE "SERVER"
#define SERVER_ID "SERVER_ID"
#define SERVER_SUBSCRIBER_SUFFIX "SUFFIX"
#define SERVER_NAME "NAME"
#define SERVER_READS "NO_OF_READ"
#define SERVER_INSERTS "NO_OF_INSERT"
#define SERVER_DELETES "NO_OF_DELETE"
#define GROUP_TABLE "GROUP"
#define GROUP_ID "GROUP_ID"
#define GROUP_NAME "GROUP_NAME"
#define GROUP_ALLOW_READ "ALLOW_READ"
#define GROUP_ALLOW_INSERT "ALLOW_INSERT"
#define GROUP_ALLOW_DELETE "ALLOW_DELETE"
#define SESSION_TABLE "SESSION"
#define SESSION_SERVER "SERVER_ID"
#define SESSION_SUBSCRIBER "NUMBER"
#define SESSION_DATA "DATA"
/** Numbers */
#define IND_SUBSCRIBER_NUMBER (unsigned)0
#define IND_SUBSCRIBER_NAME (unsigned)1
#define IND_SUBSCRIBER_GROUP (unsigned)2
#define IND_SUBSCRIBER_LOCATION (unsigned)3
#define IND_SUBSCRIBER_SESSIONS (unsigned)4
#define IND_SUBSCRIBER_CHANGED_BY (unsigned)5
#define IND_SUBSCRIBER_CHANGED_TIME (unsigned)6
#define IND_SERVER_SUBSCRIBER_SUFFIX (unsigned)0
#define IND_SERVER_ID (unsigned)1
#define IND_SERVER_NAME (unsigned)2
#define IND_SERVER_READS (unsigned)3
#define IND_SERVER_INSERTS (unsigned)4
#define IND_SERVER_DELETES (unsigned)5
#define IND_GROUP_ID (unsigned)0
#define IND_GROUP_NAME (unsigned)1
#define IND_GROUP_ALLOW_READ (unsigned)2
#define IND_GROUP_ALLOW_INSERT (unsigned)3
#define IND_GROUP_ALLOW_DELETE (unsigned)4
#define IND_SESSION_SUBSCRIBER (unsigned)0
#define IND_SESSION_SERVER (unsigned)1
#define IND_SESSION_DATA (unsigned)2
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
max-time: 25000
max-time: 3600
cmd: atrt-mysql-test-run
args: --force
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment