Commit de314ab1 authored by unknown's avatar unknown

Merge bk-internal:/home/bk/mysql-5.1-new

into  mysql.com:/usr/local/mysql/tmpbuild
parents d552e9a8 9542e88f
......@@ -260,10 +260,8 @@ ALTER TABLE mysql.event MODIFY db char(64) character set utf8 collate utf8_bin d
"This should work"
SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED
events_test intact_check root@localhost RECURRING NULL 10 HOUR # # ENABLED
ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default '';
Warnings:
Warning 1265 Data truncated for column 'db' at row 1
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log.
ALTER TABLE mysql.event MODIFY db varchar(64) character set utf8 collate utf8_bin default '';
......@@ -389,10 +387,9 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
select definer, name, db from mysql.event;
definer name db
root@localhost закачка events_test
"Should be only 1 process"
show processlist;
Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist
"Should be 0 processes"
select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user host db command state info
select release_lock("test_lock1");
release_lock("test_lock1")
1
......@@ -409,12 +406,11 @@ get_lock("test_lock2", 20)
"Create an event which tries to acquire a mutex. The event locks on the mutex"
create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
"Let some time pass to the event starts"
"Should have only 3 processes: the scheduler, our conn and the locked event"
show processlist;
Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist
# event_scheduler localhost NULL Connect # Sleeping NULL
# root localhost events_test Connect # User lock select get_lock("test_lock2", 20)
"Should have only 2 processes: the scheduler and the locked event"
select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user host db command state info
event_scheduler localhost NULL Connect Sleeping NULL
root localhost events_test Connect User lock select get_lock("test_lock2", 20)
"Release the mutex, the event worker should finish."
select release_lock("test_lock2");
release_lock("test_lock2")
......@@ -425,23 +421,21 @@ select get_lock("test_lock2_1", 20);
get_lock("test_lock2_1", 20)
1
create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
"Should see 2 processes, one locked on get_lock("
"Should see 1 process, locked on get_lock("
"Shutting down the scheduler, it should wait for the running event"
set global event_scheduler=0;
"Should have only 3 processes: the scheduler, our conn and the locked event"
show processlist;
Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist
# event_scheduler localhost NULL Connect # Sleeping NULL
# root localhost events_test Connect # User lock select get_lock("test_lock2_1", 20)
"Should have only 2 processes: the scheduler and the locked event"
select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user host db command state info
event_scheduler localhost NULL Connect Sleeping NULL
root localhost events_test Connect User lock select get_lock("test_lock2_1", 20)
"Release the lock so the child process should finish. Hence the scheduler also"
select release_lock("test_lock2_1");
release_lock("test_lock2_1")
1
"Should have only our process now:"
show processlist;
Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist
"Should see 0 processes now:"
select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user host db command state info
drop event закачка21;
create table t_16 (s1 int);
create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5;
......
......@@ -5,10 +5,10 @@ CREATE EVENT Lower_case ON SCHEDULE EVERY 2 MINUTE DO SELECT 2;
ERROR HY000: Event 'Lower_case' already exists
DROP EVENT Lower_case;
SET NAMES cp1251;
CREATE EVENT äîëåí_ðåãèñòúð_1251 ON SCHEDULE EVERY 1 YEAR DO SELECT 100;
CREATE EVENT ÄîËåÍ_ðåãèñòúð_1251 ON SCHEDULE EVERY 2 YEAR DO SELECT 200;
CREATE EVENT __1251 ON SCHEDULE EVERY 1 YEAR DO SELECT 100;
CREATE EVENT __1251 ON SCHEDULE EVERY 2 YEAR DO SELECT 200;
ERROR HY000: Event 'ДоЛеН_регистър_1251' already exists
DROP EVENT ÄîËåÍ_ðåãèñòúð_1251;
DROP EVENT __1251;
SET NAMES utf8;
CREATE EVENT долен_регистър_утф8 ON SCHEDULE EVERY 3 YEAR DO SELECT 300;
CREATE EVENT ДОЛЕН_регистър_утф8 ON SCHEDULE EVERY 4 YEAR DO SELECT 400;
......@@ -50,11 +50,10 @@ select get_lock('test_bug16407', 60);
drop table "hashed_num";
end|
"Now if everything is fine the event has compiled and is locked
show processlist;
Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist
# event_scheduler localhost NULL Connect # Sleeping NULL
# root localhost events_test Connect # User lock select get_lock('test_bug16407', 60)
select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user host db command state info
event_scheduler localhost NULL Connect Sleeping NULL
root localhost events_test Connect User lock select get_lock('test_bug16407', 60)
select release_lock('test_bug16407');
release_lock('test_bug16407')
1
......@@ -75,7 +74,7 @@ create table events_smode_test(ev_name char(10), a date) engine=myisam;
"This should never insert something"
create event ee_16407_2 on schedule every 60 second do
begin
select get_lock('ee_16407_2', 60);
select get_lock('ee_16407_2', 60) /*ee_16407_2*/;
insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
end|
insert into events_smode_test values ('test','1980-19-02')|
......@@ -83,7 +82,7 @@ ERROR 22007: Incorrect date value: '1980-19-02' for column 'a' at row 1
"This is ok"
create event ee_16407_3 on schedule every 60 second do
begin
select get_lock('ee_16407_2', 60);
select get_lock('ee_16407_2', 60) /*ee_16407_3*/;
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-19');
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-29');
end|
......@@ -91,7 +90,7 @@ set sql_mode=""|
"This will insert rows but they will be truncated"
create event ee_16407_4 on schedule every 60 second do
begin
select get_lock('ee_16407_2', 60);
select get_lock('ee_16407_2', 60) /*ee_16407_4*/;
insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956');
end|
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
......@@ -104,20 +103,18 @@ select get_lock('ee_16407_2', 60);
get_lock('ee_16407_2', 60)
1
set global event_scheduler= 1;
show processlist;
Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist
# event_scheduler localhost NULL Connect # Sleeping NULL
# root localhost events_test Connect # User lock select get_lock('ee_16407_2', 60)
# root localhost events_test Connect # User lock select get_lock('ee_16407_2', 60)
# root localhost events_test Connect # User lock select get_lock('ee_16407_2', 60)
select /*2*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user host db command state info
event_scheduler localhost NULL Connect Sleeping NULL
root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) /*ee_16407_2*/
root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) /*ee_16407_3*/
root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) /*ee_16407_4*/
select release_lock('ee_16407_2');
release_lock('ee_16407_2')
1
show processlist;
Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist
# event_scheduler localhost NULL Connect # Sleeping NULL
select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user host db command state info
event_scheduler localhost NULL Connect Sleeping NULL
set global event_scheduler= 0;
select * from events_smode_test order by ev_name, a;
ev_name a
......@@ -140,12 +137,12 @@ create procedure ee_16407_5_pendant() begin insert into events_test.events_smode
create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end|
create event ee_16407_5 on schedule every 60 second do
begin
select get_lock('ee_16407_5', 60);
select get_lock('ee_16407_5', 60) /*ee_16407_5*/;
call events_test.ee_16407_5_pendant();
end|
create event ee_16407_6 on schedule every 60 second do
begin
select get_lock('ee_16407_5', 60);
select get_lock('ee_16407_5', 60) /*ee_16407_6*/;
call events_test.ee_16407_6_pendant();
end|
set sql_mode='ansi';
......@@ -153,19 +150,19 @@ select get_lock('ee_16407_5', 60);
get_lock('ee_16407_5', 60)
1
set global event_scheduler= 1;
show processlist;
Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist
# event_scheduler localhost NULL Connect # Sleeping NULL
# root localhost events_test Connect # User lock select get_lock('ee_16407_5', 60)
# root localhost events_test Connect # User lock select get_lock('ee_16407_5', 60)
"Should have 2 locked processes"
select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user host db command state info
event_scheduler localhost NULL Connect Sleeping NULL
root localhost events_test Connect User lock select get_lock('ee_16407_5', 60) /*ee_16407_5*/
root localhost events_test Connect User lock select get_lock('ee_16407_5', 60) /*ee_16407_6*/
select release_lock('ee_16407_5');
release_lock('ee_16407_5')
1
show processlist;
Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist
# event_scheduler localhost NULL Connect # Sleeping NULL
"Should have 0 processes locked"
select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user host db command state info
event_scheduler localhost NULL Connect Sleeping NULL
select * from events_smode_test order by ev_name, a;
ev_name a
ee_16407_6 2004-02-29
......
......@@ -1766,5 +1766,21 @@ select * from t3 left join t4 on t4.attr2 = t3.attr2 where t4.attr1 > 1 and t4.a
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
1 SIMPLE t4 ALL NULL NULL NULL NULL 6 Using where
create table t5 (a int primary key auto_increment, b tinytext not null)
engine = ndb;
insert into t5 (b) values ('jonas'), ('jensing'), ('johan');
set engine_condition_pushdown = off;
select * from t5 where b like '%jo%' order by a;
a b
1 jonas
3 johan
set engine_condition_pushdown = on;
explain select * from t5 where b like '%jo%';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t5 ALL NULL NULL NULL NULL 3 Using where
select * from t5 where b like '%jo%' order by a;
a b
1 jonas
3 johan
set engine_condition_pushdown = @old_ecpd;
DROP TABLE t1,t2,t3,t4;
DROP TABLE t1,t2,t3,t4,t5;
......@@ -629,7 +629,23 @@ DELETE FROM t1;
CREATE UNIQUE INDEX ai ON t1(a);
INSERT IGNORE INTO t1 VALUES (1);
INSERT IGNORE INTO t1 VALUES (1);
INSERT IGNORE INTO t1 VALUES (NULL),(2);
SELECT * FROM t1 ORDER BY a;
a
NULL
1
2
DROP TABLE t1;
CREATE TABLE t1(pk INT NOT NULL PRIMARY KEY, a INT, UNIQUE (a)) ENGINE=ndb;
INSERT IGNORE INTO t1 VALUES (1,1),(2,2),(3,3);
INSERT IGNORE INTO t1 VALUES (4,NULL),(5,NULL),(6,NULL),(7,4);
SELECT * FROM t1 ORDER BY pk;
pk a
1 1
2 2
3 3
4 NULL
5 NULL
6 NULL
7 4
DROP TABLE t1;
......@@ -718,4 +718,105 @@ CALL test.p1(13);
Warnings:
Warning 1196 Some non-transactional changed tables couldn't be rolled back
drop table t1;
create table t1 (f1 integer) partition by range(f1)
(partition p1 values less than (0), partition p2 values less than (10));
insert into t1 set f1 = null;
select * from t1 where f1 is null;
f1
NULL
explain partitions select * from t1 where f1 is null;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1 system NULL NULL NULL NULL 1
drop table t1;
create table t1 (f1 integer) partition by list(f1)
(partition p1 values in (1), partition p2 values in (null));
insert into t1 set f1 = null;
insert into t1 set f1 = 1;
select * from t1 where f1 is null or f1 = 1;
f1
1
NULL
drop table t1;
create table t1 (f1 smallint)
partition by list (f1) (partition p0 values in (null));
insert into t1 values (null);
select * from t1 where f1 is null;
f1
NULL
drop table t1;
create table t1 (f1 smallint)
partition by range (f1) (partition p0 values less than (0));
insert into t1 values (null);
select * from t1 where f1 is null;
f1
NULL
drop table t1;
create table t1 (f1 integer) partition by list(f1)
(
partition p1 values in (1),
partition p2 values in (NULL),
partition p3 values in (2),
partition p4 values in (3),
partition p5 values in (4)
);
insert into t1 values (1),(2),(3),(4),(null);
select * from t1 where f1 < 3;
f1
1
2
explain partitions select * from t1 where f1 < 3;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1,p3 ALL NULL NULL NULL NULL 2 Using where
select * from t1 where f1 is null;
f1
NULL
explain partitions select * from t1 where f1 is null;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2 system NULL NULL NULL NULL 1
drop table t1;
create table t1 (f1 int) partition by list(f1 div 2)
(
partition p1 values in (1),
partition p2 values in (NULL),
partition p3 values in (2),
partition p4 values in (3),
partition p5 values in (4)
);
insert into t1 values (2),(4),(6),(8),(null);
select * from t1 where f1 < 3;
f1
2
explain partitions select * from t1 where f1 < 3;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p1,p2,p3,p4,p5 ALL NULL NULL NULL NULL 5 Using where
select * from t1 where f1 is null;
f1
NULL
explain partitions select * from t1 where f1 is null;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 p2 system NULL NULL NULL NULL 1
drop table t1;
create table t1 (a int) partition by LIST(a) (
partition pn values in (NULL),
partition p0 values in (0),
partition p1 values in (1),
partition p2 values in (2)
);
insert into t1 values (NULL),(0),(1),(2);
select * from t1 where a is null or a < 2;
a
NULL
0
1
explain partitions select * from t1 where a is null or a < 2;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pn,p0,p1 ALL NULL NULL NULL NULL 3 Using where
select * from t1 where a is null or a < 0 or a > 1;
a
NULL
2
explain partitions select * from t1 where a is null or a < 0 or a > 1;
id select_type table partitions type possible_keys key key_len ref rows Extra
1 SIMPLE t1 pn,p2 ALL NULL NULL NULL NULL 2 Using where
drop table t1;
End of 5.1 tests
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
CREATE PROCEDURE test.p1(IN i INT)
BEGIN
DECLARE CONTINUE HANDLER FOR sqlexception BEGIN END;
DROP TABLE IF EXISTS test.t1;
CREATE TABLE test.t1 (num INT,PRIMARY KEY(num))ENGINE=NDBCLUSTER;
START TRANSACTION;
INSERT INTO test.t1 VALUES(i);
savepoint t1_save;
INSERT INTO test.t1 VALUES (14);
ROLLBACK to savepoint t1_save;
COMMIT;
END|
< ---- Master selects-- >
-------------------------
CALL test.p1(12);
Warnings:
Note 1051 Unknown table 't1'
SELECT * FROM test.t1;
num
12
< ---- Slave selects-- >
------------------------
SELECT * FROM test.t1;
num
12
< ---- Master selects-- >
-------------------------
CALL test.p1(13);
SELECT * FROM test.t1;
num
13
< ---- Slave selects-- >
------------------------
SELECT * FROM test.t1;
num
13
DROP PROCEDURE IF EXISTS test.p1;
DROP TABLE IF EXISTS test.t1;
......@@ -23,6 +23,7 @@ partition_03ndb : Bug#16385
ps_7ndb : dbug assert in RBR mode when executing test suite
#rpl_bit_npk : Bug#13418
#rpl_ddl : Bug#15963 SBR does not show "Definer" correctly
rpl_ndb_dd_basic : Bug #18569
rpl_ndb_2innodb : assertion in get_parts_for_update()
rpl_ndb_2myisam : assertion in get_parts_for_update()
rpl_ndb_auto_inc : Bug#17086
......@@ -31,12 +32,12 @@ rpl_ndb_auto_inc : Bug#17086
#rpl_ndb_blob2 : interferes with following tests, causing hang
rpl_ndb_ddl : master hangs
#rpl_ndb_delete_nowhere : Bug#17400: delete & update of rows in table without pk fails
rpl_ndb_insert_ignore : Bug #18567
rpl_ndb_innodb2ndb : Bug#18261: Cluster Replication: tests rpl_ndb_xxx2ndb fails
rpl_ndb_myisam2ndb : Bug#18261: Cluster Replication: tests rpl_ndb_xxx2ndb fails
rpl_ndb_log : result not deterministic, TBD if should remove
rpl_ndb_relay_space : Bug#16993
#rpl_ndb_multi_update3 : Bug#17400: delete & update of rows in table without pk fails
rpl_ndb_sp007 : Bug #18565
rpl_row_inexist_tbl : Disabled since patch makes this test wait forever
rpl_sp : Bug#16456
rpl_until : Unstable test case, bug#15886
......
......@@ -341,9 +341,8 @@ create event закачка on schedule every 10 hour do select get_lock("test_l
--echo "Should return 1 row"
select definer, name, db from mysql.event;
--echo "Should be only 1 process"
--replace_column 1 # 6 #
show processlist;
--echo "Should be 0 processes"
select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
select release_lock("test_lock1");
drop event закаÑка;
--echo "Should have 0 events"
......@@ -359,9 +358,8 @@ select get_lock("test_lock2", 20);
create event закаÑка on schedule every 10 hour do select get_lock("test_lock2", 20);
--echo "Let some time pass to the event starts"
--sleep 2
--echo "Should have only 3 processes: the scheduler, our conn and the locked event"
--replace_column 1 # 6 #
show processlist;
--echo "Should have only 2 processes: the scheduler and the locked event"
select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
--echo "Release the mutex, the event worker should finish."
select release_lock("test_lock2");
drop event закаÑка;
......@@ -378,21 +376,18 @@ set global event_scheduler=1;
select get_lock("test_lock2_1", 20);
create event закаÑка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
--sleep 1
--echo "Should see 2 processes, one locked on get_lock("
#--replace_column 1 # 6 #
#show processlist;
--echo "Should see 1 process, locked on get_lock("
#select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
--echo "Shutting down the scheduler, it should wait for the running event"
set global event_scheduler=0;
--sleep 1
--echo "Should have only 3 processes: the scheduler, our conn and the locked event"
--replace_column 1 # 6 #
show processlist;
--echo "Should have only 2 processes: the scheduler and the locked event"
select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
--echo "Release the lock so the child process should finish. Hence the scheduler also"
select release_lock("test_lock2_1");
--sleep 1
--echo "Should have only our process now:"
--replace_column 1 # 6 #
show processlist;
--echo "Should see 0 processes now:"
select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
drop event закаÑка21;
####
......@@ -441,7 +436,7 @@ drop event e1;
##select get_lock("test_lock3", 20);
##create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20);
##select sleep(2);
##show processlist;
##select /*7*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
##drop event закачка;
##select release_lock("test_lock3");
......@@ -451,15 +446,13 @@ drop event e1;
##select get_lock("test_lock4", 20);
##create event закачка4 on schedule every 1 second do select get_lock("test_lock4", 20);
##select sleep(3);
##--replace_column 1 # 6 #
##show processlist;
##select /*8*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
##drop event закачка4;
##select release_lock("test_lock4");
##set global event_scheduler=0;
##select sleep(2);
##--replace_column 1 # 6 #
##show processlist;
##select /*9*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
##select count(*) from mysql.event;
drop database events_test;
......
......@@ -77,8 +77,7 @@ end|
delimiter ;|
--sleep 1
--echo "Now if everything is fine the event has compiled and is locked
--replace_column 1 # 6 #
show processlist;
select /*1*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
select release_lock('test_bug16407');
set global event_scheduler= 0;
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
......@@ -95,7 +94,7 @@ create table events_smode_test(ev_name char(10), a date) engine=myisam;
delimiter |;
create event ee_16407_2 on schedule every 60 second do
begin
select get_lock('ee_16407_2', 60);
select get_lock('ee_16407_2', 60) /*ee_16407_2*/;
insert into events_test.events_smode_test values('ee_16407_2','1980-19-02');
end|
--error ER_TRUNCATED_WRONG_VALUE
......@@ -103,7 +102,7 @@ insert into events_smode_test values ('test','1980-19-02')|
--echo "This is ok"
create event ee_16407_3 on schedule every 60 second do
begin
select get_lock('ee_16407_2', 60);
select get_lock('ee_16407_2', 60) /*ee_16407_3*/;
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-19');
insert into events_test.events_smode_test values ('ee_16407_3','1980-02-29');
end|
......@@ -111,7 +110,7 @@ set sql_mode=""|
--echo "This will insert rows but they will be truncated"
create event ee_16407_4 on schedule every 60 second do
begin
select get_lock('ee_16407_2', 60);
select get_lock('ee_16407_2', 60) /*ee_16407_4*/;
insert into events_test.events_smode_test values ('ee_16407_4','10-11-1956');
end|
delimiter ;|
......@@ -120,12 +119,10 @@ set sql_mode="ansi";
select get_lock('ee_16407_2', 60);
set global event_scheduler= 1;
--sleep 1
--replace_column 1 # 6 #
show processlist;
select /*2*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
select release_lock('ee_16407_2');
--sleep 3
--replace_column 1 # 6 #
show processlist;
select /*3*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
set global event_scheduler= 0;
select * from events_smode_test order by ev_name, a;
--echo "OK, last check before we drop them"
......@@ -143,12 +140,12 @@ create procedure ee_16407_5_pendant() begin insert into events_test.events_smode
create procedure ee_16407_6_pendant() begin insert into events_test.events_smode_test values('ee_16407_6','2004-02-29'); end|
create event ee_16407_5 on schedule every 60 second do
begin
select get_lock('ee_16407_5', 60);
select get_lock('ee_16407_5', 60) /*ee_16407_5*/;
call events_test.ee_16407_5_pendant();
end|
create event ee_16407_6 on schedule every 60 second do
begin
select get_lock('ee_16407_5', 60);
select get_lock('ee_16407_5', 60) /*ee_16407_6*/;
call events_test.ee_16407_6_pendant();
end|
delimiter ;|
......@@ -156,12 +153,12 @@ set sql_mode='ansi';
select get_lock('ee_16407_5', 60);
set global event_scheduler= 1;
--sleep 1
--replace_column 1 # 6 #
show processlist;
--echo "Should have 2 locked processes"
select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
select release_lock('ee_16407_5');
--sleep 3
--replace_column 1 # 6 #
show processlist;
--echo "Should have 0 processes locked"
select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
select * from events_smode_test order by ev_name, a;
--echo "And here we check one more time before we drop the events"
select event_schema, event_name, sql_mode from information_schema.events order by event_schema, event_name;
......
......@@ -1639,5 +1639,15 @@ select * from t2 where (attr1 < 2) = (attr2 < 2) order by pk1;
explain
select * from t3 left join t4 on t4.attr2 = t3.attr2 where t4.attr1 > 1 and t4.attr3 < 5 or t4.attr1 is null order by t4.pk1;
# bug#15722
create table t5 (a int primary key auto_increment, b tinytext not null)
engine = ndb;
insert into t5 (b) values ('jonas'), ('jensing'), ('johan');
set engine_condition_pushdown = off;
select * from t5 where b like '%jo%' order by a;
set engine_condition_pushdown = on;
explain select * from t5 where b like '%jo%';
select * from t5 where b like '%jo%' order by a;
set engine_condition_pushdown = @old_ecpd;
DROP TABLE t1,t2,t3,t4;
DROP TABLE t1,t2,t3,t4,t5;
......@@ -619,7 +619,15 @@ DELETE FROM t1;
CREATE UNIQUE INDEX ai ON t1(a);
INSERT IGNORE INTO t1 VALUES (1);
INSERT IGNORE INTO t1 VALUES (1);
INSERT IGNORE INTO t1 VALUES (NULL),(2);
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
# Ignore and NULL values
CREATE TABLE t1(pk INT NOT NULL PRIMARY KEY, a INT, UNIQUE (a)) ENGINE=ndb;
INSERT IGNORE INTO t1 VALUES (1,1),(2,2),(3,3);
INSERT IGNORE INTO t1 VALUES (4,NULL),(5,NULL),(6,NULL),(7,4);
SELECT * FROM t1 ORDER BY pk;
DROP TABLE t1;
# End of 4.1 tests
......@@ -849,4 +849,79 @@ CALL test.p1(12);
CALL test.p1(13);
drop table t1;
#
# Bug#18053 Partitions: crash if null
# Bug#18070 Partitions: wrong result on WHERE ... IS NULL
#
create table t1 (f1 integer) partition by range(f1)
(partition p1 values less than (0), partition p2 values less than (10));
insert into t1 set f1 = null;
select * from t1 where f1 is null;
explain partitions select * from t1 where f1 is null;
drop table t1;
create table t1 (f1 integer) partition by list(f1)
(partition p1 values in (1), partition p2 values in (null));
insert into t1 set f1 = null;
insert into t1 set f1 = 1;
select * from t1 where f1 is null or f1 = 1;
drop table t1;
create table t1 (f1 smallint)
partition by list (f1) (partition p0 values in (null));
insert into t1 values (null);
select * from t1 where f1 is null;
drop table t1;
create table t1 (f1 smallint)
partition by range (f1) (partition p0 values less than (0));
insert into t1 values (null);
select * from t1 where f1 is null;
drop table t1;
create table t1 (f1 integer) partition by list(f1)
(
partition p1 values in (1),
partition p2 values in (NULL),
partition p3 values in (2),
partition p4 values in (3),
partition p5 values in (4)
);
insert into t1 values (1),(2),(3),(4),(null);
select * from t1 where f1 < 3;
explain partitions select * from t1 where f1 < 3;
select * from t1 where f1 is null;
explain partitions select * from t1 where f1 is null;
drop table t1;
create table t1 (f1 int) partition by list(f1 div 2)
(
partition p1 values in (1),
partition p2 values in (NULL),
partition p3 values in (2),
partition p4 values in (3),
partition p5 values in (4)
);
insert into t1 values (2),(4),(6),(8),(null);
select * from t1 where f1 < 3;
explain partitions select * from t1 where f1 < 3;
select * from t1 where f1 is null;
explain partitions select * from t1 where f1 is null;
drop table t1;
create table t1 (a int) partition by LIST(a) (
partition pn values in (NULL),
partition p0 values in (0),
partition p1 values in (1),
partition p2 values in (2)
);
insert into t1 values (NULL),(0),(1),(2);
select * from t1 where a is null or a < 2;
explain partitions select * from t1 where a is null or a < 2;
select * from t1 where a is null or a < 0 or a > 1;
explain partitions select * from t1 where a is null or a < 0 or a > 1;
drop table t1;
--echo End of 5.1 tests
#
# Test of partitions that require symlinks
#
-- source include/have_partition.inc
-- require r/have_symlink.require
disable_query_log;
......
#################################
# Wrapper for rpl_row_sp007.test#
# These tests have been wrapped #
# so the same code can be used #
# For different engines #
#################################
-- source include/have_ndb.inc
let $engine_type=NDBCLUSTER;
-- source extra/rpl_tests/rpl_row_sp007.test
......@@ -74,6 +74,8 @@ handlerton ndbcluster_hton = {
DB_TYPE_NDBCLUSTER,
ndbcluster_init,
~(uint)0, /* slot */
/* below are initialized by name in ndbcluster_init() */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};
static handler *ndbcluster_create_handler(TABLE_SHARE *table)
......@@ -2336,7 +2338,7 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key,
if (generate_scan_filter(m_cond_stack, op))
DBUG_RETURN(ndb_err(trans));
if (res= define_read_attrs(buf, op))
if ((res= define_read_attrs(buf, op)))
{
DBUG_RETURN(res);
}
......@@ -8194,7 +8196,12 @@ void ndb_serialize_cond(const Item *item, void *arg)
context->expecting_field_result(INT_RESULT))
: true)) &&
// Bit fields no yet supported in scan filter
type != MYSQL_TYPE_BIT)
type != MYSQL_TYPE_BIT &&
// No BLOB support in scan filter
type != MYSQL_TYPE_TINY_BLOB &&
type != MYSQL_TYPE_MEDIUM_BLOB &&
type != MYSQL_TYPE_LONG_BLOB &&
type != MYSQL_TYPE_BLOB)
{
const NDBCOL *col= tab->getColumn(field->field_name);
DBUG_ASSERT(col);
......@@ -9235,7 +9242,7 @@ char* ha_ndbcluster::get_tablespace_name(THD *thd)
{
NdbDictionary::Tablespace ts= ndbdict->getTablespace(id);
ndberr= ndbdict->getNdbError();
if(ndberr.classification != ndberror_cl_none)
if(ndberr.classification != NdbError::NoError)
goto err;
return (my_strdup(ts.getName(), MYF(0)));
}
......
......@@ -2296,6 +2296,7 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond)
RANGE_OPT_PARAM *range_par= &prune_param.range_param;
prune_param.part_info= part_info;
prune_param.part_iter.has_null_value= FALSE;
init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0);
range_par->mem_root= &alloc;
......
......@@ -2868,9 +2868,6 @@ uint32 get_partition_id_range_for_endpoint(partition_info *part_info,
/* Get the partitioning function value for the endpoint */
longlong part_func_value= part_val_int(part_info->part_expr);
if (part_info->part_expr->null_value)
DBUG_RETURN(0);
while (max_part_id > min_part_id)
{
loc_part_id= (max_part_id + min_part_id + 1) >> 1;
......@@ -5745,6 +5742,19 @@ int get_part_iter_for_interval_via_mapping(partition_info *part_info,
else
DBUG_ASSERT(0);
if (field->real_maybe_null() && part_info->has_null_value)
{
if (*min_value)
{
if (*max_value && !(flags & (NO_MIN_RANGE | NO_MAX_RANGE)))
{
init_single_partition_iterator(part_info->has_null_part_id, part_iter);
return 1;
}
if (!(flags & NEAR_MIN))
part_iter->has_null_value= TRUE;
}
}
/* Find minimum */
if (flags & NO_MIN_RANGE)
part_iter->part_nums.start= 0;
......@@ -5956,7 +5966,14 @@ uint32 get_next_partition_id_range(PARTITION_ITERATOR* part_iter)
uint32 get_next_partition_id_list(PARTITION_ITERATOR *part_iter)
{
if (part_iter->part_nums.start == part_iter->part_nums.end)
{
if (part_iter->has_null_value)
{
part_iter->has_null_value= FALSE;
return part_iter->part_info->has_null_part_id;
}
return NOT_A_PARTITION_ID;
}
else
return part_iter->part_info->list_array[part_iter->
part_nums.start++].partition_id;
......
......@@ -124,7 +124,7 @@ typedef uint32 (*partition_iter_func)(st_partition_iter* part_iter);
typedef struct st_partition_iter
{
partition_iter_func get_next;
bool has_null_value;
struct st_part_num_range
{
uint32 start;
......
......@@ -1537,7 +1537,7 @@ static int runCreateDropNR(NDBT_Context* ctx, NDBT_Step* step)
break;
}
NdbDictionary::Table tmp(*pTab);
tmp.setNodeGroupIds(0, 0);
//tmp.setNodeGroupIds(0, 0);
if (ndb->getDictionary()->createTable(tmp) != 0){
g_err << "createTable failed: "
<< ndb->getDictionary()->getNdbError() << endl;
......
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