Commit 6c610ed9 authored by Michael Widenius's avatar Michael Widenius

Fixed build issues

- Linking now with g++ instead of gcc with 'compile-dist' to solve problems with handlersocket/client
- Fixed bug in heap tables when doing handler read next-prev over last row


BUILD/compile-dist:
  - Linking now with g++ instead of gcc with 'compile-dist' to solve problems with handlersocket/client
cmd-line-utils/libedit/vi.c:
  Fixed compiler warning about not checking return value for write
mysql-test/r/index_intersect.result:
  Updated results (missed this file in my last push)
mysql-test/suite/handler/aria.result:
  Updated test results
mysql-test/suite/handler/handler.inc:
  Changed test to use read next/read prev on key where there are duplicates that can come in different order depending on system
  Added testing of read next-prev over last row and read prev-next around first row
mysql-test/suite/handler/heap.result:
  Updated test results
mysql-test/suite/handler/init.inc:
  More rows to test
mysql-test/suite/handler/innodb.result:
  Updated test results
mysql-test/suite/handler/interface.result:
  Updated test results
mysql-test/suite/handler/myisam.result:
  Updated test results
mysql-test/t/variables-big.test:
  Fixed test to not fail on windows
mysql-test/valgrind.supp:
  Removed not matching fun: to get rid of valgrind warning
storage/heap/hp_rfirst.c:
  Added state so that we know if we have an active position in the index.
storage/heap/hp_rkey.c:
  Added state so that we know if we have an active position in the index.
storage/heap/hp_rnext.c:
  Handle reading several next after finding the last row (this caused a crash before)
storage/heap/hp_rprev.c:
  Handle reading several prev after finding the first row (this caused a crash before)
storage/xtradb/buf/buf0buf.c:
  Fixed compiler warning about uninitialized value
parent 39616eb9
......@@ -28,7 +28,7 @@ fi
# Default to gcc for CC and CXX
if test -z "$CXX" ; then
export CXX
CXX=gcc
CXX=g++
# Set some required compile options
if test -z "$CXXFLAGS" ; then
export CXXFLAGS
......
......@@ -1012,8 +1012,13 @@ vi_histedit(EditLine *el, int c __attribute__((__unused__)))
if (fd < 0)
return CC_ERROR;
cp = el->el_line.buffer;
write(fd, cp, el->el_line.lastchar - cp +0u);
write(fd, "\n", 1);
if (write(fd, cp, el->el_line.lastchar - cp +0u) == -1 ||
write(fd, "\n", 1) == -1)
{
close(fd);
unlink(tempfile);
return CC_ERROR;
}
pid = fork();
switch (pid) {
case -1:
......
......@@ -64,22 +64,22 @@ EXPLAIN
SELECT * FROM City WHERE
Name LIKE 'C%' AND Population > 1000000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge Population,Name Name,Population 35,4 NULL 9 Using sort_intersect(Name,Population); Using where
1 SIMPLE City index_merge Population,Name Name,Population 35,4 NULL # Using sort_intersect(Name,Population); Using where
EXPLAIN
SELECT * FROM City WHERE
Name LIKE 'M%' AND Population > 1500000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge Population,Name Population,Name 4,35 NULL 5 Using sort_intersect(Population,Name); Using where
1 SIMPLE City index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where
EXPLAIN
SELECT * FROM City
WHERE Name LIKE 'M%' AND Population > 300000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range Population,Name Name 35 NULL 164 Using index condition; Using where; Using MRR
1 SIMPLE City range Population,Name Name 35 NULL # Using index condition; Using where; Using MRR
EXPLAIN
SELECT * FROM City
WHERE Name LIKE 'M%' AND Population > 7000000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range Population,Name Population 4 NULL 15 Using index condition; Using where; Using MRR
1 SIMPLE City range Population,Name Population 4 NULL # Using index condition; Using where; Using MRR
SELECT * FROM City USE INDEX ()
WHERE Name LIKE 'C%' AND Population > 1000000;
ID Name Country Population
......@@ -361,17 +361,17 @@ EXPLAIN
SELECT * FROM City
WHERE Name BETWEEN 'M' AND 'N' AND Population > 1000000 AND Country LIKE 'C%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge Population,Country,Name Name,Population 35,4 NULL 9 Using sort_intersect(Name,Population); Using where
1 SIMPLE City index_merge Population,Country,Name Name,Population 35,4 NULL # Using sort_intersect(Name,Population); Using where
EXPLAIN
SELECT * FROM City
WHERE Name BETWEEN 'G' AND 'J' AND Population > 1000000 AND Country LIKE 'B%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge Population,Country,Name Population,Country 4,3 NULL 19 Using sort_intersect(Population,Country); Using where
1 SIMPLE City index_merge Population,Country,Name Population,Country 4,3 NULL # Using sort_intersect(Population,Country); Using where
EXPLAIN
SELECT * FROM City
WHERE Name BETWEEN 'G' AND 'K' AND Population > 500000 AND Country LIKE 'C%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range Population,Country,Name Name 35 NULL 283 Using index condition; Using where; Using MRR
1 SIMPLE City range Population,Country,Name Name 35 NULL # Using index condition; Using where; Using MRR
SELECT * FROM City USE INDEX ()
WHERE Name BETWEEN 'M' AND 'N' AND Population > 1000000 AND Country LIKE 'C%';
ID Name Country Population
......@@ -462,29 +462,29 @@ EXPLAIN
SELECT * FROM City
WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL 359 Using index condition; Using where; Using MRR
1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL # Using index condition; Using where; Using MRR
EXPLAIN
SELECT * FROM City
WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge PRIMARY,Population,Country Country,Population 3,4 NULL 6 Using sort_intersect(Country,Population); Using where
1 SIMPLE City index_merge PRIMARY,Population,Country Country,Population 3,4 NULL # Using sort_intersect(Country,Population); Using where
EXPLAIN
SELECT * FROM City
WHERE ID BETWEEN 2001 AND 2500 AND Population > 300000 AND Country LIKE 'H%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range PRIMARY,Population,Country Country 3 NULL 21 Using index condition; Using where; Using MRR
1 SIMPLE City range PRIMARY,Population,Country Country 3 NULL # Using index condition; Using where; Using MRR
EXPLAIN
SELECT * FROM City
WHERE ID BETWEEN 3701 AND 4000 AND Population > 1000000
AND Country BETWEEN 'S' AND 'Z';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge PRIMARY,Population,Country Population,PRIMARY 4,4 NULL 17 Using sort_intersect(Population,PRIMARY); Using where
1 SIMPLE City index_merge PRIMARY,Population,Country Population,PRIMARY 4,4 NULL # Using sort_intersect(Population,PRIMARY); Using where
EXPLAIN
SELECT * FROM City
WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000
AND Country BETWEEN 'S' AND 'Z' ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL 429 Using index condition; Using where; Using MRR
1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL # Using index condition; Using where; Using MRR
SELECT * FROM City USE INDEX ()
WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%';
ID Name Country Population
......@@ -718,33 +718,33 @@ EXPLAIN
SELECT * FROM City WHERE
Name LIKE 'C%' AND Population > 1000000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge Population,Name Name,Population 35,4 NULL 9 Using sort_intersect(Name,Population); Using where
1 SIMPLE City index_merge Population,Name Name,Population 35,4 NULL # Using sort_intersect(Name,Population); Using where
EXPLAIN
SELECT * FROM City WHERE
Name LIKE 'M%' AND Population > 1500000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge Population,Name Population,Name 4,35 NULL 5 Using sort_intersect(Population,Name); Using where
1 SIMPLE City index_merge Population,Name Population,Name 4,35 NULL # Using sort_intersect(Population,Name); Using where
EXPLAIN
SELECT * FROM City
WHERE Name BETWEEN 'G' AND 'J' AND Population > 1000000 AND Country LIKE 'B%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge Population,Country,Name Population,Country 4,3 NULL 19 Using sort_intersect(Population,Country); Using where
1 SIMPLE City index_merge Population,Country,Name Population,Country 4,3 NULL # Using sort_intersect(Population,Country); Using where
EXPLAIN
SELECT * FROM City
WHERE Name BETWEEN 'G' AND 'J' AND Population > 500000 AND Country LIKE 'C%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range Population,Country,Name Name 35 NULL 225 Using index condition; Using where; Using MRR
1 SIMPLE City range Population,Country,Name Name 35 NULL # Using index condition; Using where; Using MRR
EXPLAIN
SELECT * FROM City
WHERE ID BETWEEN 1 AND 500 AND Population > 1000000 AND Country LIKE 'A%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge PRIMARY,Population,Country Country,Population 3,4 NULL 6 Using sort_intersect(Country,Population); Using where
1 SIMPLE City index_merge PRIMARY,Population,Country Country,Population 3,4 NULL # Using sort_intersect(Country,Population); Using where
EXPLAIN
SELECT * FROM City
WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000
AND Country BETWEEN 'S' AND 'Z';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL 429 Using index condition; Using where; Using MRR
1 SIMPLE City range PRIMARY,Population,Country Population 4 NULL # Using index condition; Using where; Using MRR
SELECT * FROM City WHERE
Name LIKE 'C%' AND Population > 1000000;
ID Name Country Population
......@@ -885,17 +885,17 @@ EXPLAIN
SELECT * FROM City
WHERE Country LIKE 'M%' AND Population > 1000000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL 15 Using sort_intersect(Population,CountryID); Using where
1 SIMPLE City index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL # Using sort_intersect(Population,CountryID); Using where
EXPLAIN
SELECT * FROM City
WHERE Country='CHN' AND Population > 1500000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL 11 Using sort_intersect(Population,CountryID); Using where
1 SIMPLE City index_merge Population,CountryID,CountryName Population,CountryID 4,3 NULL # Using sort_intersect(Population,CountryID); Using where
EXPLAIN
SELECT * FROM City
WHERE Country='CHN' AND Population > 1500000 AND Name LIKE 'C%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge Population,Name,CountryID,CountryName CountryName,Population 38,4 NULL 1 Using sort_intersect(CountryName,Population); Using where
1 SIMPLE City index_merge Population,Name,CountryID,CountryName CountryName,Population 38,4 NULL # Using sort_intersect(CountryName,Population); Using where
SELECT * FROM City USE INDEX ()
WHERE Country LIKE 'M%' AND Population > 1000000;
ID Name Country Population
......@@ -1028,7 +1028,7 @@ EXPLAIN
SELECT * FROM t1
WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range PRIMARY,f4 f4 35 NULL 5 Using index condition; Using where; Using MRR
1 SIMPLE t1 range PRIMARY,f4 f4 35 NULL # Using index condition; Using where; Using MRR
SELECT * FROM t1
WHERE (f1 < 535 OR f1 > 985) AND ( f4='r' OR f4 LIKE 'a%' ) ;
f1 f4 f5
......
......@@ -4,7 +4,7 @@ create table t1 (a int, b char(10), key a (a), key b (a,b));
insert into t1 values
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
(14,"aaa"),(16,"ccc"),(16,"xxx"),
(20,"ggg"),(21,"hhh"),(22,"iii");
(20,"ggg"),(21,"hhh"),(22,"iii"),(23,"xxx"),(24,"xxx"),(25,"xxx");
handler t1 open as t2;
handler t2 read b first;
a b
......@@ -20,13 +20,13 @@ a b
16 ccc
handler t2 read b last;
a b
22 iii
25 xxx
handler t2 read b prev;
a b
21 hhh
24 xxx
handler t2 read b prev;
a b
20 ggg
23 xxx
handler t2 read b first;
a b
14 aaa
......@@ -34,13 +34,13 @@ handler t2 read b prev;
a b
handler t2 read b last;
a b
22 iii
25 xxx
handler t2 read b prev;
a b
21 hhh
24 xxx
handler t2 read b next;
a b
22 iii
25 xxx
handler t2 read b next;
a b
handler t2 read a=(15);
......@@ -105,10 +105,10 @@ handler t2 read a>(54);
a b
handler t2 read a<=(54);
a b
22 iii
25 xxx
handler t2 read a<(54);
a b
22 iii
25 xxx
handler t2 read a=(1);
a b
handler t2 read a>=(1);
......@@ -158,9 +158,9 @@ a b
18 eee
handler t2 read a last limit 3;
a b
22 iii
21 hhh
20 ggg
25 xxx
24 xxx
23 xxx
handler t2 read b=(16) limit 1,3;
a b
16 xxx
......@@ -191,10 +191,10 @@ handler t1 close;
handler t1 open;
handler t1 read a prev;
a b
22 iii
25 xxx
handler t1 read a prev;
a b
21 hhh
24 xxx
handler t1 close;
handler t1 open as t2;
handler t2 read first;
......@@ -204,53 +204,97 @@ alter table t1 engine = Aria;
handler t2 read first;
ERROR 42S02: Unknown table 't2' in HANDLER
handler t1 open;
handler t1 read a=(16) limit 1,3;
handler t1 read a=(20) limit 1,3;
a b
16 xxx
flush tables;
handler t1 read a=(16) limit 1,3;
handler t1 read a=(20) limit 1,3;
a b
16 xxx
handler t1 close;
handler t1 open;
handler t1 read a=(25);
a b
25 xxx
handler t1 read a next;
a b
handler t1 read a next;
a b
handler t1 read a next;
a b
handler t1 read a prev;
a b
25 xxx
handler t1 read a=(1000);
a b
handler t1 read a next;
a b
handler t1 read a prev;
a b
25 xxx
handler t1 read a=(1000);
a b
handler t1 read a prev;
a b
25 xxx
handler t1 read a=(14);
a b
14 aaa
handler t1 read a prev;
a b
handler t1 read a prev;
a b
handler t1 read a next;
a b
14 aaa
handler t1 read a=(1);
a b
handler t1 read a prev;
a b
handler t1 read a next;
a b
14 aaa
handler t1 read a=(1);
a b
handler t1 read a next;
a b
14 aaa
handler t1 close;
handler t1 open;
prepare stmt from 'handler t1 read a=(?) limit ?,?';
set @a=16,@b=1,@c=100;
set @a=20,@b=1,@c=100;
execute stmt using @a,@b,@c;
a b
16 xxx
set @a=16,@b=2,@c=1;
set @a=20,@b=2,@c=1;
execute stmt using @a,@b,@c;
a b
set @a=16,@b=0,@c=2;
set @a=20,@b=0,@c=2;
execute stmt using @a,@b,@c;
a b
16 ccc
16 xxx
20 ggg
deallocate prepare stmt;
prepare stmt from 'handler t1 read a next limit ?';
handler t1 read a>=(11);
handler t1 read a>=(21);
a b
14 aaa
21 hhh
set @a=3;
execute stmt using @a;
a b
16 ccc
16 xxx
17 ddd
22 iii
23 xxx
24 xxx
execute stmt using @a;
a b
18 eee
19 fff
19 yyy
25 xxx
execute stmt using @a;
a b
20 ggg
21 hhh
22 iii
deallocate prepare stmt;
prepare stmt from 'handler t1 read b prev limit ?';
execute stmt using @a;
a b
25 xxx
24 xxx
23 xxx
execute stmt using @a;
a b
22 iii
21 hhh
20 ggg
......@@ -264,9 +308,6 @@ a b
17 ddd
16 xxx
16 ccc
execute stmt using @a;
a b
14 aaa
deallocate prepare stmt;
prepare stmt from 'handler t1 read b=(?,?)';
set @a=14, @b='aaa';
......@@ -289,27 +330,27 @@ a b
16 xxx
deallocate prepare stmt;
prepare stmt from 'handler t1 read a>=(?) where a < ? limit 5';
set @a=15, @b=20;
set @a=17, @b=24;
execute stmt using @a,@b;
a b
16 ccc
16 xxx
17 ddd
18 eee
19 fff
19 yyy
20 ggg
execute stmt using @a,@b;
a b
16 ccc
16 xxx
17 ddd
18 eee
19 fff
19 yyy
20 ggg
deallocate prepare stmt;
prepare stmt from 'handler t1 read a=(?)';
set @a=16;
set @a=17;
execute stmt using @a;
a b
16 ccc
17 ddd
alter table t1 add c int;
execute stmt using @a;
ERROR 42S02: Unknown table 't1' in HANDLER
......@@ -319,7 +360,7 @@ ERROR 42S02: Unknown table 't1' in HANDLER
handler t1 open;
prepare stmt from 'handler t1 read a=(?)';
flush tables;
set @a=16;
set @a=17;
execute stmt using @a;
ERROR HY000: Prepared statement needs to be re-prepared
deallocate prepare stmt;
......
......@@ -120,9 +120,37 @@ eval alter table t1 engine = $engine_type;
handler t2 read first;
handler t1 open;
handler t1 read a=(16) limit 1,3;
handler t1 read a=(20) limit 1,3;
flush tables;
handler t1 read a=(16) limit 1,3;
handler t1 read a=(20) limit 1,3;
handler t1 close;
#
# Search after end and before start of index
#
handler t1 open;
handler t1 read a=(25);
handler t1 read a next;
handler t1 read a next;
handler t1 read a next;
handler t1 read a prev;
handler t1 read a=(1000);
handler t1 read a next;
handler t1 read a prev;
handler t1 read a=(1000);
handler t1 read a prev;
handler t1 read a=(14);
handler t1 read a prev;
handler t1 read a prev;
handler t1 read a next;
handler t1 read a=(1);
handler t1 read a prev;
handler t1 read a next;
handler t1 read a=(1);
handler t1 read a next;
handler t1 close;
#
......@@ -131,16 +159,16 @@ handler t1 close;
handler t1 open;
prepare stmt from 'handler t1 read a=(?) limit ?,?';
set @a=16,@b=1,@c=100;
set @a=20,@b=1,@c=100;
execute stmt using @a,@b,@c;
set @a=16,@b=2,@c=1;
set @a=20,@b=2,@c=1;
execute stmt using @a,@b,@c;
set @a=16,@b=0,@c=2;
set @a=20,@b=0,@c=2;
execute stmt using @a,@b,@c;
deallocate prepare stmt;
prepare stmt from 'handler t1 read a next limit ?';
handler t1 read a>=(11);
handler t1 read a>=(21);
set @a=3;
execute stmt using @a;
execute stmt using @a;
......@@ -168,13 +196,13 @@ execute stmt using @a;
deallocate prepare stmt;
prepare stmt from 'handler t1 read a>=(?) where a < ? limit 5';
set @a=15, @b=20;
set @a=17, @b=24;
execute stmt using @a,@b;
execute stmt using @a,@b;
deallocate prepare stmt;
prepare stmt from 'handler t1 read a=(?)';
set @a=16;
set @a=17;
execute stmt using @a;
alter table t1 add c int;
--error 1109
......@@ -186,7 +214,7 @@ handler t1 close;
handler t1 open;
prepare stmt from 'handler t1 read a=(?)';
flush tables;
set @a=16;
set @a=17;
--error ER_NEED_REPREPARE
execute stmt using @a;
deallocate prepare stmt;
......
......@@ -4,7 +4,7 @@ create table t1 (a int, b char(10), key a using btree (a), key b using btree (a,
insert into t1 values
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
(14,"aaa"),(16,"ccc"),(16,"xxx"),
(20,"ggg"),(21,"hhh"),(22,"iii");
(20,"ggg"),(21,"hhh"),(22,"iii"),(23,"xxx"),(24,"xxx"),(25,"xxx");
handler t1 open as t2;
handler t2 read b first;
a b
......@@ -20,13 +20,13 @@ a b
16 ccc
handler t2 read b last;
a b
22 iii
25 xxx
handler t2 read b prev;
a b
21 hhh
24 xxx
handler t2 read b prev;
a b
20 ggg
23 xxx
handler t2 read b first;
a b
14 aaa
......@@ -34,13 +34,13 @@ handler t2 read b prev;
a b
handler t2 read b last;
a b
22 iii
25 xxx
handler t2 read b prev;
a b
21 hhh
24 xxx
handler t2 read b next;
a b
22 iii
25 xxx
handler t2 read b next;
a b
handler t2 read a=(15);
......@@ -105,10 +105,10 @@ handler t2 read a>(54);
a b
handler t2 read a<=(54);
a b
22 iii
25 xxx
handler t2 read a<(54);
a b
22 iii
25 xxx
handler t2 read a=(1);
a b
handler t2 read a>=(1);
......@@ -158,9 +158,9 @@ a b
18 eee
handler t2 read a last limit 3;
a b
22 iii
21 hhh
20 ggg
25 xxx
24 xxx
23 xxx
handler t2 read b=(16) limit 1,3;
a b
16 xxx
......@@ -191,10 +191,10 @@ handler t1 close;
handler t1 open;
handler t1 read a prev;
a b
22 iii
25 xxx
handler t1 read a prev;
a b
21 hhh
24 xxx
handler t1 close;
handler t1 open as t2;
handler t2 read first;
......@@ -204,53 +204,97 @@ alter table t1 engine = MEMORY;
handler t2 read first;
ERROR 42S02: Unknown table 't2' in HANDLER
handler t1 open;
handler t1 read a=(16) limit 1,3;
handler t1 read a=(20) limit 1,3;
a b
16 ccc
flush tables;
handler t1 read a=(16) limit 1,3;
handler t1 read a=(20) limit 1,3;
a b
16 ccc
handler t1 close;
handler t1 open;
handler t1 read a=(25);
a b
25 xxx
handler t1 read a next;
a b
handler t1 read a next;
a b
handler t1 read a next;
a b
handler t1 read a prev;
a b
25 xxx
handler t1 read a=(1000);
a b
handler t1 read a next;
a b
handler t1 read a prev;
a b
25 xxx
handler t1 read a=(1000);
a b
handler t1 read a prev;
a b
25 xxx
handler t1 read a=(14);
a b
14 aaa
handler t1 read a prev;
a b
handler t1 read a prev;
a b
handler t1 read a next;
a b
14 aaa
handler t1 read a=(1);
a b
handler t1 read a prev;
a b
handler t1 read a next;
a b
14 aaa
handler t1 read a=(1);
a b
handler t1 read a next;
a b
14 aaa
handler t1 close;
handler t1 open;
prepare stmt from 'handler t1 read a=(?) limit ?,?';
set @a=16,@b=1,@c=100;
set @a=20,@b=1,@c=100;
execute stmt using @a,@b,@c;
a b
16 ccc
set @a=16,@b=2,@c=1;
set @a=20,@b=2,@c=1;
execute stmt using @a,@b,@c;
a b
set @a=16,@b=0,@c=2;
set @a=20,@b=0,@c=2;
execute stmt using @a,@b,@c;
a b
16 xxx
16 ccc
20 ggg
deallocate prepare stmt;
prepare stmt from 'handler t1 read a next limit ?';
handler t1 read a>=(11);
handler t1 read a>=(21);
a b
14 aaa
21 hhh
set @a=3;
execute stmt using @a;
a b
16 xxx
16 ccc
17 ddd
22 iii
23 xxx
24 xxx
execute stmt using @a;
a b
18 eee
19 fff
19 yyy
25 xxx
execute stmt using @a;
a b
20 ggg
21 hhh
22 iii
deallocate prepare stmt;
prepare stmt from 'handler t1 read b prev limit ?';
execute stmt using @a;
a b
25 xxx
24 xxx
23 xxx
execute stmt using @a;
a b
22 iii
21 hhh
20 ggg
......@@ -264,9 +308,6 @@ a b
17 ddd
16 xxx
16 ccc
execute stmt using @a;
a b
14 aaa
deallocate prepare stmt;
prepare stmt from 'handler t1 read b=(?,?)';
set @a=14, @b='aaa';
......@@ -289,27 +330,27 @@ a b
16 xxx
deallocate prepare stmt;
prepare stmt from 'handler t1 read a>=(?) where a < ? limit 5';
set @a=15, @b=20;
set @a=17, @b=24;
execute stmt using @a,@b;
a b
16 xxx
16 ccc
17 ddd
18 eee
19 fff
19 yyy
20 ggg
execute stmt using @a,@b;
a b
16 xxx
16 ccc
17 ddd
18 eee
19 fff
19 yyy
20 ggg
deallocate prepare stmt;
prepare stmt from 'handler t1 read a=(?)';
set @a=16;
set @a=17;
execute stmt using @a;
a b
16 xxx
17 ddd
alter table t1 add c int;
execute stmt using @a;
ERROR 42S02: Unknown table 't1' in HANDLER
......@@ -319,7 +360,7 @@ ERROR 42S02: Unknown table 't1' in HANDLER
handler t1 open;
prepare stmt from 'handler t1 read a=(?)';
flush tables;
set @a=16;
set @a=17;
execute stmt using @a;
ERROR HY000: Prepared statement needs to be re-prepared
deallocate prepare stmt;
......
......@@ -30,4 +30,4 @@ eval create table t1 (a int, b char(10), key a $key_type (a), key b $key_type (a
insert into t1 values
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
(14,"aaa"),(16,"ccc"),(16,"xxx"),
(20,"ggg"),(21,"hhh"),(22,"iii");
(20,"ggg"),(21,"hhh"),(22,"iii"),(23,"xxx"),(24,"xxx"),(25,"xxx");
......@@ -4,7 +4,7 @@ create table t1 (a int, b char(10), key a (a), key b (a,b));
insert into t1 values
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
(14,"aaa"),(16,"ccc"),(16,"xxx"),
(20,"ggg"),(21,"hhh"),(22,"iii");
(20,"ggg"),(21,"hhh"),(22,"iii"),(23,"xxx"),(24,"xxx"),(25,"xxx");
handler t1 open as t2;
handler t2 read b first;
a b
......@@ -20,13 +20,13 @@ a b
16 ccc
handler t2 read b last;
a b
22 iii
25 xxx
handler t2 read b prev;
a b
21 hhh
24 xxx
handler t2 read b prev;
a b
20 ggg
23 xxx
handler t2 read b first;
a b
14 aaa
......@@ -34,13 +34,13 @@ handler t2 read b prev;
a b
handler t2 read b last;
a b
22 iii
25 xxx
handler t2 read b prev;
a b
21 hhh
24 xxx
handler t2 read b next;
a b
22 iii
25 xxx
handler t2 read b next;
a b
handler t2 read a=(15);
......@@ -105,10 +105,10 @@ handler t2 read a>(54);
a b
handler t2 read a<=(54);
a b
22 iii
25 xxx
handler t2 read a<(54);
a b
22 iii
25 xxx
handler t2 read a=(1);
a b
handler t2 read a>=(1);
......@@ -158,9 +158,9 @@ a b
18 eee
handler t2 read a last limit 3;
a b
22 iii
21 hhh
20 ggg
25 xxx
24 xxx
23 xxx
handler t2 read b=(16) limit 1,3;
a b
16 xxx
......@@ -191,10 +191,10 @@ handler t1 close;
handler t1 open;
handler t1 read a prev;
a b
22 iii
25 xxx
handler t1 read a prev;
a b
21 hhh
24 xxx
handler t1 close;
handler t1 open as t2;
handler t2 read first;
......@@ -204,53 +204,97 @@ alter table t1 engine = InnoDB;
handler t2 read first;
ERROR 42S02: Unknown table 't2' in HANDLER
handler t1 open;
handler t1 read a=(16) limit 1,3;
handler t1 read a=(20) limit 1,3;
a b
16 xxx
flush tables;
handler t1 read a=(16) limit 1,3;
handler t1 read a=(20) limit 1,3;
a b
16 xxx
handler t1 close;
handler t1 open;
handler t1 read a=(25);
a b
25 xxx
handler t1 read a next;
a b
handler t1 read a next;
a b
handler t1 read a next;
a b
handler t1 read a prev;
a b
25 xxx
handler t1 read a=(1000);
a b
handler t1 read a next;
a b
handler t1 read a prev;
a b
25 xxx
handler t1 read a=(1000);
a b
handler t1 read a prev;
a b
25 xxx
handler t1 read a=(14);
a b
14 aaa
handler t1 read a prev;
a b
handler t1 read a prev;
a b
handler t1 read a next;
a b
14 aaa
handler t1 read a=(1);
a b
handler t1 read a prev;
a b
handler t1 read a next;
a b
14 aaa
handler t1 read a=(1);
a b
handler t1 read a next;
a b
16 ccc
handler t1 close;
handler t1 open;
prepare stmt from 'handler t1 read a=(?) limit ?,?';
set @a=16,@b=1,@c=100;
set @a=20,@b=1,@c=100;
execute stmt using @a,@b,@c;
a b
16 xxx
set @a=16,@b=2,@c=1;
set @a=20,@b=2,@c=1;
execute stmt using @a,@b,@c;
a b
set @a=16,@b=0,@c=2;
set @a=20,@b=0,@c=2;
execute stmt using @a,@b,@c;
a b
16 ccc
16 xxx
20 ggg
deallocate prepare stmt;
prepare stmt from 'handler t1 read a next limit ?';
handler t1 read a>=(11);
handler t1 read a>=(21);
a b
14 aaa
21 hhh
set @a=3;
execute stmt using @a;
a b
16 ccc
16 xxx
17 ddd
22 iii
23 xxx
24 xxx
execute stmt using @a;
a b
18 eee
19 fff
19 yyy
25 xxx
execute stmt using @a;
a b
20 ggg
21 hhh
22 iii
deallocate prepare stmt;
prepare stmt from 'handler t1 read b prev limit ?';
execute stmt using @a;
a b
25 xxx
24 xxx
23 xxx
execute stmt using @a;
a b
22 iii
21 hhh
20 ggg
......@@ -264,9 +308,6 @@ a b
17 ddd
16 xxx
16 ccc
execute stmt using @a;
a b
14 aaa
deallocate prepare stmt;
prepare stmt from 'handler t1 read b=(?,?)';
set @a=14, @b='aaa';
......@@ -289,27 +330,27 @@ a b
16 xxx
deallocate prepare stmt;
prepare stmt from 'handler t1 read a>=(?) where a < ? limit 5';
set @a=15, @b=20;
set @a=17, @b=24;
execute stmt using @a,@b;
a b
16 ccc
16 xxx
17 ddd
18 eee
19 fff
19 yyy
20 ggg
execute stmt using @a,@b;
a b
16 ccc
16 xxx
17 ddd
18 eee
19 fff
19 yyy
20 ggg
deallocate prepare stmt;
prepare stmt from 'handler t1 read a=(?)';
set @a=16;
set @a=17;
execute stmt using @a;
a b
16 ccc
17 ddd
alter table t1 add c int;
execute stmt using @a;
ERROR 42S02: Unknown table 't1' in HANDLER
......@@ -319,7 +360,7 @@ ERROR 42S02: Unknown table 't1' in HANDLER
handler t1 open;
prepare stmt from 'handler t1 read a=(?)';
flush tables;
set @a=16;
set @a=17;
execute stmt using @a;
ERROR HY000: Prepared statement needs to be re-prepared
deallocate prepare stmt;
......
......@@ -6,7 +6,7 @@ create table t1 (a int, b char(10), key a (a), key b (a,b));
insert into t1 values
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
(14,"aaa"),(16,"ccc"),(16,"xxx"),
(20,"ggg"),(21,"hhh"),(22,"iii");
(20,"ggg"),(21,"hhh"),(22,"iii"),(23,"xxx"),(24,"xxx"),(25,"xxx");
handler t1 open;
handler t1 read a=(SELECT 1);
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT 1)' at line 1
......
......@@ -4,7 +4,7 @@ create table t1 (a int, b char(10), key a (a), key b (a,b));
insert into t1 values
(17,"ddd"),(18,"eee"),(19,"fff"),(19,"yyy"),
(14,"aaa"),(16,"ccc"),(16,"xxx"),
(20,"ggg"),(21,"hhh"),(22,"iii");
(20,"ggg"),(21,"hhh"),(22,"iii"),(23,"xxx"),(24,"xxx"),(25,"xxx");
handler t1 open as t2;
handler t2 read b first;
a b
......@@ -20,13 +20,13 @@ a b
16 ccc
handler t2 read b last;
a b
22 iii
25 xxx
handler t2 read b prev;
a b
21 hhh
24 xxx
handler t2 read b prev;
a b
20 ggg
23 xxx
handler t2 read b first;
a b
14 aaa
......@@ -34,13 +34,13 @@ handler t2 read b prev;
a b
handler t2 read b last;
a b
22 iii
25 xxx
handler t2 read b prev;
a b
21 hhh
24 xxx
handler t2 read b next;
a b
22 iii
25 xxx
handler t2 read b next;
a b
handler t2 read a=(15);
......@@ -105,10 +105,10 @@ handler t2 read a>(54);
a b
handler t2 read a<=(54);
a b
22 iii
25 xxx
handler t2 read a<(54);
a b
22 iii
25 xxx
handler t2 read a=(1);
a b
handler t2 read a>=(1);
......@@ -158,9 +158,9 @@ a b
18 eee
handler t2 read a last limit 3;
a b
22 iii
21 hhh
20 ggg
25 xxx
24 xxx
23 xxx
handler t2 read b=(16) limit 1,3;
a b
16 xxx
......@@ -191,10 +191,10 @@ handler t1 close;
handler t1 open;
handler t1 read a prev;
a b
22 iii
25 xxx
handler t1 read a prev;
a b
21 hhh
24 xxx
handler t1 close;
handler t1 open as t2;
handler t2 read first;
......@@ -204,53 +204,97 @@ alter table t1 engine = MyISAM;
handler t2 read first;
ERROR 42S02: Unknown table 't2' in HANDLER
handler t1 open;
handler t1 read a=(16) limit 1,3;
handler t1 read a=(20) limit 1,3;
a b
16 xxx
flush tables;
handler t1 read a=(16) limit 1,3;
handler t1 read a=(20) limit 1,3;
a b
16 xxx
handler t1 close;
handler t1 open;
handler t1 read a=(25);
a b
25 xxx
handler t1 read a next;
a b
handler t1 read a next;
a b
handler t1 read a next;
a b
handler t1 read a prev;
a b
25 xxx
handler t1 read a=(1000);
a b
handler t1 read a next;
a b
handler t1 read a prev;
a b
25 xxx
handler t1 read a=(1000);
a b
handler t1 read a prev;
a b
25 xxx
handler t1 read a=(14);
a b
14 aaa
handler t1 read a prev;
a b
handler t1 read a prev;
a b
handler t1 read a next;
a b
14 aaa
handler t1 read a=(1);
a b
handler t1 read a prev;
a b
handler t1 read a next;
a b
14 aaa
handler t1 read a=(1);
a b
handler t1 read a next;
a b
14 aaa
handler t1 close;
handler t1 open;
prepare stmt from 'handler t1 read a=(?) limit ?,?';
set @a=16,@b=1,@c=100;
set @a=20,@b=1,@c=100;
execute stmt using @a,@b,@c;
a b
16 xxx
set @a=16,@b=2,@c=1;
set @a=20,@b=2,@c=1;
execute stmt using @a,@b,@c;
a b
set @a=16,@b=0,@c=2;
set @a=20,@b=0,@c=2;
execute stmt using @a,@b,@c;
a b
16 ccc
16 xxx
20 ggg
deallocate prepare stmt;
prepare stmt from 'handler t1 read a next limit ?';
handler t1 read a>=(11);
handler t1 read a>=(21);
a b
14 aaa
21 hhh
set @a=3;
execute stmt using @a;
a b
16 ccc
16 xxx
17 ddd
22 iii
23 xxx
24 xxx
execute stmt using @a;
a b
18 eee
19 fff
19 yyy
25 xxx
execute stmt using @a;
a b
20 ggg
21 hhh
22 iii
deallocate prepare stmt;
prepare stmt from 'handler t1 read b prev limit ?';
execute stmt using @a;
a b
25 xxx
24 xxx
23 xxx
execute stmt using @a;
a b
22 iii
21 hhh
20 ggg
......@@ -264,9 +308,6 @@ a b
17 ddd
16 xxx
16 ccc
execute stmt using @a;
a b
14 aaa
deallocate prepare stmt;
prepare stmt from 'handler t1 read b=(?,?)';
set @a=14, @b='aaa';
......@@ -289,27 +330,27 @@ a b
16 xxx
deallocate prepare stmt;
prepare stmt from 'handler t1 read a>=(?) where a < ? limit 5';
set @a=15, @b=20;
set @a=17, @b=24;
execute stmt using @a,@b;
a b
16 ccc
16 xxx
17 ddd
18 eee
19 fff
19 yyy
20 ggg
execute stmt using @a,@b;
a b
16 ccc
16 xxx
17 ddd
18 eee
19 fff
19 yyy
20 ggg
deallocate prepare stmt;
prepare stmt from 'handler t1 read a=(?)';
set @a=16;
set @a=17;
execute stmt using @a;
a b
16 ccc
17 ddd
alter table t1 add c int;
execute stmt using @a;
ERROR 42S02: Unknown table 't1' in HANDLER
......@@ -319,7 +360,7 @@ ERROR 42S02: Unknown table 't1' in HANDLER
handler t1 open;
prepare stmt from 'handler t1 read a=(?)';
flush tables;
set @a=16;
set @a=17;
execute stmt using @a;
ERROR HY000: Prepared statement needs to be re-prepared
deallocate prepare stmt;
......
......@@ -40,18 +40,22 @@ SET SESSION transaction_prealloc_size=1024*1024*1024*1;
--replace_column 1 <Id> 6 <Time>
# Embedded server is hardcoded to show "Writing to net" as STATE.
--replace_result "Writing to net" "NULL"
--replace_regex /localhost[:0-9]*/localhost/
SHOW PROCESSLIST;
SET SESSION transaction_prealloc_size=1024*1024*1024*2;
--replace_column 1 <Id> 6 <Time>
--replace_result "Writing to net" "NULL"
--replace_regex /localhost[:0-9]*/localhost/
SHOW PROCESSLIST;
SET SESSION transaction_prealloc_size=1024*1024*1024*3;
--replace_column 1 <Id> 6 <Time>
--replace_result "Writing to net" "NULL"
--replace_regex /localhost[:0-9]*/localhost/
SHOW PROCESSLIST;
SET SESSION transaction_prealloc_size=1024*1024*1024*4;
--replace_column 1 <Id> 6 <Time>
--replace_result "Writing to net" "NULL"
--replace_regex /localhost[:0-9]*/localhost/
SHOW PROCESSLIST;
SET SESSION transaction_prealloc_size=1024*1024*1024*5;
--replace_column 1 <Id> 6 <Time>
......
......@@ -558,7 +558,6 @@
obj:/lib*/ld-*.so)
obj:/lib*/libdl-*.so)
fun:dlsym
fun:plugin_dl_add
}
#
......
......@@ -52,6 +52,7 @@ int heap_rfirst(HP_INFO *info, uchar *record, int inx)
}
else
{
info->update= HA_STATE_NO_KEY;
my_errno = HA_ERR_END_OF_FILE;
DBUG_RETURN(my_errno);
}
......
......@@ -51,7 +51,7 @@ int heap_rkey(HP_INFO *info, uchar *record, int inx, const uchar *key,
if (!(pos= tree_search_key(&keyinfo->rb_tree, info->lastkey, info->parents,
&info->last_pos, find_flag, &custom_arg)))
{
info->update= 0;
info->update= HA_STATE_NO_KEY;
DBUG_RETURN(my_errno= HA_ERR_KEY_NOT_FOUND);
}
memcpy(&pos, pos + (*keyinfo->get_key_length)(keyinfo, pos), sizeof(uchar*));
......@@ -61,7 +61,7 @@ int heap_rkey(HP_INFO *info, uchar *record, int inx, const uchar *key,
{
if (!(pos= hp_search(info, share->keydef + inx, key, 0)))
{
info->update= 0;
info->update= HA_STATE_NO_KEY;
DBUG_RETURN(my_errno);
}
if (!(keyinfo->flag & HA_NOSAME))
......
......@@ -32,7 +32,20 @@ int heap_rnext(HP_INFO *info, uchar *record)
{
heap_rb_param custom_arg;
if (info->last_pos)
/* If no active record and last was not deleted */
if (!(info->update & (HA_STATE_AKTIV | HA_STATE_NO_KEY |
HA_STATE_DELETED)))
{
if (info->update & HA_STATE_NEXT_FOUND)
pos= 0; /* Can't search after last row */
else
{
/* Last was 'prev' before first record; search after first record */
pos= tree_search_edge(&keyinfo->rb_tree, info->parents,
&info->last_pos, offsetof(TREE_ELEMENT, left));
}
}
else if (info->last_pos)
{
/*
We enter this branch for non-DELETE queries after heap_rkey()
......
......@@ -32,7 +32,20 @@ int heap_rprev(HP_INFO *info, uchar *record)
{
heap_rb_param custom_arg;
if (info->last_pos)
/* If no active record and last was not deleted */
if (!(info->update & (HA_STATE_AKTIV | HA_STATE_NO_KEY |
HA_STATE_DELETED)))
{
if (info->update & HA_STATE_PREV_FOUND)
pos= 0; /* Can't search before first row */
else
{
/* Last was 'next' after last record; search after last record */
pos= tree_search_edge(&keyinfo->rb_tree, info->parents,
&info->last_pos, offsetof(TREE_ELEMENT, right));
}
}
else if (info->last_pos)
pos = tree_search_next(&keyinfo->rb_tree, &info->last_pos,
offsetof(TREE_ELEMENT, right),
offsetof(TREE_ELEMENT, left));
......
......@@ -43,7 +43,7 @@ int heap_rsame(register HP_INFO *info, uchar *record, int inx)
hp_make_key(share->keydef + inx, info->lastkey, record);
if (!hp_search(info, share->keydef + inx, info->lastkey, 3))
{
info->update=0;
info->update= 0;
DBUG_RETURN(my_errno);
}
}
......
......@@ -2196,7 +2196,7 @@ buf_page_get_gen(
ulint fix_type;
ibool must_read;
ulint retries = 0;
mutex_t* block_mutex;
mutex_t* block_mutex= NULL;
trx_t* trx = NULL;
ulint sec;
ulint ms;
......
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