Commit 34d901c0 authored by Sergey Petrunya's avatar Sergey Petrunya

Merge

parents 005c24e9 d841ea23
......@@ -71,12 +71,16 @@ EXTRA_DIST = FINISH.sh \
compile-ppc-max \
compile-solaris-amd64 \
compile-solaris-amd64-debug \
compile-solaris-amd64-debug-forte \
compile-solaris-amd64-forte \
compile-solaris-amd64-forte-debug \
compile-solaris-sparc \
compile-solaris-sparc-debug \
compile-solaris-sparc-forte \
compile-solaris-sparc-purify
compile-solaris-sparc-purify \
compile-solaris-x86-32 \
compile-solaris-x86-32-debug \
compile-solaris-x86-32-debug-forte \
compile-solaris-x86-forte-32
# Don't update the files from bitkeeper
%::SCCS/s.%
......@@ -94,7 +94,7 @@ SET(CLIENT_SOURCES ../mysys/array.c ../strings/bchange.c ../strings/bmove.c
../mysys/safemalloc.c ../mysys/sha1.c ../strings/str2int.c
../strings/str_alloc.c ../strings/strcend.c ../strings/strcont.c ../strings/strend.c
../strings/strfill.c ../mysys/string.c ../strings/strinstr.c ../strings/strmake.c
../strings/strmov.c ../strings/strnlen.c ../strings/strnmov.c ../strings/strtod.c
../strings/strmov.c ../strings/strmov_overlapp.c ../strings/strnlen.c ../strings/strnmov.c ../strings/strtod.c
../strings/strtoll.c ../strings/strtoull.c ../strings/strxmov.c ../strings/strxnmov.c
../mysys/thr_mutex.c ../mysys/typelib.c ../vio/vio.c ../vio/viosocket.c
../vio/viossl.c ../vio/viosslfactories.c ../strings/xml.c ../mysys/mf_qsort.c
......
This diff is collapsed.
......@@ -56,5 +56,5 @@ Table Op Msg_type Msg_text
test.t1 analyze status OK
show index from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 1 a 1 a A NULL NULL NULL YES BTREE
t1 1 a 1 a A 5 NULL NULL YES BTREE
drop table t1;
......@@ -229,7 +229,8 @@ a b
204 7
delete from t1 where a=0;
update t1 set a=NULL where b=6;
ERROR 23000: Column 'a' cannot be null
Warnings:
Warning 1048 Column 'a' cannot be null
update t1 set a=300 where b=7;
SET SQL_MODE='';
insert into t1(a,b)values(NULL,8);
......@@ -244,7 +245,7 @@ a b
1 1
200 2
201 4
203 6
0 6
300 7
301 8
400 9
......@@ -260,7 +261,6 @@ a b
1 1
200 2
201 4
203 6
300 7
301 8
400 9
......@@ -271,20 +271,20 @@ a b
405 14
delete from t1 where a=0;
update t1 set a=NULL where b=13;
ERROR 23000: Column 'a' cannot be null
Warnings:
Warning 1048 Column 'a' cannot be null
update t1 set a=500 where b=14;
select * from t1 order by b;
a b
1 1
200 2
201 4
203 6
300 7
301 8
400 9
401 10
402 11
404 13
0 13
500 14
drop table t1;
create table t1 (a bigint);
......
......@@ -125,18 +125,19 @@ a b
0 11
2 12
delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
Warnings:
Error 1242 Subquery returns more than 1 row
Error 1242 Subquery returns more than 1 row
ERROR 21000: Subquery returns more than 1 row
select * from t11;
a b
0 10
1 11
2 12
select * from t12;
a b
33 10
0 11
2 12
insert into t11 values (2, 12);
ERROR 23000: Duplicate entry '2' for key 'PRIMARY'
delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
ERROR 21000: Subquery returns more than 1 row
select * from t11;
......@@ -145,13 +146,12 @@ a b
1 11
2 12
delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
Warnings:
Error 1242 Subquery returns more than 1 row
Error 1242 Subquery returns more than 1 row
ERROR 21000: Subquery returns more than 1 row
select * from t11;
a b
0 10
1 11
2 12
drop table t11, t12, t2;
create table t1 (a int, b int, unique key (a), key (b));
insert into t1 values (3, 3), (7, 7);
......
......@@ -174,8 +174,8 @@ INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2');
explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 4 Using temporary
1 SIMPLE t3 ref a a 5 test.t1.b 2 Using where; Using index
1 SIMPLE t2 index a a 4 NULL 5 Using where; Using index; Distinct; Using join buffer
1 SIMPLE t2 ref a a 4 test.t1.a 1 Using index
1 SIMPLE t3 ref a a 5 test.t1.b 1 Using where; Using index
SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a;
a
1
......@@ -190,7 +190,7 @@ insert into t3 select * from t4;
explain select distinct t1.a from t1,t3 where t1.a=t3.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 4 Using index; Using temporary
1 SIMPLE t3 ref a a 5 test.t1.a 11 Using where; Using index; Distinct
1 SIMPLE t3 ref a a 5 test.t1.a 1 Using where; Using index; Distinct
select distinct t1.a from t1,t3 where t1.a=t3.a;
a
1
......@@ -212,7 +212,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 Using index
explain SELECT distinct a from t3 order by a desc limit 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 index NULL a 5 NULL 40 Using index
1 SIMPLE t3 index NULL a 5 NULL 2 Using index
explain SELECT distinct a,b from t3 order by a+1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 204 Using temporary; Using filesort
......
......@@ -61,7 +61,7 @@ grp sum
NULL NULL
1 7
2 20.25
3 45.483163247594
3 45.4831632475944
create table t2 (grp int, a bigint unsigned, c char(10));
insert into t2 select grp,max(a)+max(grp),max(c) from t1 group by grp;
replace into t2 select grp, a, c from t1 limit 2,1;
......@@ -613,8 +613,8 @@ id select_type table type possible_keys key key_len ref rows Extra
explain
select max(t1.a3), min(t2.a2) from t1, t2 where t1.a2 = 2 and t1.a3 < 'MIN' and t2.a3 > 'CA';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range k1 k1 3 NULL 1 Using where; Using index
1 SIMPLE t1 range k1 k1 7 NULL 1 Using where; Using index; Using join buffer
1 SIMPLE t1 range k1 k1 7 NULL 1 Using where; Using index
1 SIMPLE t2 range k1 k1 3 NULL 1 Using where; Using index; Using join buffer
explain
select min(a4 - 0.01) from t1;
id select_type table type possible_keys key key_len ref rows Extra
......@@ -1186,7 +1186,7 @@ std(s1/s2)
0.21325764
select std(o1/o2) from bug22555;
std(o1/o2)
0.21325763586649
0.213257635866493
select std(e1/e2) from bug22555;
std(e1/e2)
0.21325764
......@@ -1212,7 +1212,7 @@ round(std(s1/s2), 17)
0.21325763586649341
select std(o1/o2) from bug22555;
std(o1/o2)
0.21325763586649
0.213257635866493
select round(std(e1/e2), 17) from bug22555;
round(std(e1/e2), 17)
0.21325763586649341
......@@ -1237,7 +1237,7 @@ round(std(s1/s2), 17)
0.21325763586649341
select std(o1/o2) from bug22555;
std(o1/o2)
0.21325763586649
0.213257635866493
select round(std(e1/e2), 17) from bug22555;
round(std(e1/e2), 17)
0.21325763586649341
......
......@@ -60,7 +60,7 @@ Warnings:
Note 1003 select ln(exp(10)) AS `ln(exp(10))`,exp((ln(sqrt(10)) * 2)) AS `exp(ln(sqrt(10))*2)`,ln(-(1)) AS `ln(-1)`,ln(0) AS `ln(0)`,ln(NULL) AS `ln(NULL)`
select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
log2(8) log2(15) log2(-2) log2(0) log2(NULL)
3 3.9068905956085 NULL NULL NULL
3 3.90689059560852 NULL NULL NULL
explain extended select log2(8),log2(15),log2(-2),log2(0),log2(NULL);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
......@@ -68,7 +68,7 @@ Warnings:
Note 1003 select log2(8) AS `log2(8)`,log2(15) AS `log2(15)`,log2(-(2)) AS `log2(-2)`,log2(0) AS `log2(0)`,log2(NULL) AS `log2(NULL)`
select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
log10(100) log10(18) log10(-4) log10(0) log10(NULL)
2 1.2552725051033 NULL NULL NULL
2 1.25527250510331 NULL NULL NULL
explain extended select log10(100),log10(18),log10(-4),log10(0),log10(NULL);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
......@@ -85,7 +85,7 @@ Note 1003 select pow(10,log10(10)) AS `pow(10,log10(10))`,pow(2,4) AS `power(2,4
set @@rand_seed1=10000000,@@rand_seed2=1000000;
select rand(999999),rand();
rand(999999) rand()
0.014231365187309 0.028870999839968
0.0142313651873091 0.028870999839968
explain extended select rand(999999),rand();
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used
......@@ -101,7 +101,7 @@ Warnings:
Note 1003 select pi() AS `pi()`,format(sin((pi() / 2)),6) AS `format(sin(pi()/2),6)`,format(cos((pi() / 2)),6) AS `format(cos(pi()/2),6)`,format(abs(tan(pi())),6) AS `format(abs(tan(pi())),6)`,format((1 / tan(1)),6) AS `format(cot(1),6)`,format(asin(1),6) AS `format(asin(1),6)`,format(acos(0),6) AS `format(acos(0),6)`,format(atan(1),6) AS `format(atan(1),6)`
select degrees(pi()),radians(360);
degrees(pi()) radians(360)
180 6.2831853071796
180 6.28318530717959
select format(atan(-2, 2), 6);
format(atan(-2, 2), 6)
-0.785398
......
......@@ -1327,10 +1327,10 @@ cast(rtrim(ltrim(' 20.06 ')) as decimal(19,2))
20.06
select conv("18383815659218730760",10,10) + 0;
conv("18383815659218730760",10,10) + 0
1.8383815659219e+19
1.83838156592187e+19
select "18383815659218730760" + 0;
"18383815659218730760" + 0
1.8383815659219e+19
1.83838156592187e+19
CREATE TABLE t1 (code varchar(10));
INSERT INTO t1 VALUES ('a12'), ('A12'), ('a13');
SELECT ASCII(code), code FROM t1 WHERE code='A12';
......
......@@ -457,7 +457,7 @@ Privilege Context Comment
Alter Tables To alter the table
Alter routine Functions,Procedures To alter or drop stored functions/procedures
Create Databases,Tables,Indexes To create new databases and tables
Create routine Functions,Procedures To use CREATE FUNCTION/PROCEDURE
Create routine Databases To use CREATE FUNCTION/PROCEDURE
Create temporary tables Databases To use CREATE TEMPORARY TABLE
Create view Tables To create new views
Create user Server Admin To create new users
......
......@@ -774,7 +774,7 @@ insert into t3 select * from t2 where a < 800;
explain select * from t2,t3 where t2.a < 200 and t2.b=t3.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range a,b a 5 NULL 1 Using where
1 SIMPLE t3 ref b b 5 test.t2.b 11 Using where
1 SIMPLE t3 ref b b 5 test.t2.b 1 Using where
drop table t1, t2, t3;
create table t1 (a int);
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
......
This diff is collapsed.
......@@ -153,7 +153,7 @@ t1 0 PRIMARY 1 d A 0 NULL NULL BTREE
t1 0 a 1 a A 0 NULL NULL BTREE
t1 0 e 1 e A 0 NULL NULL BTREE
t1 0 b 1 b A 0 NULL NULL YES BTREE
t1 1 c 1 c A NULL NULL NULL YES BTREE
t1 1 c 1 c A 0 NULL NULL YES BTREE
drop table t1;
CREATE TABLE t1 (c CHAR(10) NOT NULL,i INT NOT NULL AUTO_INCREMENT,
UNIQUE (c,i));
......
......@@ -122,7 +122,7 @@ i
explain select count(*) from t1, t2 where t1.p = t2.i;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2 Using index
1 SIMPLE t2 ref k1 k1 5 test.t1.p 2 Using where; Using index
1 SIMPLE t2 ref k1 k1 5 test.t1.p 1 Using where; Using index
select count(*) from t1, t2 where t1.p = t2.i;
count(*)
3
......@@ -257,8 +257,6 @@ test.t2 assign_to_keycache note The storage engine for the table doesn't support
drop table t1,t2,t3;
set global keycache2.key_buffer_size=0;
set global keycache3.key_buffer_size=100;
Warnings:
Warning 1292 Truncated incorrect key_buffer_size value: '100'
set global keycache3.key_buffer_size=0;
create table t1 (mytext text, FULLTEXT (mytext)) engine=myisam;
insert t1 values ('aaabbb');
......
......@@ -36,7 +36,7 @@ a a a a
explain select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL a NULL NULL NULL 5
1 SIMPLE t2 ALL b NULL NULL NULL 5 Using where; Using join buffer
1 SIMPLE t2 ref b b 4 test.t1.a 1 Using where
select t1.*,t2.* from t1,t1 as t2 where t1.A=t2.B order by binary t1.a,t2.a;
a b a b
A B a a
......
......@@ -119,7 +119,7 @@ create table t1Aa (col1 int);
create view v1Aa as select col1 from t1Aa as AaA;
show create view v1AA;
View Create View character_set_client collation_connection
v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `AaA`.`col1` AS `col1` from `t1aa` `AaA` latin1 latin1_swedish_ci
v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `aaa` latin1 latin1_swedish_ci
drop view v1AA;
select Aaa.col1 from t1Aa as AaA;
col1
......@@ -128,7 +128,7 @@ drop view v1AA;
create view v1Aa as select AaA.col1 from t1Aa as AaA;
show create view v1AA;
View Create View character_set_client collation_connection
v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `AaA`.`col1` AS `col1` from `t1aa` `AaA` latin1 latin1_swedish_ci
v1aa CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1aa` AS select `aaa`.`col1` AS `col1` from `t1aa` `aaa` latin1 latin1_swedish_ci
drop view v1AA;
drop table t1Aa;
CREATE TABLE t1 (a int, b int);
......@@ -142,7 +142,7 @@ CREATE OR REPLACE VIEW v1 AS
select X.a from t1 AS X group by X.b having (X.a = 1);
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `X`.`a` AS `a` from `t1` `X` group by `X`.`b` having (`X`.`a` = 1) latin1 latin1_swedish_ci
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `x`.`a` AS `a` from `t1` `x` group by `x`.`b` having (`x`.`a` = 1) latin1 latin1_swedish_ci
SELECT * FROM v1;
a
DROP VIEW v1;
......
......@@ -107,7 +107,21 @@ Database: information_schema
| TRIGGERS |
| USER_PRIVILEGES |
| VIEWS |
| INNODB_BUFFER_POOL_PAGES |
| PBXT_STATISTICS |
| INNODB_CMP |
| INNODB_RSEG |
| XTRADB_ENHANCEMENTS |
| INNODB_BUFFER_POOL_PAGES_INDEX |
| INNODB_INDEX_STATS |
| INNODB_TRX |
| INNODB_CMP_RESET |
| INNODB_LOCK_WAITS |
| INNODB_CMPMEM_RESET |
| INNODB_LOCKS |
| INNODB_CMPMEM |
| INNODB_TABLE_STATS |
| INNODB_BUFFER_POOL_PAGES_BLOB |
+---------------------------------------+
Database: INFORMATION_SCHEMA
+---------------------------------------+
......@@ -141,7 +155,21 @@ Database: INFORMATION_SCHEMA
| TRIGGERS |
| USER_PRIVILEGES |
| VIEWS |
| INNODB_BUFFER_POOL_PAGES |
| PBXT_STATISTICS |
| INNODB_CMP |
| INNODB_RSEG |
| XTRADB_ENHANCEMENTS |
| INNODB_BUFFER_POOL_PAGES_INDEX |
| INNODB_INDEX_STATS |
| INNODB_TRX |
| INNODB_CMP_RESET |
| INNODB_LOCK_WAITS |
| INNODB_CMPMEM_RESET |
| INNODB_LOCKS |
| INNODB_CMPMEM |
| INNODB_TABLE_STATS |
| INNODB_BUFFER_POOL_PAGES_BLOB |
+---------------------------------------+
Wildcard: inf_rmation_schema
+--------------------+
......
......@@ -93,9 +93,11 @@ INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55";
Warnings:
Warning 1265 Data truncated for column 'd' at row 1
UPDATE t1 SET d=1/NULL;
ERROR 23000: Column 'd' cannot be null
Warnings:
Warning 1265 Data truncated for column 'd' at row 1
UPDATE t1 SET d=NULL;
ERROR 23000: Column 'd' cannot be null
Warnings:
Warning 1048 Column 'd' cannot be null
INSERT INTO t1 (a) values (null);
ERROR 23000: Column 'a' cannot be null
INSERT INTO t1 (a) values (1/null);
......@@ -130,7 +132,7 @@ Warning 1048 Column 'd' cannot be null
Warning 1048 Column 'd' cannot be null
select * from t1;
a b c d
0 0000-00-00 00:00:00 2003
0 0000-00-00 00:00:00 0
0 0000-00-00 00:00:00 0
0 0000-00-00 00:00:00 0
0 0000-00-00 00:00:00 0
......
......@@ -407,8 +407,8 @@ EXPLAIN SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a
LEFT JOIN t3 ON t2.b=t3.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 4
1 SIMPLE t2 ref idx idx 5 test.t1.a 2
1 SIMPLE t3 ref idx idx 5 test.t2.b 186 Using index
1 SIMPLE t2 ref idx idx 5 test.t1.a 1
1 SIMPLE t3 ref idx idx 5 test.t2.b 1 Using index
FLUSH STATUS ;
SELECT SQL_CALC_FOUND_ROWS * FROM t1 LEFT JOIN t2 ON t1.a=t2.a
LEFT JOIN t3 ON t2.b=t3.b;
......
......@@ -338,12 +338,12 @@ select * from t1 X, t1 Y
where X.b = Y.b and (X.a=1 or X.a=2) and (Y.a=2 or Y.a=3);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE X p1,p2 ALL a,b NULL NULL NULL 2 Using where
1 SIMPLE Y p2,p3 ref a,b b 4 test.X.b 2 Using where
1 SIMPLE Y p2,p3 ref a,b b 4 test.X.b 1 Using where
explain partitions
select * from t1 X, t1 Y where X.a = Y.a and (X.a=1 or X.a=2);
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE X p1,p2 ALL a NULL NULL NULL 4 Using where
1 SIMPLE Y p1,p2 ref a a 4 test.X.a 2
1 SIMPLE Y p1,p2 ref a a 4 test.X.a 1
drop table t1;
create table t1 (a int) partition by hash(a) partitions 20;
insert into t1 values (1),(2),(3);
......
......@@ -1218,3 +1218,59 @@ c1 c2
0 opq
1 jkl
DROP TABLE t1;
create table parent (id int primary key);
create table child (id int PRIMARY KEY, FOREIGN KEY (id) REFERENCES parent(id));
insert into parent values (2), (3), (4);
insert into child values (3), (4);
delete ignore from parent;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (Constraint: `FOREIGN_1`)
select * from parent;
id
2
3
4
drop table child, parent;
create schema test378222;
use test378222;
create table t1 (id int primary key);
create table t2 (id int primary key);
alter table t1 add constraint foreign key (id) references t2 (id);
alter table t2 add constraint foreign key (id) references t1 (id);
drop schema test378222;
create schema test378222a;
create schema test378222b;
create table test378222a.t1 (id int primary key);
create table test378222b.t2 (id int primary key);
alter table test378222a.t1 add constraint foreign key (id) references test378222b.t2 (id);
alter table test378222b.t2 add constraint foreign key (id) references test378222a.t1 (id);
set foreign_key_checks = 1;
drop schema test378222a;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
drop schema test378222b;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails
set foreign_key_checks = 0;
drop schema test378222a;
drop schema test378222b;
set foreign_key_checks = 1;
use test;
CREATE TABLE t1(c1 TINYINT AUTO_INCREMENT NULL KEY ) AUTO_INCREMENT=10;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` tinyint(4) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=PBXT AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES(null);
INSERT INTO t1 VALUES(null);
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
c1
10
11
12
TRUNCATE TABLE t1;
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
c1
1
DROP TABLE t1;
......@@ -166,7 +166,7 @@ child CREATE TABLE `child` (
`parent_id` int(11) DEFAULT NULL,
KEY `par_ind` (`parent_id`),
KEY `child_ind` (`id`),
CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)
CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `test`.`parent` (`id`)
) ENGINE=PBXT DEFAULT CHARSET=latin1
drop index child_ind on child;
show create table child;
......@@ -175,7 +175,7 @@ child CREATE TABLE `child` (
`id` int(11) DEFAULT NULL,
`parent_id` int(11) DEFAULT NULL,
KEY `par_ind` (`parent_id`),
CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)
CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `test`.`parent` (`id`)
) ENGINE=PBXT DEFAULT CHARSET=latin1
alter table parent add column c1 varchar(40);
insert child values(2000, 2);
......@@ -243,7 +243,7 @@ child CREATE TABLE `child` (
`id` int(11) DEFAULT NULL,
`parent_id` int(11) DEFAULT NULL,
KEY `par_ind` (`parent_id`),
CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)
CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `test`.`parent` (`id`)
) ENGINE=PBXT DEFAULT CHARSET=latin1
alter table child add column c1 varchar(40);
insert child values(400, 1, "asd");
......@@ -284,7 +284,7 @@ child CREATE TABLE `child` (
`id` int(11) DEFAULT NULL,
`parent_id` int(11) DEFAULT NULL,
KEY `par_ind` (`parent_id`),
CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`) ON DELETE CASCADE
CONSTRAINT `FOREIGN_1` FOREIGN KEY (`parent_id`) REFERENCES `test`.`parent` (`id`) ON DELETE CASCADE
) ENGINE=PBXT DEFAULT CHARSET=latin1
insert parent values(1);
insert child values(100, 1);
......
......@@ -144,7 +144,7 @@ Key_reads 0
load index into cache t3, t2 key (primary,b) ;
Table Op Msg_type Msg_text
test.t3 preload_keys Error Table 'test.t3' doesn't exist
test.t3 preload_keys error Corrupt
test.t3 preload_keys status Operation failed
test.t2 preload_keys note The storage engine for the table doesn't support preload_keys
show status like "key_read%";
Variable_name Value
......@@ -159,7 +159,7 @@ Key_reads 0
load index into cache t3 key (b), t2 key (c) ;
Table Op Msg_type Msg_text
test.t3 preload_keys Error Table 'test.t3' doesn't exist
test.t3 preload_keys error Corrupt
test.t3 preload_keys status Operation failed
test.t2 preload_keys note The storage engine for the table doesn't support preload_keys
show status like "key_read%";
Variable_name Value
......
......@@ -289,11 +289,11 @@ prepare stmt4 from ' show index from t2 from test ';
execute stmt4;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t2 0 PRIMARY 1 a A 0 NULL NULL BTREE
t2 1 t2_idx 1 b A NULL NULL NULL YES BTREE
t2 1 t2_idx 1 b A 0 NULL NULL YES BTREE
prepare stmt4 from ' show table status from test like ''t2%'' ';
execute stmt4;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
t2 PBXT 10 Fixed 0 29 1 # 4096 0 NULL # # # latin1_swedish_ci NULL
t2 PBXT 10 Fixed 0 29 1024 # 4096 0 NULL # # # latin1_swedish_ci NULL
prepare stmt4 from ' show table status from test like ''t9%'' ';
execute stmt4;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
......@@ -447,7 +447,7 @@ def type 253 10 3 Y 0 31 8
def possible_keys 253 4096 0 Y 0 31 8
def key 253 64 0 Y 0 31 8
def key_len 253 4096 0 Y 0 31 8
def ref 253 1024 0 Y 0 31 8
def ref 253 2048 0 Y 0 31 8
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 14 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
......@@ -463,7 +463,7 @@ def type 253 10 5 Y 0 31 8
def possible_keys 253 4096 7 Y 0 31 8
def key 253 64 7 Y 0 31 8
def key_len 253 4096 1 Y 0 31 8
def ref 253 1024 0 Y 0 31 8
def ref 253 2048 0 Y 0 31 8
def rows 8 10 1 Y 32928 0 63
def Extra 253 255 27 N 1 31 8
id select_type table type possible_keys key key_len ref rows Extra
......
......@@ -423,19 +423,19 @@ test.t2 analyze status OK
explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL 1 Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 12
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1
explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL 1 Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 12
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1
explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid != 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL 2 Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 12
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1
explain select * from t1, t2 where t1.uid=t2.uid AND t2.uid != 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uid_index uid_index 4 NULL 2 Using where
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 12
1 SIMPLE t2 ref uid_index uid_index 4 test.t1.uid 1
select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0;
id name uid id name uid
1001 A 1 1001 A 1
......
......@@ -3,11 +3,13 @@ create schema foo;
show create schema foo;
Database Create Database
foo CREATE DATABASE `foo` /*!40100 DEFAULT CHARACTER SET latin1 */
create table t1 (id int) engine=pbxt;
show schemas;
Database
information_schema
foo
mtr
mysql
pbxt
test
drop schema foo;
......@@ -604,15 +604,15 @@ id select_type table type possible_keys key key_len ref rows Extra
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL period NULL NULL NULL 41810 Using temporary; Using filesort
1 SIMPLE t3 ref period period 4 test.t1.period 18
1 SIMPLE t3 ref period period 4 test.t1.period 1
explain select * from t3 as t1,t3 where t1.period=t3.period order by t3.period limit 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 index period period 4 NULL 1
1 SIMPLE t1 ref period period 4 test.t3.period 18
1 SIMPLE t3 index period period 4 NULL 10
1 SIMPLE t1 ref period period 4 test.t3.period 1
explain select * from t3 as t1,t3 where t1.period=t3.period order by t1.period limit 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index period period 4 NULL 1
1 SIMPLE t3 ref period period 4 test.t1.period 18
1 SIMPLE t1 index period period 4 NULL 10
1 SIMPLE t3 ref period period 4 test.t1.period 1
select period from t1;
period
9410
......@@ -2095,7 +2095,7 @@ show keys from t2;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t2 0 PRIMARY 1 auto A 1199 NULL NULL BTREE
t2 0 fld1 1 fld1 A 1199 NULL NULL BTREE
t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
t2 1 fld3 1 fld3 A 1199 NULL NULL BTREE
drop table t4, t3, t2, t1;
DO 1;
DO benchmark(100,1+1),1,1;
......@@ -2369,7 +2369,7 @@ insert into t2 values (1,3), (2,3), (3,4), (4,4);
explain select * from t1 left join t2 on a=c where d in (4);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref c,d d 5 const 1 Using where
1 SIMPLE t1 ref a a 5 test.t2.c 2 Using where
1 SIMPLE t1 ref a a 5 test.t2.c 1 Using where
select * from t1 left join t2 on a=c where d in (4);
a b c d
3 2 3 4
......@@ -2377,7 +2377,7 @@ a b c d
explain select * from t1 left join t2 on a=c where d = 4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref c,d d 5 const 1 Using where
1 SIMPLE t1 ref a a 5 test.t2.c 2 Using where
1 SIMPLE t1 ref a a 5 test.t2.c 1 Using where
select * from t1 left join t2 on a=c where d = 4;
a b c d
3 2 3 4
......@@ -2403,11 +2403,11 @@ INSERT INTO t2 VALUES ('one'),('two'),('three'),('four'),('five');
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
1 SIMPLE t2 ref a a 23 test.t1.a 2
1 SIMPLE t2 ref a a 23 test.t1.a 1
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
1 SIMPLE t2 ref a a 23 test.t1.a 2
1 SIMPLE t2 ref a a 23 test.t1.a 1
DROP TABLE t1, t2;
CREATE TABLE t1 ( city char(30) );
INSERT INTO t1 VALUES ('London');
......@@ -2792,26 +2792,26 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
select max(key1) from t1 where key1 <= 0.6158;
max(key1)
0.61580002307892
0.615800023078918
select max(key2) from t2 where key2 <= 1.6158;
max(key2)
1.6158000230789
1.61580002307892
select min(key1) from t1 where key1 >= 0.3762;
min(key1)
0.37619999051094
0.376199990510941
select min(key2) from t2 where key2 >= 1.3762;
min(key2)
1.3761999607086
1.37619996070862
select max(key1), min(key2) from t1, t2
where key1 <= 0.6158 and key2 >= 1.3762;
max(key1) min(key2)
0.61580002307892 1.3761999607086
0.615800023078918 1.37619996070862
select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
max(key1)
0.61580002307892
0.615800023078918
select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
min(key1)
0.37619999051094
0.376199990510941
DROP TABLE t1,t2;
CREATE TABLE t1 (i BIGINT UNSIGNED NOT NULL);
INSERT INTO t1 VALUES (10);
......@@ -3454,7 +3454,7 @@ explain select * from t2 A, t2 B where A.a=5 and A.b=5 and A.C<5
and B.a=5 and B.b=A.e and (B.b =1 or B.b = 3 or B.b=5);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE A range PRIMARY PRIMARY 12 NULL 1 Using where
1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 11
1 SIMPLE B ref PRIMARY PRIMARY 8 const,test.A.e 1
drop table t1, t2;
CREATE TABLE t1 (a int PRIMARY KEY, b int, INDEX(b));
INSERT INTO t1 VALUES (1, 3), (9,4), (7,5), (4,5), (6,2),
......@@ -3468,12 +3468,12 @@ EXPLAIN
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b b 5 NULL 1 Using where
1 SIMPLE t2 ref c c 5 test.t1.a 2 Using where
1 SIMPLE t2 ref c c 5 test.t1.a 1 Using where
EXPLAIN
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,b PRIMARY 4 NULL 1 Using where
1 SIMPLE t2 ref c c 5 test.t1.a 2 Using where
1 SIMPLE t2 ref c c 5 test.t1.a 1 Using where
DROP TABLE t1, t2;
create table t1 (
a int unsigned not null auto_increment primary key,
......
......@@ -70,12 +70,12 @@ insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(nu
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL b NULL NULL NULL 21
1 SIMPLE t2 ref b b 21 test.t1.b 2 Using where
1 SIMPLE t2 ref b b 21 test.t1.b 1 Using where
set MAX_SEEKS_FOR_KEY=1;
explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL b NULL NULL NULL 21
1 SIMPLE t2 ref b b 21 test.t1.b 2 Using where
1 SIMPLE t2 ref b b 21 test.t1.b 1 Using where
SET MAX_SEEKS_FOR_KEY=DEFAULT;
drop table t1;
create table t1 (a int);
......
......@@ -1333,7 +1333,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1 100.00 Using index; Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
......@@ -1343,7 +1343,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1 100.00 Using index; Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where ((`test`.`t1`.`b` <> 30) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))))
select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
......@@ -1353,8 +1353,8 @@ a
explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 ref a a 5 func 1001 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t3 index a a 5 NULL 3 100.00 Using where; Using index; Using join buffer
2 DEPENDENT SUBQUERY t1 ref a a 5 func 1 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t3 ref a a 5 test.t1.b 1 100.00 Using where; Using index
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t1` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t1`.`b`) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`))))
insert into t1 values (3,31);
......@@ -1370,7 +1370,7 @@ a
explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t2 index NULL a 5 NULL 4 100.00 Using where; Using index
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1001 100.00 Using index; Using where
2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 1 100.00 Using index; Using where
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t2` where <in_optimizer>(`test`.`t2`.`a`,<exists>(<index_lookup>(<cache>(`test`.`t2`.`a`) in t1 on a where ((`test`.`t1`.`b` <> 30) and (<cache>(`test`.`t2`.`a`) = `test`.`t1`.`a`)))))
drop table t1, t2, t3;
......@@ -3546,7 +3546,7 @@ ORDER BY t1.t DESC LIMIT 1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 1
1 PRIMARY t1 index NULL PRIMARY 16 NULL 11 Using where; Using index; Using join buffer
2 DEPENDENT SUBQUERY t1 ref PRIMARY PRIMARY 8 test.t2.i1,const 2 Using where; Using index; Using filesort
2 DEPENDENT SUBQUERY t1 ref PRIMARY PRIMARY 8 test.t2.i1,const 1 Using where; Using index; Using filesort
SELECT * FROM t1,t2
WHERE t1.t = (SELECT t1.t FROM t1
WHERE t1.t < t2.t AND t1.i2=1 AND t2.i1=t1.i1
......@@ -4214,7 +4214,7 @@ CREATE INDEX I2 ON t1 (b);
EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 2 Using index; Using where
2 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 1 Using index; Using where
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
a b
CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10));
......@@ -4224,14 +4224,14 @@ CREATE INDEX I2 ON t2 (b);
EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t2 index_subquery I1 I1 4 func 2 Using index; Using where
2 DEPENDENT SUBQUERY t2 index_subquery I1 I1 4 func 1 Using index; Using where
SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
a b
EXPLAIN
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
2 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 2 Using index; Using where
2 DEPENDENT SUBQUERY t1 index_subquery I1 I1 2 func 1 Using index; Using where
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
a b
DROP TABLE t1,t2;
......
......@@ -1776,8 +1776,14 @@ t1 CREATE TABLE `t1` (
`russian_deviant` enum('E','F','EF','F,E') NOT NULL DEFAULT 'E'
) ENGINE=PBXT DEFAULT CHARSET=latin1
drop table t1;
select @@SESSION.sql_mode;
@@SESSION.sql_mode
select @@GLOBAL.sql_mode;
@@GLOBAL.sql_mode
create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','
 !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\','zz'));
ERROR HY000: Can't create table 'test.t1' (errno: -1)
drop table t1;
End of 5.1 tests
......@@ -70,19 +70,19 @@ flags set('one','two','tree') latin1_swedish_ci NO #
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 auto A 0 NULL NULL BTREE
t1 1 utiny 1 utiny A NULL NULL NULL BTREE
t1 1 tiny 1 tiny A NULL NULL NULL BTREE
t1 1 short 1 short A NULL NULL NULL BTREE
t1 1 any_name 1 medium A NULL NULL NULL BTREE
t1 1 longlong 1 longlong A NULL NULL NULL BTREE
t1 1 real_float 1 real_float A NULL NULL NULL BTREE
t1 1 ushort 1 ushort A NULL NULL NULL BTREE
t1 1 umedium 1 umedium A NULL NULL NULL BTREE
t1 1 ulong 1 ulong A NULL NULL NULL BTREE
t1 1 ulonglong 1 ulonglong A NULL NULL NULL BTREE
t1 1 ulonglong 2 ulong A NULL NULL NULL BTREE
t1 1 options 1 options A NULL NULL NULL BTREE
t1 1 options 2 flags A NULL NULL NULL BTREE
t1 1 utiny 1 utiny A 0 NULL NULL BTREE
t1 1 tiny 1 tiny A 0 NULL NULL BTREE
t1 1 short 1 short A 0 NULL NULL BTREE
t1 1 any_name 1 medium A 0 NULL NULL BTREE
t1 1 longlong 1 longlong A 0 NULL NULL BTREE
t1 1 real_float 1 real_float A 0 NULL NULL BTREE
t1 1 ushort 1 ushort A 0 NULL NULL BTREE
t1 1 umedium 1 umedium A 0 NULL NULL BTREE
t1 1 ulong 1 ulong A 0 NULL NULL BTREE
t1 1 ulonglong 1 ulonglong A 0 NULL NULL BTREE
t1 1 ulonglong 2 ulong A 0 NULL NULL BTREE
t1 1 options 1 options A 0 NULL NULL BTREE
t1 1 options 2 flags A 0 NULL NULL BTREE
CREATE UNIQUE INDEX test on t1 ( auto ) ;
CREATE INDEX test2 on t1 ( ulonglong,ulong) ;
CREATE INDEX test3 on t1 ( medium ) ;
......
......@@ -101,13 +101,13 @@ create table t1 (t2 timestamp(2), t4 timestamp(4), t6 timestamp(6),
t8 timestamp(8), t10 timestamp(10), t12 timestamp(12),
t14 timestamp(14));
Warnings:
Warning 1287 The syntax 'TIMESTAMP(2)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(4)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(6)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(8)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(10)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(12)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(14)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(2)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(4)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(6)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(8)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(10)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(12)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
Warning 1287 The syntax 'TIMESTAMP(14)' is deprecated and will be removed in MySQL 6.0. Please use 'TIMESTAMP' instead
insert t1 values (0,0,0,0,0,0,0),
("1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
"1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
......
......@@ -1301,12 +1301,14 @@ t3 CREATE TABLE `t3` (
`left(a,100000000)` longtext
) ENGINE=PBXT DEFAULT CHARSET=latin1
drop tables t1,t2,t3;
SELECT @tmp_max:= @@global.max_allowed_packet;
@tmp_max:= @@global.max_allowed_packet
1048576
SET @@global.max_allowed_packet=25000000;
CREATE TABLE t1 (a mediumtext);
CREATE TABLE t2 (b varchar(20));
INSERT INTO t1 VALUES ('a');
CREATE TABLE t3 SELECT REPEAT(a,20000000) AS a FROM t1 UNION SELECT b FROM t2;
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (1048576) - truncated
SHOW CREATE TABLE t3;
Table Create Table
t3 CREATE TABLE `t3` (
......@@ -1340,6 +1342,7 @@ t3 CREATE TABLE `t3` (
`a` varbinary(510) DEFAULT NULL
) ENGINE=PBXT DEFAULT CHARSET=latin1
DROP TABLES t1,t2,t3;
SET @@global.max_allowed_packet:= @tmp_max;
create table t1 ( id int not null auto_increment, primary key (id), col1 int);
insert into t1 (col1) values (2),(3),(4),(5),(6);
select 99 union all select id from t1 order by 1;
......
......@@ -28,7 +28,7 @@ create view v2 as select * from mysqltest.t2;
ERROR 42000: ANY command denied to user 'mysqltest_1'@'localhost' for table 't2'
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` latin1 latin1_swedish_ci
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` latin1 latin1_swedish_ci
grant create view,drop,select on test.* to mysqltest_1@localhost;
use test;
alter view v1 as select * from mysqltest.t1;
......@@ -309,7 +309,7 @@ grant create view,select on test.* to mysqltest_1@localhost;
create view v1 as select * from mysqltest.t1;
show create view v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `test`.`v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` latin1 latin1_swedish_ci
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`mysqltest_1`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `mysqltest`.`t1`.`a` AS `a`,`mysqltest`.`t1`.`b` AS `b` from `mysqltest`.`t1` latin1 latin1_swedish_ci
revoke select on mysqltest.t1 from mysqltest_1@localhost;
select * from v1;
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
......
......@@ -150,7 +150,6 @@ delete from t1 where a=0;
update t1 set a=0 where b=5;
select * from t1 order by b;
delete from t1 where a=0;
--error 1048
update t1 set a=NULL where b=6;
update t1 set a=300 where b=7;
SET SQL_MODE='';
......@@ -166,7 +165,6 @@ delete from t1 where a=0;
update t1 set a=0 where b=12;
select * from t1 order by b;
delete from t1 where a=0;
--error 1048
update t1 set a=NULL where b=13;
update t1 set a=500 where b=14;
select * from t1 order by b;
......
......@@ -120,13 +120,16 @@ select * from t2;
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
select * from t11;
select * from t12;
--error 1242
delete ignore t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b <> (select b from t2 where t11.a < t2.a);
select * from t11;
select * from t12;
--error 1062
insert into t11 values (2, 12);
-- error 1242
delete from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
select * from t11;
--error 1242
delete ignore from t11 where t11.b <> (select b from t2 where t11.a < t2.a);
select * from t11;
drop table t11, t12, t2;
......
......@@ -546,6 +546,7 @@ SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
CREATE INDEX idx_b ON t8(b);
--sorted_result
EXPLAIN EXTENDED
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
......@@ -585,6 +586,7 @@ SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
CREATE INDEX idx_b ON t1(b);
CREATE INDEX idx_a ON t0(a);
--sorted_result
EXPLAIN EXTENDED
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
......@@ -621,6 +623,7 @@ SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
(t8.b=t9.b OR t8.c IS NULL) AND
(t9.a=1);
--sorted_result
SELECT t0.a,t0.b,t1.a,t1.b,t2.a,t2.b,t3.a,t3.b,t4.a,t4.b,
t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b,t9.a,t9.b
FROM t0,t1
......
......@@ -61,9 +61,7 @@ drop table t1;
#
CREATE TABLE t1 (a varchar(16) NOT NULL default '', b smallint(6) NOT NULL default 0, c datetime NOT NULL default '0000-00-00 00:00:00', d smallint(6) NOT NULL default 0);
INSERT INTO t1 SET a = "", d= "2003-01-14 03:54:55";
--error 1048
UPDATE t1 SET d=1/NULL;
--error 1048
UPDATE t1 SET d=NULL;
--error 1048
INSERT INTO t1 (a) values (null);
......
......@@ -926,7 +926,59 @@ LOAD DATA LOCAL INFILE 'suite/pbxt/t/load_unique_error1.inc' REPLACE INTO TABLE
SELECT * FROM t1 ORDER BY c1;
DROP TABLE t1;
create table parent (id int primary key);
create table child (id int PRIMARY KEY, FOREIGN KEY (id) REFERENCES parent(id));
insert into parent values (2), (3), (4);
insert into child values (3), (4);
--error 1451
delete ignore from parent;
--sorted_result
select * from parent;
drop table child, parent;
# bug 378222: Drop sakila causes error: Cannot delete or update a parent row: a foreign key constraint fails
create schema test378222;
use test378222;
create table t1 (id int primary key);
create table t2 (id int primary key);
alter table t1 add constraint foreign key (id) references t2 (id);
alter table t2 add constraint foreign key (id) references t1 (id);
drop schema test378222;
create schema test378222a;
create schema test378222b;
create table test378222a.t1 (id int primary key);
create table test378222b.t2 (id int primary key);
alter table test378222a.t1 add constraint foreign key (id) references test378222b.t2 (id);
alter table test378222b.t2 add constraint foreign key (id) references test378222a.t1 (id);
set foreign_key_checks = 1;
--error 1217
drop schema test378222a;
--error 1217
drop schema test378222b;
set foreign_key_checks = 0;
drop schema test378222a;
drop schema test378222b;
set foreign_key_checks = 1;
use test;
# bug 369086: Incosistent/Incorrect Truncate behavior
CREATE TABLE t1(c1 TINYINT AUTO_INCREMENT NULL KEY ) AUTO_INCREMENT=10;
SHOW CREATE TABLE t1;
INSERT INTO t1 VALUES(null);
INSERT INTO t1 VALUES(null);
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
TRUNCATE TABLE t1;
INSERT INTO t1 VALUES(null);
SELECT * FROM t1;
DROP TABLE t1;
--disable_query_log
DROP TABLE t2, t5;
drop database pbxt;
--enable_query_log
......@@ -63,7 +63,28 @@ connection con2;
# Wait for the the tables to be renamed
# i.e the query below succeds
let $query= select * from t2, t4;
source include/wait_for_query_to_suceed.inc;
# source include/wait_for_query_to_suceed.inc;
let $counter= 100;
disable_abort_on_error;
disable_query_log;
disable_result_log;
eval $query;
while ($mysql_errno)
{
eval $query;
sleep 0.1;
dec $counter;
if (!$counter)
{
die("Waited too long for query to suceed");
}
}
enable_abort_on_error;
enable_query_log;
enable_result_log;
show tables;
......
......@@ -10,5 +10,12 @@ drop database if exists mysqltest1;
create schema foo;
show create schema foo;
# force PBXT schema to be created
create table t1 (id int) engine=pbxt;
show schemas;
drop schema foo;
--disable_query_log
drop table if exists t1;
drop database pbxt;
--enable_query_log
......@@ -153,12 +153,19 @@ create table t1(russian_deviant enum('E','F','E
show create table t1;
drop table t1;
# ER_WRONG_FIELD_TERMINATORS
--error 1005
# the following create statement sometimes fails like it would if NO_BACKSLASH_ESCAPES sql mode was on,
# we check sql mode here
select @@SESSION.sql_mode;
select @@GLOBAL.sql_mode;
## ER_WRONG_FIELD_TERMINATORS
#--error 1005
create table t1(exhausting_charset enum('ABCDEFGHIJKLMNOPQRSTUVWXYZ','
 !"','#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~','xx\','yy\','zz'));
drop table t1;
--disable_query_log
drop database pbxt;
--enable_query_log
......
......@@ -802,6 +802,10 @@ drop tables t1,t2,t3;
# exceeds mediumtext maximum length
#
SELECT @tmp_max:= @@global.max_allowed_packet;
SET @@global.max_allowed_packet=25000000;
# switching connection to allow the new max_allowed_packet take effect
--connect (newconn, localhost, root,,)
CREATE TABLE t1 (a mediumtext);
CREATE TABLE t2 (b varchar(20));
INSERT INTO t1 VALUES ('a');
......@@ -823,6 +827,9 @@ INSERT INTO t1 VALUES ('a');
CREATE TABLE t3 SELECT REPEAT(a,2) AS a FROM t1 UNION SELECT b FROM t2;
SHOW CREATE TABLE t3;
DROP TABLES t1,t2,t3;
--connection default
SET @@global.max_allowed_packet:= @tmp_max;
--disconnect newconn
#
# Bug #10032 Bug in parsing UNION with ORDER BY when one node does not use FROM
......
......@@ -25,6 +25,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include
${CMAKE_SOURCE_DIR}/sql
${CMAKE_SOURCE_DIR}/regex
${CMAKE_SOURCE_DIR}/zlib
${CMAKE_SOURCE_DIR}/extra/libevent
)
SET_SOURCE_FILES_PROPERTIES(${CMAKE_SOURCE_DIR}/sql/sql_yacc.h
......@@ -85,7 +86,7 @@ ADD_EXECUTABLE(mysqld
TARGET_LINK_LIBRARIES(mysqld
heap myisam myisammrg mysys yassl zlib debug dbug yassl
taocrypt strings vio regex wsock32 ws2_32)
taocrypt strings vio regex libevent wsock32 ws2_32)
SET_TARGET_PROPERTIES(mysqld PROPERTIES OUTPUT_NAME mysqld${MYSQLD_EXE_SUFFIX})
......@@ -139,7 +140,7 @@ ADD_CUSTOM_COMMAND(
# Gen_lex_hash
ADD_EXECUTABLE(gen_lex_hash gen_lex_hash.cc)
TARGET_LINK_LIBRARIES(gen_lex_hash debug dbug mysqlclient wsock32)
TARGET_LINK_LIBRARIES(gen_lex_hash debug dbug mysqlclient strings wsock32)
GET_TARGET_PROPERTY(GEN_LEX_HASH_EXE gen_lex_hash LOCATION)
ADD_CUSTOM_COMMAND(
OUTPUT ${PROJECT_SOURCE_DIR}/sql/lex_hash.h
......
PBXT Release Notes
==================
------- 1.0.08 RC - Not yet released
------- 1.0.08c RC2 - 2009-08-18
RN266: Updated BLOB streaming glue, used with the PBMS engine. The glue code is now identical to the version of "1.0.08-rc-pbms" version of PBXT available from http://blobstreaming.org/download.
RN265: Changes the sequential reading of data log files to skip gaps, instead of returning EOF. This ensures that extended data records are preserved even when something goes wrong with the way the file is written.
RN264: Fixed a bug that cased an "Data log not found" error after an out of disk space error on a log file. This bug is similar to RN262 in that it allows "gaps" to appear in the data logs.
RN263: Updated xtstat to compile on Windows/MS Visual C++.
RN262: Merged changes for PBMS version 0.5.09.
RN261: Concerning bug #377788: Cannot find index for FK. Fixed buffer overflow which occurred when the error was reported.
RN260: Fixed bug #377788: Cannot find index for FK. PBXT now correctly uses prefix of an index to support FK references (e.g. if key = (c1, c2) then an index on (c1, c2, c3) will work). Also fixed buffer overflow, which occurred when reporting the error.
RN259: Fixed bug #309424: xtstat doesn't use my.cnf. You can now add an [xtstat] section to my.cnf, for use with xtstat.
RN258: updated xt_p_join implementation for Windows to check if a thread has already exited or has not yet started
RN257: Removed false assertion that could fail during restore if a transaction log page was zero-filled
RN256: Update datalog eof pointer only if write opearions were sucessful
RN255: Added re-allocation of of filemap if allocating the of the new map failed. This often happens if there's not enough space on disk.
RN254: When a table with a corrupted index is detected, PBXT creates a file called 'repair-pending' in the pbxt directory, with the name of the table in it. Each table in the file is listed on a line by itself (the last line has no trailing \n). When the table is repaired (using the REPAIR TABLE command), this entry is removed from the file.
RN253: Use fcntl(F_FULLFSYNC) instead of fsync on platforms that support it. Improper fsync operation was presumably the reason of index corruption on Mac OS X.
RN252: Fixed bug #368692: PBXT not reporting data size correctly in information_schema.
------- 1.0.08 RC2 - 2009-06-30
RN251: A Windows-specific test update, also removed false assertion that failed on Windows.
RN250: Fixed a bug that caused recovery to fail when the transaction log ID exceeded 255. The problem was a checksum failed in the log record.
RN249: Fixed bug #313176: Test case timeout. This happened because record cache pages where not properly freed and as soon as cache filled up the performacne degraded.
RN248: PBXT now compiles and runs with MySQL 5.1.35. All tests pass.
RN247: Fixed bug #369086: Incosistent/Incorrect Truncate behavior
RN246: Fixed bug #378222: Drop sakila causes error: Cannot delete or update a parent row: a foreign key constraint fails
RN245: Fixed bug #379315: Inconsistent behavior of DELETE IGNORE and FK constraint.
RN244: Fixed a recovery problem: during the recovery of "record modified" action the table was updated before the old index entries were removed; then the xres_remove_index_entries was supplied the new record which lead to incorrect index update.
RN243: Fixed a bug that caused a recovery failure if partitioned pbxt tables where present. This happended because the recovery used a MySQL function to open tables and the PBXT handler was not yet registered
RN242: Fixed a bug that caused a deadlock if pbxt initialization failed. This happened because pbxt ceanup was done from pbxt_init() with PLUGIN_lock being held by MySQL which lead to a deadlock in the freeer thread
RN241: Fixed a heap corruption bug (writing to a freed memory location). It happened only when memory mapped files were used leading to heap inconsistency and program crash or termination by heap checker. Likely to happen right after or during DROP TABLE but possible in other cases too.
RN240: Load the record cache on read when no using memory mapped files.
RN239: Added PBXT variable pbxt_max_threads. This is the maximum number of threads that can be created PBXT. By default this value is set to 0 which means the number of threads is derived from the MySQL variable max_connections. The value used is max_connections+7. Under Drizzle the default value is 500.
RN238: Added an option to wait for the sweeper to clean up old transactions on a particular connection. This prevents the sweeper from getting too far behind.
RN237: Added an option to lazy delete fixed length index entries. This means the index entries are just marked for deletion, instead of removing the items from the index page. This has the advantage that an exclusive lock is not always required for deletion.
RN236: Fixed bug #349177: a bug in configure.in script.
RN235: Fixed bug 349176: a compiler warning.
RN234: Completed Drizzle integration. All Drizzle tests now run with PBXT.
RN233: Fixed bugs which occur when PBXT is used together with PBMS (BLOB Streaming engine).
......
......@@ -19,7 +19,7 @@ noinst_HEADERS = bsearch_xt.h cache_xt.h ccutils_xt.h database_xt.h \
datadic_xt.h datalog_xt.h filesys_xt.h hashtab_xt.h \
ha_pbxt.h heap_xt.h index_xt.h linklist_xt.h \
memory_xt.h myxt_xt.h pthread_xt.h restart_xt.h \
streaming_xt.h sortedlist_xt.h strutil_xt.h \
pbms_enabled.h sortedlist_xt.h strutil_xt.h \
tabcache_xt.h table_xt.h trace_xt.h thread_xt.h \
util_xt.h xaction_xt.h xactlog_xt.h lock_xt.h \
systab_xt.h ha_xtsys.h discover_xt.h \
......@@ -30,7 +30,7 @@ libpbxt_la_SOURCES = bsearch_xt.cc cache_xt.cc ccutils_xt.cc database_xt.cc \
datadic_xt.cc datalog_xt.cc filesys_xt.cc hashtab_xt.cc \
ha_pbxt.cc heap_xt.cc index_xt.cc linklist_xt.cc \
memory_xt.cc myxt_xt.cc pthread_xt.cc restart_xt.cc \
streaming_xt.cc sortedlist_xt.cc strutil_xt.cc \
pbms_enabled.cc sortedlist_xt.cc strutil_xt.cc \
tabcache_xt.cc table_xt.cc trace_xt.cc thread_xt.cc \
systab_xt.cc ha_xtsys.cc discover_xt.cc \
util_xt.cc xaction_xt.cc xactlog_xt.cc lock_xt.cc locklist_xt.cc
......
This diff is collapsed.
......@@ -45,8 +45,46 @@ struct XTIdxReadBuffer;
#define IDX_CAC_BLOCK_CLEAN 1
#define IDX_CAC_BLOCK_DIRTY 2
typedef enum XTPageLockType { XT_LOCK_READ, XT_LOCK_WRITE, XT_XLOCK_LEAF };
typedef enum XTPageUnlockType { XT_UNLOCK_NONE, XT_UNLOCK_READ, XT_UNLOCK_WRITE, XT_UNLOCK_R_UPDATE, XT_UNLOCK_W_UPDATE };
#ifdef XT_NO_ATOMICS
#define XT_IPAGE_USE_PTHREAD_RW
#else
//#define XT_IPAGE_USE_ATOMIC_RW
#define XT_IPAGE_USE_SPINXSLOCK
//#define XT_IPAGE_USE_SKEW_RW
#endif
#ifdef XT_IPAGE_USE_ATOMIC_RW
#define XT_IPAGE_LOCK_TYPE XTAtomicRWLockRec
#define XT_IPAGE_INIT_LOCK(s, i) xt_atomicrwlock_init_with_autoname(s, i)
#define XT_IPAGE_FREE_LOCK(s, i) xt_atomicrwlock_free(s, i)
#define XT_IPAGE_READ_LOCK(i) xt_atomicrwlock_slock(i)
#define XT_IPAGE_WRITE_LOCK(i, o) xt_atomicrwlock_xlock(i, o)
#define XT_IPAGE_UNLOCK(i, x) xt_atomicrwlock_unlock(i, x)
#elif defined(XT_IPAGE_USE_PTHREAD_RW)
#define XT_IPAGE_LOCK_TYPE xt_rwlock_type
#define XT_IPAGE_INIT_LOCK(s, i) xt_init_rwlock(s, i)
#define XT_IPAGE_FREE_LOCK(s, i) xt_free_rwlock(i)
#define XT_IPAGE_READ_LOCK(i) xt_slock_rwlock_ns(i)
#define XT_IPAGE_WRITE_LOCK(i, s) xt_xlock_rwlock_ns(i)
#define XT_IPAGE_UNLOCK(i, x) xt_unlock_rwlock_ns(i)
#elif defined(XT_IPAGE_USE_SPINXSLOCK)
#define XT_IPAGE_LOCK_TYPE XTSpinXSLockRec
#define XT_IPAGE_INIT_LOCK(s, i) xt_spinxslock_init_with_autoname(s, i)
#define XT_IPAGE_FREE_LOCK(s, i) xt_spinxslock_free(s, i)
#define XT_IPAGE_READ_LOCK(i) xt_spinxslock_slock(i)
#define XT_IPAGE_WRITE_LOCK(i, o) xt_spinxslock_xlock(i, o)
#define XT_IPAGE_UNLOCK(i, x) xt_spinxslock_unlock(i, x)
#else // XT_IPAGE_USE_SKEW_RW
#define XT_IPAGE_LOCK_TYPE XTSkewRWLockRec
#define XT_IPAGE_INIT_LOCK(s, i) xt_skewrwlock_init_with_autoname(s, i)
#define XT_IPAGE_FREE_LOCK(s, i) xt_skewrwlock_free(s, i)
#define XT_IPAGE_READ_LOCK(i) xt_skewrwlock_slock(i)
#define XT_IPAGE_WRITE_LOCK(i, o) xt_skewrwlock_xlock(i, o)
#define XT_IPAGE_UNLOCK(i, x) xt_skewrwlock_unlock(i, x)
#endif
enum XTPageLockType { XT_LOCK_READ, XT_LOCK_WRITE, XT_XLOCK_LEAF, XT_XLOCK_DEL_LEAF };
enum XTPageUnlockType { XT_UNLOCK_NONE, XT_UNLOCK_READ, XT_UNLOCK_WRITE, XT_UNLOCK_R_UPDATE, XT_UNLOCK_W_UPDATE };
/* A block is X locked if it is being changed or freed.
* A block is S locked if it is being read.
......@@ -64,10 +102,11 @@ typedef struct XTIndBlock {
struct XTIndBlock *cb_mr_used; /* More recently used blocks. */
struct XTIndBlock *cb_lr_used; /* Less recently used blocks. */
/* Protected by cb_lock: */
XTAtomicRWLockRec cb_lock;
XT_IPAGE_LOCK_TYPE cb_lock;
xtWord1 cb_state; /* Block status. */
xtWord2 cb_handle_count; /* TRUE if this page is referenced by a handle. */
xtWord2 cp_flush_seq;
xtWord2 cp_del_count; /* Number of deleted entries. */
#ifdef XT_USE_DIRECT_IO_ON_INDEX
xtWord1 *cb_data;
#else
......@@ -76,16 +115,18 @@ typedef struct XTIndBlock {
} XTIndBlockRec, *XTIndBlockPtr;
typedef struct XTIndReference {
XTPageUnlockType ir_ulock;
xtBool ir_xlock; /* Set to TRUE if the cache block is X locked. */
xtBool ir_updated; /* Set to TRUE if the cache block is updated. */
XTIndBlockPtr ir_block;
XTIdxBranchDPtr ir_branch;
} XTIndReferenceRec, *XTIndReferencePtr;
typedef struct XTIndFreeBlock {
XTDiskValue1 if_zero1_1; /* Must be set to zero. */
XTDiskValue1 if_zero2_1; /* Must be set to zero. */
XTDiskValue1 if_status_1;
XTDiskValue1 if_unused1_1;
XTDiskValue2 if_unused2_2;
XTDiskValue4 if_unused3_4;
XTDiskValue4 if_unused2_4;
XTDiskValue8 if_next_block_8;
} XTIndFreeBlockRec, *XTIndFreeBlockPtr;
......@@ -116,14 +157,13 @@ xtInt8 xt_ind_get_size();
xtBool xt_ind_write(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID offset, size_t size, xtWord1 *data);
xtBool xt_ind_write_cache(struct XTOpenTable *ot, xtIndexNodeID offset, size_t size, xtWord1 *data);
xtBool xt_ind_clean(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID offset);
xtBool xt_ind_read_bytes(struct XTOpenTable *ot, xtIndexNodeID offset, size_t size, xtWord1 *data);
xtBool xt_ind_read_bytes(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID offset, size_t size, xtWord1 *data);
void xt_ind_check_cache(XTIndexPtr ind);
xtBool xt_ind_reserve(struct XTOpenTable *ot, u_int count, XTIdxBranchDPtr not_this);
void xt_ind_free_reserved(struct XTOpenTable *ot);
void xt_ind_unreserve(struct XTOpenTable *ot);
void xt_load_indices(XTThreadPtr self, struct XTOpenTable *ot);
xtBool xt_ind_fetch(struct XTOpenTable *ot, xtIndexNodeID node, XTPageLockType ltype, XTIndReferencePtr iref);
xtBool xt_ind_fetch(struct XTOpenTable *ot, XTIndexPtr ind, xtIndexNodeID node, XTPageLockType ltype, XTIndReferencePtr iref);
xtBool xt_ind_release(struct XTOpenTable *ot, XTIndexPtr ind, XTPageUnlockType utype, XTIndReferencePtr iref);
void xt_ind_lock_handle(XTIndHandlePtr handle);
......
......@@ -29,7 +29,7 @@
#include "ccutils_xt.h"
#include "bsearch_xt.h"
static int ccu_compare_object(XTThreadPtr XT_UNUSED(self), register const void XT_UNUSED(*thunk), register const void *a, register const void *b)
static int ccu_compare_object(XTThreadPtr XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
{
XTObject *obj_ptr = (XTObject *) b;
......
......@@ -23,6 +23,10 @@
#include "xt_config.h"
#ifdef DRIZZLED
#include <bitset>
#endif
#include <string.h>
#include <stdio.h>
......@@ -240,7 +244,7 @@ static void db_hash_free(XTThreadPtr self, void *data)
xt_heap_release(self, (XTDatabaseHPtr) data);
}
static int db_cmp_db_id(struct XTThread XT_UNUSED(*self), register const void XT_UNUSED(*thunk), register const void *a, register const void *b)
static int db_cmp_db_id(struct XTThread *XT_UNUSED(self), register const void *XT_UNUSED(thunk), register const void *a, register const void *b)
{
xtDatabaseID db_id = *((xtDatabaseID *) a);
XTDatabaseHPtr *db_ptr = (XTDatabaseHPtr *) b;
......@@ -346,7 +350,7 @@ static void db_finalize(XTThreadPtr self, void *x)
}
}
static void db_onrelease(XTThreadPtr self, void XT_UNUSED(*x))
static void db_onrelease(XTThreadPtr self, void *XT_UNUSED(x))
{
/* Signal threads waiting for exclusive use of the database: */
if (xt_db_open_databases) // The database may already be closed.
......@@ -638,6 +642,12 @@ xtPublic void xt_use_database(XTThreadPtr self, XTDatabaseHPtr db, int what_for)
xt_heap_reference(self, db);
self->st_database = db;
#ifdef XT_WAIT_FOR_CLEANUP
self->st_last_xact = 0;
for (int i=0; i<XT_MAX_XACT_BEHIND; i++) {
self->st_prev_xact[i] = db->db_xn_curr_id;
}
#endif
xt_xn_init_thread(self, what_for);
}
......@@ -1117,15 +1127,18 @@ xtPublic void xt_db_return_table_to_pool_ns(XTOpenTablePtr ot)
XTDatabaseHPtr db = ot->ot_table->tab_db;
xtBool flush_table = TRUE;
/* No open table returned to the pool should still
* have a cache handle!
*/
ASSERT_NS(!ot->ot_ind_rhandle);
xt_lock_mutex_ns(&db->db_ot_pool.opt_lock);
if (!(table_pool = db_get_open_table_pool(db, ot->ot_table->tab_id)))
goto failed;
if (table_pool->opt_locked && !table_pool->opt_flushing) {
table_pool->opt_total_open--;
/* Table will be closed below: */
if (table_pool->opt_total_open > 0)
if (table_pool->opt_total_open > 1)
flush_table = FALSE;
}
else {
......@@ -1151,13 +1164,20 @@ xtPublic void xt_db_return_table_to_pool_ns(XTOpenTablePtr ot)
ot = NULL;
}
if (ot) {
xt_unlock_mutex_ns(&db->db_ot_pool.opt_lock);
xt_close_table(ot, flush_table, FALSE);
/* assume that table_pool cannot be invalidated in between as we have table_pool->opt_total_open > 0 */
xt_lock_mutex_ns(&db->db_ot_pool.opt_lock);
table_pool->opt_total_open--;
}
db_free_open_table_pool(NULL, table_pool);
if (!xt_broadcast_cond_ns(&db->db_ot_pool.opt_cond))
goto failed;
xt_unlock_mutex_ns(&db->db_ot_pool.opt_lock);
if (ot)
xt_close_table(ot, flush_table, FALSE);
return;
......
This diff is collapsed.
......@@ -137,6 +137,7 @@ class XTDDColumnRef : public XTObject {
return new_obj;
}
virtual void init(XTThreadPtr self) { XTObject::init(self); }
virtual void init(XTThreadPtr self, XTObject *obj);
virtual void finalize(XTThreadPtr self);
};
......@@ -156,6 +157,7 @@ class XTDDConstraint : public XTObject {
co_ind_name(NULL) {
}
virtual void init(XTThreadPtr self) { XTObject::init(self); }
virtual void init(XTThreadPtr self, XTObject *obj);
virtual void finalize(XTThreadPtr self) {
if (co_name)
......@@ -169,6 +171,7 @@ class XTDDConstraint : public XTObject {
virtual void alterColumnName(XTThreadPtr self, char *from_name, char *to_name);
void getColumnList(char *buffer, size_t size);
bool sameColumns(XTDDConstraint *co);
bool samePrefixColumns(XTDDConstraint *co);
bool attachColumns();
};
......@@ -198,6 +201,7 @@ class XTDDIndex : public XTDDConstraint {
return new_obj;
}
virtual void init(XTThreadPtr self) { XTDDConstraint::init(self); };
virtual void init(XTThreadPtr self, XTObject *obj);
struct XTIndex *getIndexPtr();
};
......@@ -230,12 +234,14 @@ class XTDDForeignKey : public XTDDIndex {
return new_obj;
}
virtual void init(XTThreadPtr self) { XTDDIndex::init(self); }
virtual void init(XTThreadPtr self, XTObject *obj);
virtual void finalize(XTThreadPtr self);
virtual void loadString(XTThreadPtr self, XTStringBufferPtr sb);
void getReferenceList(char *buffer, size_t size);
struct XTIndex *getReferenceIndexPtr();
bool sameReferenceColumns(XTDDConstraint *co);
bool samePrefixReferenceColumns(XTDDConstraint *co);
bool checkReferencedTypes(XTDDTable *dt);
void removeReference(XTThreadPtr self);
bool insertRow(xtWord1 *before, xtWord1 *after, XTThreadPtr thread);
......@@ -284,7 +290,7 @@ class XTDDTable : public XTObject {
XTDDIndex *findReferenceIndex(XTDDForeignKey *fk);
bool insertRow(struct XTOpenTable *rec_ot, xtWord1 *buffer);
bool checkNoAction(struct XTOpenTable *ot, xtRecordID rec_id);
xtBool checkCanDrop();
xtBool checkCanDrop(xtBool drop_db);
bool deleteRow(struct XTOpenTable *rec_ot, xtWord1 *buffer);
void deleteAllRows(XTThreadPtr self);
bool updateRow(struct XTOpenTable *rec_ot, xtWord1 *before, xtWord1 *after);
......
This diff is collapsed.
......@@ -183,8 +183,8 @@ typedef struct XTSeqLogRead {
virtual xtBool sl_rnd_read(xtLogOffset log_offset, size_t size, xtWord1 *data, size_t *read, struct XTThread *thread) {
(void) log_offset; (void) size; (void) data; (void) read; (void) thread; return OK;
};
virtual xtBool sl_seq_next(XTXactLogBufferDPtr *entry, xtBool verify, struct XTThread *thread) {
(void) entry; (void) verify; (void) thread; return OK;
virtual xtBool sl_seq_next(XTXactLogBufferDPtr *entry, struct XTThread *thread) {
(void) entry; (void) thread; return OK;
};
virtual void sl_seq_skip(size_t size) { (void) size; }
} XTSeqLogReadRec, *XTSeqLogReadPtr;
......@@ -195,6 +195,7 @@ typedef struct XTDataSeqRead : public XTSeqLogRead {
xtLogOffset sl_rec_log_offset; /* The current log read position. */
size_t sl_record_len; /* The length of the current record. */
xtLogOffset sl_log_eof;
xtLogOffset sl_extra_garbage; /* Garbage found during a scan. */
size_t sl_buffer_size; /* Size of the buffer. */
xtLogOffset sl_buf_log_offset; /* File offset of the buffer. */
......@@ -208,7 +209,7 @@ typedef struct XTDataSeqRead : public XTSeqLogRead {
virtual void sl_seq_pos(xtLogID *log_id, xtLogOffset *log_offset);
virtual xtBool sl_seq_start(xtLogID log_id, xtLogOffset log_offset, xtBool missing_ok);
virtual xtBool sl_rnd_read(xtLogOffset log_offset, size_t size, xtWord1 *data, size_t *read, struct XTThread *thread);
virtual xtBool sl_seq_next(XTXactLogBufferDPtr *entry, xtBool verify, struct XTThread *thread);
virtual xtBool sl_seq_next(XTXactLogBufferDPtr *entry, struct XTThread *thread);
virtual void sl_seq_skip(size_t size);
virtual void sl_seq_skip_to(off_t offset);
} XTDataSeqReadRec, *XTDataSeqReadPtr;
......
......@@ -1282,9 +1282,11 @@ warn:
#endif // LOCK_OPEN_HACK_REQUIRED
//------------------------------
int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *name, DT_FIELD_INFO *info, DT_KEY_INFO *keys __attribute__((unused)), xtBool skip_existing)
int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *name, DT_FIELD_INFO *info, DT_KEY_INFO *XT_UNUSED(keys), xtBool skip_existing)
{
#ifdef DRIZZLED
drizzled::message::Table table_proto;
static const char *ext = ".dfe";
static const int ext_len = 4;
#else
......@@ -1329,8 +1331,7 @@ int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *
info->field_flags,
COLUMN_FORMAT_TYPE_FIXED,
NULL /*default_value*/, NULL /*on_update_value*/, &comment, NULL /*change*/,
NULL /*interval_list*/, info->field_charset,
NULL /*vcol_info*/))
NULL /*interval_list*/, info->field_charset))
#else
if (add_field_to_list(thd, &field_name, info->field_type, field_length_ptr, info->field_decimal_length,
info->field_flags,
......@@ -1365,7 +1366,10 @@ int xt_create_table_frm(handlerton *hton, THD* thd, const char *db, const char *
/* Create an internal temp table */
#ifdef DRIZZLED
if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &mylex.alter_info, 1, 0, false))
table_proto.set_name(name);
table_proto.set_type(drizzled::message::Table::STANDARD);
if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &table_proto, &mylex.alter_info, 1, 0, false))
goto error;
#else
if (mysql_create_table_no_lock(thd, db, name, &mylex.create_info, &mylex.alter_info, 1, 0))
......
This diff is collapsed.
......@@ -76,13 +76,60 @@ xtBool xt_fs_rename(struct XTThread *self, char *from_path, char *to_path);
#define XT_NULL_FD (-1)
#endif
/* Note, this lock must be re-entrant,
* The only lock that satifies this is
* FILE_MAP_USE_RWMUTEX!
*
* 20.05.2009: This problem should be fixed now with mf_slock_count!
*
* The lock need no longer be re-entrant
*/
#ifdef XT_NO_ATOMICS
#define FILE_MAP_USE_PTHREAD_RW
#else
//#define FILE_MAP_USE_RWMUTEX
//#define FILE_MAP_USE_PTHREAD_RW
//#define IDX_USE_SPINXSLOCK
#define FILE_MAP_USE_XSMUTEX
#endif
#ifdef FILE_MAP_USE_XSMUTEX
#define FILE_MAP_LOCK_TYPE XTXSMutexRec
#define FILE_MAP_INIT_LOCK(s, i) xt_xsmutex_init_with_autoname(s, i)
#define FILE_MAP_FREE_LOCK(s, i) xt_xsmutex_free(s, i)
#define FILE_MAP_READ_LOCK(i, o) xt_xsmutex_slock(i, o)
#define FILE_MAP_WRITE_LOCK(i, o) xt_xsmutex_xlock(i, o)
#define FILE_MAP_UNLOCK(i, o) xt_xsmutex_unlock(i, o)
#elif defined(FILE_MAP_USE_PTHREAD_RW)
#define FILE_MAP_LOCK_TYPE xt_rwlock_type
#define FILE_MAP_INIT_LOCK(s, i) xt_init_rwlock(s, i)
#define FILE_MAP_FREE_LOCK(s, i) xt_free_rwlock(i)
#define FILE_MAP_READ_LOCK(i, o) xt_slock_rwlock_ns(i)
#define FILE_MAP_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(i)
#define FILE_MAP_UNLOCK(i, o) xt_unlock_rwlock_ns(i)
#elif defined(FILE_MAP_USE_RWMUTEX)
#define FILE_MAP_LOCK_TYPE XTRWMutexRec
#define FILE_MAP_INIT_LOCK(s, i) xt_rwmutex_init_with_autoname(s, i)
#define FILE_MAP_FREE_LOCK(s, i) xt_rwmutex_free(s, i)
#define FILE_MAP_READ_LOCK(i, o) xt_rwmutex_slock(i, o)
#define FILE_MAP_WRITE_LOCK(i, o) xt_rwmutex_xlock(i, o)
#define FILE_MAP_UNLOCK(i, o) xt_rwmutex_unlock(i, o)
#elif defined(FILE_MAP_USE_SPINXSLOCK)
#define FILE_MAP_LOCK_TYPE XTSpinXSLockRec
#define FILE_MAP_INIT_LOCK(s, i) xt_spinxslock_init_with_autoname(s, i)
#define FILE_MAP_FREE_LOCK(s, i) xt_spinxslock_free(s, i)
#define FILE_MAP_READ_LOCK(i, o) xt_spinxslock_slock(i, o)
#define FILE_MAP_WRITE_LOCK(i, o) xt_spinxslock_xlock(i, o)
#define FILE_MAP_UNLOCK(i, o) xt_spinxslock_unlock(i, o)
#endif
typedef struct XTFileMemMap {
xtWord1 *mm_start; /* The in-memory start of the map. */
#ifdef XT_WIN
HANDLE mm_mapdes;
#endif
off_t mm_length; /* The length of the file map. */
XTRWMutexRec mm_lock; /* The file map R/W lock. */
FILE_MAP_LOCK_TYPE mm_lock; /* The file map R/W lock. */
size_t mm_grow_size; /* The amount by which the map file is increased. */
} XTFileMemMapRec, *XTFileMemMapPtr;
......@@ -127,6 +174,9 @@ xtBool xt_pwrite_file(XTOpenFilePtr of, off_t offset, size_t size, void *data,
xtBool xt_pread_file(XTOpenFilePtr of, off_t offset, size_t size, size_t min_size, void *data, size_t *red_size, struct XTIOStats *timer, struct XTThread *thread);
xtBool xt_flush_file(XTOpenFilePtr of, struct XTIOStats *timer, struct XTThread *thread);
xtBool xt_lock_file_ptr(XTOpenFilePtr of, xtWord1 **data, off_t offset, size_t size, struct XTIOStats *timer, struct XTThread *thread);
void xt_unlock_file_ptr(XTOpenFilePtr of, xtWord1 *data, struct XTThread *thread);
typedef struct XTOpenDir {
char *od_path;
#ifdef XT_WIN
......@@ -134,8 +184,14 @@ typedef struct XTOpenDir {
WIN32_FIND_DATA od_data;
#else
char *od_filter;
struct dirent od_entry;
DIR *od_dir;
/* WARNING: Solaris requires od_entry.d_name member to have size at least as returned
* by pathconf() function on per-directory basis. This makes it impossible to statically
* pre-set the size. So xt_dir_open on Solaris dynamically allocates space as needed.
*
* This also means that the od_entry member should always be last in the XTOpenDir structure.
*/
struct dirent od_entry;
#endif
} XTOpenDirRec, *XTOpenDirPtr;
......@@ -147,6 +203,7 @@ xtBool xt_dir_is_file(struct XTThread *self, XTOpenDirPtr od);
off_t xt_dir_file_size(struct XTThread *self, XTOpenDirPtr od);
typedef struct XTMapFile : public XTFileRef {
u_int mf_slock_count;
XTFileMemMapPtr mf_memmap;
} XTMapFileRec, *XTMapFilePtr;
......
This diff is collapsed.
......@@ -28,7 +28,7 @@
#ifdef DRIZZLED
#include <drizzled/common.h>
#include <drizzled/handler.h>
#include <drizzled/handlerton.h>
#include <drizzled/plugin/storage_engine.h>
#include <mysys/thr_lock.h>
#else
#include "mysql_priv.h"
......@@ -51,6 +51,25 @@
class ha_pbxt;
#ifdef DRIZZLED
class PBXTStorageEngine : public StorageEngine {
public:
PBXTStorageEngine(std::string name_arg)
: StorageEngine(name_arg, HTON_NO_FLAGS) {}
/* override */ int close_connection(Session *);
/* override */ int commit(Session *, bool);
/* override */ int rollback(Session *, bool);
/* override */ handler *create(TABLE_SHARE *, MEM_ROOT *);
/* override */ void drop_database(char *);
/* override */ bool show_status(Session *, stat_print_fn *, enum ha_stat_type);
};
typedef PBXTStorageEngine handlerton;
#endif
extern handlerton *pbxt_hton;
/*
......
......@@ -75,7 +75,7 @@ const char **ha_xtsys::bas_ext() const
return ha_pbms_exts;
}
int ha_xtsys::open(const char *table_path, int mode __attribute__((unused)), uint test_if_locked __attribute__((unused)))
int ha_xtsys::open(const char *table_path, int XT_UNUSED(mode), uint XT_UNUSED(test_if_locked))
{
THD *thd = current_thd;
XTExceptionRec e;
......@@ -141,7 +141,7 @@ int ha_xtsys::close(void)
return err;
}
int ha_xtsys::rnd_init(bool scan __attribute__((unused)))
int ha_xtsys::rnd_init(bool XT_UNUSED(scan))
{
int err = 0;
......@@ -185,7 +185,7 @@ int ha_xtsys::rnd_pos(byte * buf, byte *pos)
return err;
}
int ha_xtsys::info(uint flag __attribute__((unused)))
int ha_xtsys::info(uint XT_UNUSED(flag))
{
return 0;
}
......@@ -211,7 +211,7 @@ int ha_xtsys::external_lock(THD *thd, int lock_type)
return err;
}
THR_LOCK_DATA **ha_xtsys::store_lock(THD *thd __attribute__((unused)), THR_LOCK_DATA **to, enum thr_lock_type lock_type)
THR_LOCK_DATA **ha_xtsys::store_lock(THD *XT_UNUSED(thd), THR_LOCK_DATA **to, enum thr_lock_type lock_type)
{
if (lock_type != TL_IGNORE && ha_lock.type == TL_UNLOCK)
ha_lock.type = lock_type;
......@@ -220,13 +220,13 @@ THR_LOCK_DATA **ha_xtsys::store_lock(THD *thd __attribute__((unused)), THR_LOCK_
}
/* Note: ha_pbxt::delete_system_table is called instead. */
int ha_xtsys::delete_table(const char *table_path __attribute__((unused)))
int ha_xtsys::delete_table(const char *XT_UNUSED(table_path))
{
/* Should never be called */
return 0;
}
int ha_xtsys::create(const char *name __attribute__((unused)), TABLE *table_arg __attribute__((unused)), HA_CREATE_INFO *create_info __attribute__((unused)))
int ha_xtsys::create(const char *XT_UNUSED(name), TABLE *XT_UNUSED(table_arg), HA_CREATE_INFO *XT_UNUSED(create_info))
{
/* Allow the table to be created.
* This is required after a dump is restored.
......@@ -234,7 +234,7 @@ int ha_xtsys::create(const char *name __attribute__((unused)), TABLE *table_arg
return 0;
}
bool ha_xtsys::get_error_message(int error __attribute__((unused)), String *buf)
bool ha_xtsys::get_error_message(int XT_UNUSED(error), String *buf)
{
THD *thd = current_thd;
XTExceptionRec e;
......
......@@ -59,7 +59,7 @@ public:
const char *table_type() const { return "PBXT"; }
const char *index_type(uint inx __attribute__((unused))) {
const char *index_type(uint XT_UNUSED(inx)) {
return "NONE";
}
......@@ -69,7 +69,7 @@ public:
return HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE;
}
MX_ULONG_T index_flags(uint inx __attribute__((unused)), uint part __attribute__((unused)), bool all_parts __attribute__((unused))) const {
MX_ULONG_T index_flags(uint XT_UNUSED(inx), uint XT_UNUSED(part), bool XT_UNUSED(all_parts)) const {
return (HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE | HA_KEYREAD_ONLY);
}
uint max_supported_keys() const { return 512; }
......
......@@ -115,7 +115,7 @@ xtPublic void xt_ht_put(XTThreadPtr self, XTHashTabPtr ht, void *data)
popr_();
}
xtPublic void *xt_ht_get(XTThreadPtr self __attribute__((unused)), XTHashTabPtr ht, void *key)
xtPublic void *xt_ht_get(XTThreadPtr XT_UNUSED(self), XTHashTabPtr ht, void *key)
{
XTHashItemPtr item;
xtHashValue h;
......@@ -239,14 +239,14 @@ xtPublic void xt_ht_signal(XTThreadPtr self, XTHashTabPtr ht)
xt_signal_cond(self, ht->ht_cond);
}
xtPublic void xt_ht_enum(struct XTThread *self __attribute__((unused)), XTHashTabPtr ht, XTHashEnumPtr en)
xtPublic void xt_ht_enum(struct XTThread *XT_UNUSED(self), XTHashTabPtr ht, XTHashEnumPtr en)
{
en->he_i = 0;
en->he_item = NULL;
en->he_ht = ht;
}
xtPublic void *xt_ht_next(struct XTThread *self __attribute__((unused)), XTHashEnumPtr en)
xtPublic void *xt_ht_next(struct XTThread *XT_UNUSED(self), XTHashEnumPtr en)
{
if (en->he_item) {
en->he_item = en->he_item->hi_next;
......
......@@ -31,7 +31,7 @@
#undef xt_heap_new
#endif
#ifdef DEBUG
#ifdef DEBUG_MEMORY
xtPublic XTHeapPtr xt_mm_heap_new(XTThreadPtr self, size_t size, XTFinalizeFunc finalize, u_int line, c_char *file, xtBool track)
#else
xtPublic XTHeapPtr xt_heap_new(XTThreadPtr self, size_t size, XTFinalizeFunc finalize)
......@@ -39,7 +39,7 @@ xtPublic XTHeapPtr xt_heap_new(XTThreadPtr self, size_t size, XTFinalizeFunc fin
{
volatile XTHeapPtr hp;
#ifdef DEBUG
#ifdef DEBUG_MEMORY
hp = (XTHeapPtr) xt_mm_calloc(self, size, line, file);
hp->h_track = track;
if (track)
......@@ -65,21 +65,21 @@ xtPublic XTHeapPtr xt_heap_new(XTThreadPtr self, size_t size, XTFinalizeFunc fin
return hp;
}
xtPublic void xt_check_heap(XTThreadPtr self __attribute__((unused)), XTHeapPtr hp __attribute__((unused)))
xtPublic void xt_check_heap(XTThreadPtr XT_NDEBUG_UNUSED(self), XTHeapPtr XT_NDEBUG_UNUSED(hp))
{
#ifdef DEBUG
#ifdef DEBUG_MEMORY
xt_mm_malloc_size(self, hp);
#endif
}
#ifdef DEBUG
#ifdef DEBUG_MEMORY
xtPublic void xt_mm_heap_reference(XTThreadPtr self, XTHeapPtr hp, u_int line, c_char *file)
#else
xtPublic void xt_heap_reference(XTThreadPtr, XTHeapPtr hp)
#endif
{
xt_spinlock_lock(&hp->h_lock);
#ifdef DEBUG
#ifdef DEBUG_MEMORY
if (hp->h_track)
printf("HEAP: +1 %d->%d %s:%d\n", (int) hp->h_ref_count, (int) hp->h_ref_count+1, file, (int) line);
#endif
......@@ -91,7 +91,7 @@ xtPublic void xt_heap_release(XTThreadPtr self, XTHeapPtr hp)
{
if (!hp)
return;
#ifdef DEBUG
#ifdef DEBUG_MEMORY
xt_spinlock_lock(&hp->h_lock);
ASSERT(hp->h_ref_count != 0);
xt_spinlock_unlock(&hp->h_lock);
......@@ -100,7 +100,7 @@ xtPublic void xt_heap_release(XTThreadPtr self, XTHeapPtr hp)
if (hp->h_onrelease)
(*hp->h_onrelease)(self, hp);
if (hp->h_ref_count > 0) {
#ifdef DEBUG
#ifdef DEBUG_MEMORY
if (hp->h_track)
printf("HEAP: -1 %d->%d\n", (int) hp->h_ref_count, (int) hp->h_ref_count-1);
#endif
......@@ -116,12 +116,12 @@ xtPublic void xt_heap_release(XTThreadPtr self, XTHeapPtr hp)
xt_spinlock_unlock(&hp->h_lock);
}
xtPublic void xt_heap_set_release_callback(XTThreadPtr self __attribute__((unused)), XTHeapPtr hp, XTFinalizeFunc onrelease)
xtPublic void xt_heap_set_release_callback(XTThreadPtr XT_UNUSED(self), XTHeapPtr hp, XTFinalizeFunc onrelease)
{
hp->h_onrelease = onrelease;
}
xtPublic u_int xt_heap_get_ref_count(struct XTThread *self __attribute__((unused)), XTHeapPtr hp)
xtPublic u_int xt_heap_get_ref_count(struct XTThread *XT_UNUSED(self), XTHeapPtr hp)
{
return hp->h_ref_count;
}
......
......@@ -25,6 +25,7 @@
#include "xt_defs.h"
#include "lock_xt.h"
#include "memory_xt.h"
struct XTThread;
......@@ -59,7 +60,7 @@ u_int xt_heap_get_ref_count(struct XTThread *self, XTHeapPtr mem);
void xt_check_heap(struct XTThread *self, XTHeapPtr mem);
#ifdef DEBUG
#ifdef DEBUG_MEMORY
#define xt_heap_new(t, s, f) xt_mm_heap_new(t, s, f, __LINE__, __FILE__, FALSE)
#define xt_heap_new_track(t, s, f) xt_mm_heap_new(t, s, f, __LINE__, __FILE__, TRUE)
#define xt_heap_reference(t, s) xt_mm_heap_reference(t, s, __LINE__, __FILE__)
......
This diff is collapsed.
......@@ -24,6 +24,7 @@
#define __xt_index_h__
#ifdef DRIZZLED
#include <drizzled/definitions.h>
#include <mysys/my_bitmap.h>
#else
#include <mysql_version.h>
......@@ -34,7 +35,6 @@
#include "linklist_xt.h"
#include "datalog_xt.h"
#include "datadic_xt.h"
//#include "cache_xt.h"
#ifndef MYSQL_VERSION_ID
#error MYSQL_VERSION_ID must be defined!
......@@ -109,7 +109,7 @@ class Field;
#define XT_MAX_RECORD_REF_SIZE 8
#define XT_INDEX_PAGE_DATA_SIZE XT_INDEX_PAGE_SIZE - 2 /* NOTE: 2 == offsetof(XTIdxBranchDRec, tb_data) */
#define XT_INDEX_PAGE_DATA_SIZE (XT_INDEX_PAGE_SIZE - 2) /* NOTE: 2 == offsetof(XTIdxBranchDRec, tb_data) */
#define XT_MAKE_LEAF_SIZE(x) ((x) + offsetof(XTIdxBranchDRec, tb_data))
......@@ -218,7 +218,7 @@ typedef struct XTIndFreeList {
* in 32 threads on smalltab: runTest(SMALL_INSERT_TEST, 32, dbUrl)
*/
/*
* XT_INDEX_USE_RW_MUTEX:
* XT_INDEX_USE_RWMUTEX:
* But the RW mutex is a close second, if not just as fast.
* If it is at least as fast, then it is better because read lock
* overhead is then zero.
......@@ -240,17 +240,24 @@ typedef struct XTIndFreeList {
* Latest test show that RW mutex is slightly faster:
* 127460 to 123574 payment transactions.
*/
#define XT_INDEX_USE_RW_MUTEX
#ifdef XT_NO_ATOMICS
#define XT_INDEX_USE_PTHREAD_RW
#else
//#define XT_INDEX_USE_RWMUTEX
//#define XT_INDEX_USE_PTHREAD_RW
//#define XT_INDEX_SPINXSLOCK
#define XT_TAB_ROW_USE_XSMUTEX
#endif
#ifdef XT_INDEX_USE_FASTWRLOCK
#define XT_INDEX_LOCK_TYPE XTFastRWLockRec
#define XT_INDEX_INIT_LOCK(s, i) xt_fastrwlock_init(s, &(i)->mi_rwlock)
#define XT_INDEX_FREE_LOCK(s, i) xt_fastrwlock_free(s, &(i)->mi_rwlock)
#define XT_INDEX_READ_LOCK(i, o) xt_fastrwlock_slock(&(i)->mi_rwlock, (o)->ot_thread)
#define XT_INDEX_WRITE_LOCK(i, o) xt_fastrwlock_xlock(&(i)->mi_rwlock, (o)->ot_thread)
#define XT_INDEX_UNLOCK(i, o) xt_fastrwlock_unlock(&(i)->mi_rwlock, (o)->ot_thread)
#define XT_INDEX_HAVE_XLOCK(i, o) TRUE
#ifdef XT_TAB_ROW_USE_XSMUTEX
#define XT_INDEX_LOCK_TYPE XTXSMutexRec
#define XT_INDEX_INIT_LOCK(s, i) xt_xsmutex_init_with_autoname(s, &(i)->mi_rwlock)
#define XT_INDEX_FREE_LOCK(s, i) xt_xsmutex_free(s, &(i)->mi_rwlock)
#define XT_INDEX_READ_LOCK(i, o) xt_xsmutex_slock(&(i)->mi_rwlock, (o)->ot_thread->t_id)
#define XT_INDEX_WRITE_LOCK(i, o) xt_xsmutex_xlock(&(i)->mi_rwlock, (o)->ot_thread->t_id)
#define XT_INDEX_UNLOCK(i, o) xt_xsmutex_unlock(&(i)->mi_rwlock, (o)->ot_thread->t_id)
#define XT_INDEX_HAVE_XLOCK(i, o) ((i)->sxs_xlocker == (o)->ot_thread->t_id)
#elif defined(XT_INDEX_USE_PTHREAD_RW)
#define XT_INDEX_LOCK_TYPE xt_rwlock_type
#define XT_INDEX_INIT_LOCK(s, i) xt_init_rwlock_with_autoname(s, &(i)->mi_rwlock)
......@@ -259,7 +266,15 @@ typedef struct XTIndFreeList {
#define XT_INDEX_WRITE_LOCK(i, o) xt_xlock_rwlock_ns(&(i)->mi_rwlock)
#define XT_INDEX_UNLOCK(i, o) xt_unlock_rwlock_ns(&(i)->mi_rwlock)
#define XT_INDEX_HAVE_XLOCK(i, o) TRUE
#else // XT_INDEX_USE_RW_MUTEX
#elif defined(XT_INDEX_SPINXSLOCK)
#define XT_INDEX_LOCK_TYPE XTSpinXSLockRec
#define XT_INDEX_INIT_LOCK(s, i) xt_spinxslock_init_with_autoname(s, &(i)->mi_rwlock)
#define XT_INDEX_FREE_LOCK(s, i) xt_spinxslock_free(s, &(i)->mi_rwlock)
#define XT_INDEX_READ_LOCK(i, o) xt_spinxslock_slock(&(i)->mi_rwlock, (o)->ot_thread->t_id)
#define XT_INDEX_WRITE_LOCK(i, o) xt_spinxslock_xlock(&(i)->mi_rwlock, (o)->ot_thread->t_id)
#define XT_INDEX_UNLOCK(i, o) xt_spinxslock_unlock(&(i)->mi_rwlock, (o)->ot_thread->t_id)
#define XT_INDEX_HAVE_XLOCK(i, o) ((i)->mi_rwlock.nrw_xlocker == (o)->ot_thread->t_id)
#else // XT_INDEX_USE_RWMUTEX
#define XT_INDEX_LOCK_TYPE XTRWMutexRec
#define XT_INDEX_INIT_LOCK(s, i) xt_rwmutex_init_with_autoname(s, &(i)->mi_rwlock)
#define XT_INDEX_FREE_LOCK(s, i) xt_rwmutex_free(s, &(i)->mi_rwlock)
......@@ -296,15 +311,17 @@ typedef struct XTIndex {
/* Index contants: */
u_int mi_flags;
u_int mi_key_size;
u_int mi_max_items; /* The maximum number of items that can fit in a leaf node. */
xtBool mi_low_byte_first;
xtBool mi_fix_key;
xtBool mi_lazy_delete; /* TRUE if index entries are "lazy deleted". */
u_int mi_single_type; /* Used when the index contains a single field. */
u_int mi_select_total;
XTScanBranchFunc mi_scan_branch;
XTPrevItemFunc mi_prev_item;
XTLastItemFunc mi_last_item;
XTSimpleCompFunc mi_simple_comp_key;
MY_BITMAP mi_col_map; /* Bit-map of columns in the index. */
MX_BITMAP mi_col_map; /* Bit-map of columns in the index. */
u_int mi_subset_of; /* Indicates if this index is a complete subset of someother index. */
u_int mi_seg_count;
XTIndexSegRec mi_seg[200];
......@@ -344,6 +361,7 @@ typedef struct XTDictionary {
Field **dic_blob_cols;
/* MySQL related information. NULL when no tables are open from MySQL side! */
xtBool dic_no_lazy_delete; /* FALSE if lazy delete is OK. */
u_int dic_disable_index; /* Non-zero if the index cannot be used. */
u_int dic_index_ver; /* The version of the index. */
u_int dic_key_count;
......@@ -462,6 +480,8 @@ xtBool xt_idx_prev(register struct XTOpenTable *ot, register struct XTIndex *ind
xtBool xt_idx_read(struct XTOpenTable *ot, struct XTIndex *ind, xtWord1 *rec_buf);
void xt_ind_set_index_selectivity(XTThreadPtr self, struct XTOpenTable *ot);
void xt_check_indices(struct XTOpenTable *ot);
void xt_load_indices(XTThreadPtr self, struct XTOpenTable *ot);
void xt_ind_count_deleted_items(struct XTTable *ot, struct XTIndex *ind, struct XTIndBlock *block);
xtBool xt_flush_indices(struct XTOpenTable *ot, off_t *bytes_flushed, xtBool have_table_lock);
void xt_ind_track_dump_block(struct XTTable *tab, xtIndexNodeID address);
......@@ -482,6 +502,7 @@ void xt_prev_branch_item_var(struct XTTable *tab, XTIndexPtr ind, XTIdxBranchDPt
void xt_last_branch_item_fix(struct XTTable *tab, XTIndexPtr ind, XTIdxBranchDPtr branch, register XTIdxResultPtr result);
void xt_last_branch_item_var(struct XTTable *tab, XTIndexPtr ind, XTIdxBranchDPtr branch, register XTIdxResultPtr result);
xtBool xt_idx_lazy_delete_on_leaf(XTIndexPtr ind, struct XTIndBlock *block, xtWord2 branch_size);
//#define TRACK_ACTIVITY
#ifdef TRACK_ACTIVITY
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -30,6 +30,10 @@
struct XTThread;
#ifdef DEBUG
#define DEBUG_MEMORY
#endif
#ifdef DEBUG_MEMORY
#define XT_MM_STACK_TRACE 200
#define XT_MM_TRACE_DEPTH 4
......@@ -109,7 +113,7 @@ void xt_free_ns(void *ptr);
#endif
#ifdef DEBUG
#ifdef DEBUG_MEMORY
#define xt_dup_string(t, s) xt_mm_dup_string(t, s, __LINE__, __FILE__)
char *xt_mm_dup_string(struct XTThread *self, const char *path, u_int line, const char *file);
......
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.
......@@ -131,4 +131,6 @@ xtWord8 xt_bytes_since_last_checkpoint(struct XTDatabase *db, xtLogID curr_log_i
void xt_print_log_record(xtLogID log, off_t offset, XTXactLogBufferDPtr record);
void xt_dump_xlogs(struct XTDatabase *db, xtLogID start_log);
xtPublic void xt_xres_start_database_recovery(XTThreadPtr self, const char *path);
#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.
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