Merge c-0c0be253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/mysql-5.1-new

into  c-0c0be253.1238-1-64736c10.cust.bredbandsbolaget.se:/home/pappa/wl2604-push
parents 6ccfda09 a9ab4f9c
......@@ -143,10 +143,12 @@ void thr_unlock(THR_LOCK_DATA *data);
enum enum_thr_lock_result thr_multi_lock(THR_LOCK_DATA **data,
uint count, THR_LOCK_OWNER *owner);
void thr_multi_unlock(THR_LOCK_DATA **data,uint count);
void thr_abort_locks(THR_LOCK *lock);
void thr_abort_locks(THR_LOCK *lock, bool upgrade_lock);
my_bool thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread);
void thr_print_locks(void); /* For debugging */
my_bool thr_upgrade_write_delay_lock(THR_LOCK_DATA *data);
void thr_downgrade_write_lock(THR_LOCK_DATA *data,
enum thr_lock_type new_lock_type);
my_bool thr_reschedule_write_lock(THR_LOCK_DATA *data);
#ifdef __cplusplus
}
......
This diff is collapsed.
# include/partition_10.inc
#
# Do some basic checks on a table.
#
# FIXME: Do not write the statements and results, if SQL return code = 0
# and result set like expected. Write a message, that all is like
# expected instead.
#
# All SELECTs are so written, that we get my_value = 1, when everything
# is like expected.
#
--source include/partition_layout.inc
####### Variations with multiple records
# Select on empty table
SELECT COUNT(*) = 0 AS my_value FROM t1;
# (mass) Insert of $max_row records
eval INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN 1 AND $max_row;
# Select
eval SELECT (COUNT(*) = $max_row) AND (MIN(f1) = 1) AND (MAX(f1) = $max_row)
AS my_value FROM t1;
# DEBUG SELECT COUNT(*),MIN(f1),MAX(f1) FROM t1;
# (mass) Update $max_row_div4 * 2 + 1 records
eval UPDATE t1 SET f1 = f1 + $max_row
WHERE f1 BETWEEN $max_row_div2 - $max_row_div4 AND $max_row_div2 + $max_row_div4;
# Select
eval SELECT (COUNT(*) = $max_row) AND (MIN(f1) = 1) AND (MAX(f1) = $max_row_div2 + $max_row_div4 + $max_row )
AS my_value FROM t1;
# DEBUG SELECT COUNT(*),MIN(f1),MAX(f1) FROM t1;
# (mass) Delete $max_row_div4 * 2 + 1 records
eval DELETE FROM t1
WHERE f1 BETWEEN $max_row_div2 - $max_row_div4 + $max_row AND $max_row_div2 + $max_row_div4 + $max_row;
# Select
eval SELECT (COUNT(*) = $max_row - $max_row_div4 - $max_row_div4 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = $max_row)
AS my_value FROM t1;
# DEBUG SELECT COUNT(*),MIN(f1),MAX(f1) FROM t1;
####### Variations with single records
# Insert one record at beginning
INSERT INTO t1 SET f1 = 0 , f2 = '#######';
# Select this record
SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
# Insert one record at end
eval INSERT INTO t1 SET f1 = $max_row + 1, f2 = '#######';
# Select this record
eval SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = $max_row + 1 AND f2 = '#######';
# Update one record
eval UPDATE t1 SET f1 = $max_row + 2, f2 = 'ZZZZZZZ'
WHERE f1 = 0 AND f2 = '#######';
# Select
eval SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = $max_row + 2 AND f2 = 'ZZZZZZZ';
if ($fixed_bug15968)
{
# Bug #15968: Partitions: crash when INSERT with f1 = -1 into PARTITION BY HASH(f1)
eval UPDATE t1 SET f1 = 0 - 1, f2 = 'ZZZZZZZ'
WHERE f1 = $max_row + 1 AND f2 = '#######';
# Select
SELECT COUNT(*) AS my_value FROM t1 WHERE f1 = 0 - 1 AND f2 = 'ZZZZZZZ';
}
# Delete
eval DELETE FROM t1 WHERE f1 = $max_row + 2 AND f2 = 'ZZZZZZZ';
if ($fixed_bug15968)
{
DELETE FROM t1 WHERE f1 = 0 - 1 AND f2 = 'ZZZZZZZ';
}
# Select
SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
# Truncate
TRUNCATE t1;
# Select on empty table
SELECT COUNT(*) = 0 AS my_value FROM t1;
# include/partition_11.inc
#
# Try to create a table with the given partition number
#
eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
PARTITION BY HASH(f1) PARTITIONS $part_number;
--disable_query_log
eval SET @my_errno= $mysql_errno ;
let $run= `SELECT @my_errno = 0`;
--enable_query_log
#
# If this operation was successfull, check + drop this table
if ($run)
{
--source include/partition_10.inc
eval DROP TABLE t1;
}
#### Try to create a table with the given subpartition number
eval CREATE TABLE t1 ( f1 INTEGER, f2 char(20))
PARTITION BY RANGE(f1) SUBPARTITION BY HASH(f1)
SUBPARTITIONS $part_number
(PARTITION part1 VALUES LESS THAN ($max_row_div2), PARTITION part2 VALUES LESS THAN ($max_int_4));
--disable_query_log
eval SET @my_errno= $mysql_errno ;
let $run= `SELECT @my_errno = 0`;
--enable_query_log
#
# If this operation was successfull, check + drop this table
if ($run)
{
--source include/partition_10.inc
eval DROP TABLE t1;
}
# include/partition_12.inc
#
# Do some basic things on a table, if the SQL command executed just before
# sourcing this file was successful.
#
--source include/partition_layout.inc
####### Variations with multiple records
# (mass) Insert max_row_div2 + 1 records
eval INSERT INTO t1 SELECT * FROM t0_template WHERE f1 BETWEEN $max_row_div2 AND $max_row;
# Select
eval SELECT (COUNT(*) = $max_row) AND (MIN(f1) = 1) AND (MAX(f1) = $max_row)
AS my_value FROM t1;
# DEBUG SELECT COUNT(*),MIN(f1),MAX(f1) FROM t1;
# (mass) Update $max_row_div4 * 2 + 1 records
eval UPDATE t1 SET f1 = f1 + $max_row
WHERE f1 BETWEEN $max_row_div2 - $max_row_div4 AND $max_row_div2 + $max_row_div4;
# Select
eval SELECT (COUNT(*) = $max_row) AND (MIN(f1) = 1) AND (MAX(f1) = $max_row_div2 + $max_row_div4 + $max_row )
AS my_value FROM t1;
# DEBUG SELECT COUNT(*),MIN(f1),MAX(f1) FROM t1;
# (mass) Delete $max_row_div4 * 2 + 1 records
eval DELETE FROM t1
WHERE f1 BETWEEN $max_row_div2 - $max_row_div4 + $max_row AND $max_row_div2 + $max_row_div4 + $max_row;
# Select
eval SELECT (COUNT(*) = $max_row - $max_row_div4 - $max_row_div4 - 1) AND (MIN(f1) = 1) AND (MAX(f1) = $max_row)
AS my_value FROM t1;
# DEBUG SELECT COUNT(*),MIN(f1),MAX(f1) FROM t1;
####### Variations with single records
# Insert one record at beginning
INSERT INTO t1 SET f1 = 0 , f2 = '#######';
# Select this record
SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = 0 AND f2 = '#######';
# Insert one record at end
eval INSERT INTO t1 SET f1 = $max_row + 1, f2 = '#######';
# Select this record
eval SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = $max_row + 1 AND f2 = '#######';
# Update one record
eval UPDATE t1 SET f1 = $max_row + 2, f2 = 'ZZZZZZZ'
WHERE f1 = 0 AND f2 = '#######';
# Select
eval SELECT COUNT(*) = 1 AS my_value FROM t1 WHERE f1 = $max_row + 2 AND f2 = 'ZZZZZZZ';
if ($fixed_bug15968)
{
# Bug #15968: Partitions: crash when INSERT with f1 = -1 into PARTITION BY HASH(f1)
eval UPDATE t1 SET f1 = 0 - 1, f2 = 'ZZZZZZZ'
WHERE f1 = $max_row + 1 AND f2 = '#######';
# Select
SELECT COUNT(*) AS my_value FROM t1 WHERE f1 = 0 - 1 AND f2 = 'ZZZZZZZ';
}
# Delete
eval DELETE FROM t1 WHERE f1 = $max_row + 2 AND f2 = 'ZZZZZZZ';
if ($fixed_bug15968)
{
DELETE FROM t1 WHERE f1 = 0 - 1 AND f2 = 'ZZZZZZZ';
}
# Select
SELECT COUNT(*) = 0 AS my_value FROM t1 WHERE f2 = 'ZZZZZZZ';
# Truncate
TRUNCATE t1;
# Select on empty table
SELECT COUNT(*) = 0 AS my_value FROM t1;
# include/partition_layout.inc
#
# Print partitioning related informations about the table t1
#
eval SHOW CREATE TABLE t1;
# Optional (most probably issues with separators and case sensitivity)
# listing of files belonging to the table t1
if ($ls)
{
--exec ls var/master-data/test/t1*
}
......@@ -110,7 +110,7 @@ t3 CREATE TABLE `t3` (
`id` int(11) NOT NULL,
`name` char(255) default NULL,
PRIMARY KEY (`id`)
) ENGINE=NDBCLUSTER DEFAULT CHARSET=latin1
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY ()
select * from t3;
id name
1 Explorer
......
......@@ -9,7 +9,7 @@ t1 CREATE TABLE `t1` (
`pk1` int(11) NOT NULL,
`b` bit(64) default NULL,
PRIMARY KEY (`pk1`)
) ENGINE=NDBCLUSTER DEFAULT CHARSET=latin1
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY ()
insert into t1 values
(0,b'1111111111111111111111111111111111111111111111111111111111111111'),
(1,b'1000000000000000000000000000000000000000000000000000000000000000'),
......
......@@ -13,7 +13,7 @@ Table Create Table
gis_point CREATE TABLE `gis_point` (
`fid` int(11) default NULL,
`g` point default NULL
) ENGINE=NDBCLUSTER DEFAULT CHARSET=latin1
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY ()
SHOW FIELDS FROM gis_point;
Field Type Null Key Default Extra
fid int(11) YES NULL
......@@ -471,7 +471,7 @@ Table Create Table
gis_point CREATE TABLE `gis_point` (
`fid` int(11) default NULL,
`g` point default NULL
) ENGINE=NDBCLUSTER DEFAULT CHARSET=latin1
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY ()
SHOW FIELDS FROM gis_point;
Field Type Null Key Default Extra
fid int(11) YES NULL
......
......@@ -80,3 +80,12 @@ t1 CREATE TABLE `t1` (
PRIMARY KEY USING HASH (`a`,`b`,`c`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 PARTITION BY KEY (b)
DROP TABLE t1;
CREATE TABLE t1 (a int not null primary key)
PARTITION BY KEY(a)
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
drop table t1;
CREATE TABLE t1 (a int not null primary key);
ALTER TABLE t1
PARTITION BY KEY(a)
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
drop table t1;
......@@ -65,6 +65,8 @@ partitions 3
(partition x1 tablespace ts1,
partition x2 tablespace ts2,
partition x3 tablespace ts3);
CREATE TABLE t2 LIKE t1;
drop table t2;
drop table t1;
CREATE TABLE t1 (
a int not null,
......@@ -108,6 +110,127 @@ insert into t1 values (3);
insert into t1 values (4);
UNLOCK TABLES;
drop table t1;
CREATE TABLE t1 (a int, name VARCHAR(50), purchased DATE)
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (3),
PARTITION p1 VALUES LESS THAN (7),
PARTITION p2 VALUES LESS THAN (9),
PARTITION p3 VALUES LESS THAN (11));
INSERT INTO t1 VALUES
(1, 'desk organiser', '2003-10-15'),
(2, 'CD player', '1993-11-05'),
(3, 'TV set', '1996-03-10'),
(4, 'bookcase', '1982-01-10'),
(5, 'exercise bike', '2004-05-09'),
(6, 'sofa', '1987-06-05'),
(7, 'popcorn maker', '2001-11-22'),
(8, 'acquarium', '1992-08-04'),
(9, 'study desk', '1984-09-16'),
(10, 'lava lamp', '1998-12-25');
SELECT * from t1 ORDER BY a;
a name purchased
1 desk organiser 2003-10-15
2 CD player 1993-11-05
3 TV set 1996-03-10
4 bookcase 1982-01-10
5 exercise bike 2004-05-09
6 sofa 1987-06-05
7 popcorn maker 2001-11-22
8 acquarium 1992-08-04
9 study desk 1984-09-16
10 lava lamp 1998-12-25
ALTER TABLE t1 DROP PARTITION p0;
SELECT * from t1 ORDER BY a;
a name purchased
3 TV set 1996-03-10
4 bookcase 1982-01-10
5 exercise bike 2004-05-09
6 sofa 1987-06-05
7 popcorn maker 2001-11-22
8 acquarium 1992-08-04
9 study desk 1984-09-16
10 lava lamp 1998-12-25
drop table t1;
CREATE TABLE t1 (a int)
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (4,5,6));
insert into t1 values (1),(2),(3),(4),(5),(6);
select * from t1;
a
1
2
3
4
5
6
truncate t1;
select * from t1;
a
truncate t1;
select * from t1;
a
drop table t1;
CREATE TABLE t1 (a int, b int, primary key(a,b))
PARTITION BY KEY(b,a) PARTITIONS 4;
insert into t1 values (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6);
select * from t1 where a = 4;
a b
4 4
drop table t1;
CREATE TABLE t1 (a int)
PARTITION BY LIST (a)
PARTITIONS 1
(PARTITION x1 VALUES IN (1) ENGINE=MEMORY);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1 PARTITION BY LIST (a) (PARTITION x1 VALUES IN (1) ENGINE = MEMORY)
drop table t1;
CREATE TABLE t1 (a int, unique(a))
PARTITION BY LIST (a)
(PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20));
REPLACE t1 SET a = 4;
ERROR HY000: Table has no partition for value 4
drop table t1;
CREATE TABLE t1 (a int)
PARTITION BY LIST (a)
(PARTITION x1 VALUES IN (2), PARTITION x2 VALUES IN (3));
insert into t1 values (2), (3);
insert into t1 values (4);
ERROR HY000: Table has no partition for value 4
insert into t1 values (1);
ERROR HY000: Table has no partition for value 1
drop table t1;
CREATE TABLE t1 (a int)
PARTITION BY HASH(a)
PARTITIONS 5;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 PARTITION BY HASH (a) PARTITIONS 5
drop table t1;
CREATE TABLE t1 (a int)
PARTITION BY RANGE (a)
(PARTITION x1 VALUES LESS THAN (2));
insert into t1 values (1);
update t1 set a = 5;
ERROR HY000: Table has no partition for value 5
drop table t1;
CREATE TABLE t1 (a int)
PARTITION BY LIST (a)
(PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20));
analyze table t1;
Table Op Msg_type Msg_text
test.t1 analyze status OK
drop table t1;
CREATE TABLE `t1` (
`id` int(11) default NULL
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 PARTITION BY HASH (id) ;
SELECT * FROM t1;
id
drop table t1;
CREATE TABLE `t1` (
`id` int(11) default NULL
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 PARTITION BY HASH (id) ;
......@@ -119,8 +242,8 @@ create table t1
partition by range (a)
( partition p0 values less than(10),
partition p1 values less than (20),
partition p2 values less than maxvalue);
alter table t1 reorganise partition p2 into (partition p2 values less than (30));
partition p2 values less than (25));
alter table t1 reorganize partition p2 into (partition p2 values less than (30));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
......@@ -139,7 +262,7 @@ PARTITION x6 VALUES LESS THAN (14),
PARTITION x7 VALUES LESS THAN (16),
PARTITION x8 VALUES LESS THAN (18),
PARTITION x9 VALUES LESS THAN (20));
ALTER TABLE t1 REORGANISE PARTITION x0,x1,x2 INTO
ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2 INTO
(PARTITION x1 VALUES LESS THAN (6));
show create table t1;
Table Create Table
......
This diff is collapsed.
This diff is collapsed.
drop table if exists t1;
partition by list (a)
partitions 3
(partition x1 values in (1,2,9,4) tablespace ts1,
......@@ -544,6 +545,10 @@ partitions 2
partition x2 values in (5));
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 '4,
partition x2 values in (5))' at line 8
CREATE TABLE t1 (a int)
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (x1));
ERROR 42S22: Unknown column 'x1' in 'partition function'
CREATE TABLE t1(a int)
PARTITION BY RANGE (a) (PARTITION p1 VALUES LESS THAN(5));
insert into t1 values (10);
......
drop table if exists t1;
CREATE TABLE t1 (a int, b int)
PARTITION BY RANGE (a)
(PARTITION x0 VALUES LESS THAN (2),
......@@ -10,48 +11,52 @@ PARTITION x6 VALUES LESS THAN (14),
PARTITION x7 VALUES LESS THAN (16),
PARTITION x8 VALUES LESS THAN (18),
PARTITION x9 VALUES LESS THAN (20));
ALTER TABLE t1 REORGANISE PARTITION x0,x1 INTO
ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
(PARTITION x01 VALUES LESS THAN (2),
PARTITION x11 VALUES LESS THAN (5));
ERROR HY000: The new partitions cover a bigger range then the reorganised partitions do
ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
ALTER TABLE t1 DROP PARTITION x0, x1, x2, x3, x3;
ERROR HY000: Error in list of partitions to change
ERROR HY000: Error in list of partitions to DROP
ALTER TABLE t1 DROP PARTITION x0, x1, x2, x10;
ERROR HY000: Error in list of partitions to change
ERROR HY000: Error in list of partitions to DROP
ALTER TABLE t1 DROP PARTITION x10, x1, x2, x1;
ERROR HY000: Error in list of partitions to change
ERROR HY000: Error in list of partitions to DROP
ALTER TABLE t1 DROP PARTITION x10, x1, x2, x3;
ERROR HY000: Error in list of partitions to change
ALTER TABLE t1 REORGANISE PARTITION x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10 INTO
ERROR HY000: Error in list of partitions to DROP
ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10 INTO
(PARTITION x11 VALUES LESS THAN (22));
ERROR HY000: More partitions to reorganise than there are partitions
ALTER TABLE t1 REORGANISE PARTITION x0,x1,x2 INTO
ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2 INTO
(PARTITION x3 VALUES LESS THAN (6));
ERROR HY000: All partitions must have unique names in the table
ALTER TABLE t1 REORGANISE PARTITION x0, x2 INTO
ERROR HY000: Duplicate partition name x3
ALTER TABLE t1 REORGANIZE PARTITION x0, x2 INTO
(PARTITION x11 VALUES LESS THAN (2));
ERROR HY000: When reorganising a set of partitions they must be in consecutive order
ALTER TABLE t1 REORGANISE PARTITION x0, x1, x1 INTO
ALTER TABLE t1 REORGANIZE PARTITION x0, x1, x1 INTO
(PARTITION x11 VALUES LESS THAN (4));
ERROR HY000: Error in list of partitions to change
ALTER TABLE t1 REORGANISE PARTITION x0,x1 INTO
ERROR HY000: Error in list of partitions to REORGANIZE
ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
(PARTITION x01 VALUES LESS THAN (5));
ERROR HY000: The new partitions cover a bigger range then the reorganised partitions do
ALTER TABLE t1 REORGANISE PARTITION x0,x1 INTO
ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
(PARTITION x01 VALUES LESS THAN (4),
PARTITION x11 VALUES LESS THAN (2));
ERROR HY000: Reorganize of range partitions cannot change total ranges except for last partition where it can extend the range
ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
(PARTITION x01 VALUES LESS THAN (6),
PARTITION x11 VALUES LESS THAN (4));
ERROR HY000: VALUES LESS THAN value must be strictly increasing for each partition
DROP TABLE t1;
CREATE TABLE t1 (a int)
PARTITION BY KEY (a)
PARTITIONS 2;
ALTER TABLE t1 ADD PARTITION (PARTITION p1);
ERROR HY000: All partitions must have unique names in the table
ERROR HY000: Duplicate partition name p1
DROP TABLE t1;
CREATE TABLE t1 (a int)
PARTITION BY KEY (a)
(PARTITION x0, PARTITION x1, PARTITION x2, PARTITION x3, PARTITION x3);
ERROR HY000: All partitions must have unique names in the table
ERROR HY000: Duplicate partition name x3
CREATE TABLE t1 (a int)
PARTITION BY RANGE (a)
SUBPARTITION BY KEY (a)
......@@ -100,7 +105,7 @@ PARTITION x1 VALUES LESS THAN (8));
ALTER TABLE t1 ADD PARTITION PARTITIONS 1;
ERROR HY000: For RANGE partitions each partition must be defined
ALTER TABLE t1 DROP PARTITION x2;
ERROR HY000: Error in list of partitions to change
ERROR HY000: Error in list of partitions to DROP
ALTER TABLE t1 COALESCE PARTITION 1;
ERROR HY000: COALESCE PARTITION can only be used on HASH/KEY partitions
ALTER TABLE t1 DROP PARTITION x1;
......
......@@ -19,6 +19,7 @@ innodb_concurrent : Results are not deterministic, Elliot will fix (BUG#3300)
subselect : Bug#15706
ps_7ndb : dbug assert in RBR mode when executing test suite
rpl_ddl : Bug#15963 SBR does not show "Definer" correctly
partition_03ndb : Bug#16385
events : Affects flush test case. A table lock not released somewhere
ndb_binlog_basic : Results are not deterministic, Tomas will fix
rpl_ndb_basic : Bug#16228
......
......@@ -63,3 +63,19 @@ insert into t1 values (1,"a",1,1),(2,"a",1,1),(3,"a",1,1);
show create table t1;
DROP TABLE t1;
#
# Bug #13155: Problem in Create Table using SHOW CREATE TABLE syntax
#
CREATE TABLE t1 (a int not null primary key)
PARTITION BY KEY(a)
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
drop table t1;
CREATE TABLE t1 (a int not null primary key);
ALTER TABLE t1
PARTITION BY KEY(a)
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
drop table t1;
......@@ -8,6 +8,7 @@
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# Partition by key no partition defined => OK
#
......@@ -97,6 +98,9 @@ partitions 3
partition x2 tablespace ts2,
partition x3 tablespace ts3);
CREATE TABLE t2 LIKE t1;
drop table t2;
drop table t1;
#
......@@ -162,6 +166,141 @@ UNLOCK TABLES;
drop table t1;
#
# Bug #13644 DROP PARTITION NULL's DATE column
#
CREATE TABLE t1 (a int, name VARCHAR(50), purchased DATE)
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (3),
PARTITION p1 VALUES LESS THAN (7),
PARTITION p2 VALUES LESS THAN (9),
PARTITION p3 VALUES LESS THAN (11));
INSERT INTO t1 VALUES
(1, 'desk organiser', '2003-10-15'),
(2, 'CD player', '1993-11-05'),
(3, 'TV set', '1996-03-10'),
(4, 'bookcase', '1982-01-10'),
(5, 'exercise bike', '2004-05-09'),
(6, 'sofa', '1987-06-05'),
(7, 'popcorn maker', '2001-11-22'),
(8, 'acquarium', '1992-08-04'),
(9, 'study desk', '1984-09-16'),
(10, 'lava lamp', '1998-12-25');
SELECT * from t1 ORDER BY a;
ALTER TABLE t1 DROP PARTITION p0;
SELECT * from t1 ORDER BY a;
drop table t1;
#
# Bug #13442; Truncate Partitioned table doesn't work
#
CREATE TABLE t1 (a int)
PARTITION BY LIST (a)
(PARTITION p0 VALUES IN (1,2,3), PARTITION p1 VALUES IN (4,5,6));
insert into t1 values (1),(2),(3),(4),(5),(6);
select * from t1;
truncate t1;
select * from t1;
truncate t1;
select * from t1;
drop table t1;
#
# Bug #13445 Partition by KEY method crashes server
#
CREATE TABLE t1 (a int, b int, primary key(a,b))
PARTITION BY KEY(b,a) PARTITIONS 4;
insert into t1 values (0,0),(1,1),(2,2),(3,3),(4,4),(5,5),(6,6);
select * from t1 where a = 4;
drop table t1;
#
# Bug #13438: Engine clause in PARTITION clause causes crash
#
CREATE TABLE t1 (a int)
PARTITION BY LIST (a)
PARTITIONS 1
(PARTITION x1 VALUES IN (1) ENGINE=MEMORY);
show create table t1;
drop table t1;
#
# Bug #13440: REPLACE causes crash in partitioned table
#
CREATE TABLE t1 (a int, unique(a))
PARTITION BY LIST (a)
(PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20));
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
REPLACE t1 SET a = 4;
drop table t1;
#
# Bug #14365: Crash if value too small in list partitioned table
#
CREATE TABLE t1 (a int)
PARTITION BY LIST (a)
(PARTITION x1 VALUES IN (2), PARTITION x2 VALUES IN (3));
insert into t1 values (2), (3);
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
insert into t1 values (4);
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
insert into t1 values (1);
drop table t1;
#
# Bug 14327: PARTITIONS clause gets lost in SHOW CREATE TABLE
#
CREATE TABLE t1 (a int)
PARTITION BY HASH(a)
PARTITIONS 5;
SHOW CREATE TABLE t1;
drop table t1;
#
# Bug #13446: Update to value outside of list values doesn't give error
#
CREATE TABLE t1 (a int)
PARTITION BY RANGE (a)
(PARTITION x1 VALUES LESS THAN (2));
insert into t1 values (1);
--error ER_NO_PARTITION_FOR_GIVEN_VALUE
update t1 set a = 5;
drop table t1;
#
# Bug #13441: Analyze on partitioned table didn't work
#
CREATE TABLE t1 (a int)
PARTITION BY LIST (a)
(PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20));
analyze table t1;
drop table t1;
#
# BUG 14524
#
CREATE TABLE `t1` (
`id` int(11) default NULL
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1 PARTITION BY HASH (id) ;
SELECT * FROM t1;
drop table t1;
#
# BUG 14524
#
......@@ -180,9 +319,9 @@ create table t1
partition by range (a)
( partition p0 values less than(10),
partition p1 values less than (20),
partition p2 values less than maxvalue);
partition p2 values less than (25));
alter table t1 reorganise partition p2 into (partition p2 values less than (30));
alter table t1 reorganize partition p2 into (partition p2 values less than (30));
show create table t1;
drop table t1;
......@@ -199,7 +338,8 @@ PARTITION BY RANGE (a)
PARTITION x8 VALUES LESS THAN (18),
PARTITION x9 VALUES LESS THAN (20));
ALTER TABLE t1 REORGANISE PARTITION x0,x1,x2 INTO
ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2 INTO
(PARTITION x1 VALUES LESS THAN (6));
show create table t1;
drop table t1;
###############################################
# #
# Partition tests MyISAM tables #
# #
###############################################
#
# NOTE: PLEASE DO NOT ADD NOT MYISAM SPECIFIC TESTCASES HERE !
# NON STORAGE SPECIFIC TESTCASES SHOULD BE ADDED IN
# THE SOURCED FIELS ONLY.
#
# Storage engine to be tested
let $engine= 'MYISAM';
eval SET SESSION storage_engine=$engine;
# Other storage engine <> storage engine to be tested
let $engine_other= 'MEMORY';
# number of rows for the INSERT/UPDATE/DELETE/SELECT experiments
# on partioned tables
# Attention: In the moment the result files fit to @max_row = 200 only
SET @max_row = 200;
-- source include/partition_1.inc
###############################################
# #
# Partition tests NDB tables #
# #
###############################################
#
# NOTE: PLEASE DO NOT ADD NOT NDB SPECIFIC TESTCASES HERE !
# NON STORAGE SPECIFIC TESTCASES SHOULD BE ADDED IN
# THE SOURCED FIELS ONLY.
#
# Storage engine to be tested
let $engine= 'NDB' ;
-- source include/have_ndb.inc
eval SET SESSION storage_engine=$engine;
# Other storage engine <> storage engine to be tested
let $engine_other= 'MEMORY';
# number of rows for the INSERT/UPDATE/DELETE/SELECT experiments
# on partioned tables
# Attention: In the moment the result files fit to @max_row = 200 only
SET @max_row = 200;
-- source include/partition_1.inc
......@@ -4,6 +4,10 @@
#
-- source include/have_partition.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# Partition by key stand-alone error
#
......@@ -727,6 +731,14 @@ partitions 2
(partition x1 values in 4,
partition x2 values in (5));
#
# Bug #13439: Crash when LESS THAN (non-literal)
#
--error 1054
CREATE TABLE t1 (a int)
PARTITION BY RANGE (a)
(PARTITION p0 VALUES LESS THAN (x1));
#
# No partition for the given value
#
......
......@@ -4,6 +4,10 @@
#
-- source include/have_partition.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# Try faulty DROP PARTITION and COALESCE PARTITION
#
......@@ -21,7 +25,7 @@ PARTITION BY RANGE (a)
PARTITION x9 VALUES LESS THAN (20));
--error ER_REORG_OUTSIDE_RANGE
ALTER TABLE t1 REORGANISE PARTITION x0,x1 INTO
ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
(PARTITION x01 VALUES LESS THAN (2),
PARTITION x11 VALUES LESS THAN (5));
......@@ -38,30 +42,35 @@ ALTER TABLE t1 DROP PARTITION x10, x1, x2, x1;
ALTER TABLE t1 DROP PARTITION x10, x1, x2, x3;
--error ER_REORG_PARTITION_NOT_EXIST
ALTER TABLE t1 REORGANISE PARTITION x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10 INTO
ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10 INTO
(PARTITION x11 VALUES LESS THAN (22));
--error ER_SAME_NAME_PARTITION
ALTER TABLE t1 REORGANISE PARTITION x0,x1,x2 INTO
ALTER TABLE t1 REORGANIZE PARTITION x0,x1,x2 INTO
(PARTITION x3 VALUES LESS THAN (6));
--error ER_CONSECUTIVE_REORG_PARTITIONS
ALTER TABLE t1 REORGANISE PARTITION x0, x2 INTO
ALTER TABLE t1 REORGANIZE PARTITION x0, x2 INTO
(PARTITION x11 VALUES LESS THAN (2));
--error ER_DROP_PARTITION_NON_EXISTENT
ALTER TABLE t1 REORGANISE PARTITION x0, x1, x1 INTO
ALTER TABLE t1 REORGANIZE PARTITION x0, x1, x1 INTO
(PARTITION x11 VALUES LESS THAN (4));
--error ER_REORG_OUTSIDE_RANGE
ALTER TABLE t1 REORGANISE PARTITION x0,x1 INTO
ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
(PARTITION x01 VALUES LESS THAN (5));
--error ER_RANGE_NOT_INCREASING_ERROR
ALTER TABLE t1 REORGANISE PARTITION x0,x1 INTO
--error ER_REORG_OUTSIDE_RANGE
ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
(PARTITION x01 VALUES LESS THAN (4),
PARTITION x11 VALUES LESS THAN (2));
--error ER_RANGE_NOT_INCREASING_ERROR
ALTER TABLE t1 REORGANIZE PARTITION x0,x1 INTO
(PARTITION x01 VALUES LESS THAN (6),
PARTITION x11 VALUES LESS THAN (4));
DROP TABLE t1;
CREATE TABLE t1 (a int)
......
......@@ -1009,7 +1009,7 @@ void thr_multi_unlock(THR_LOCK_DATA **data,uint count)
TL_WRITE_ONLY to abort any new accesses to the lock
*/
void thr_abort_locks(THR_LOCK *lock)
void thr_abort_locks(THR_LOCK *lock, bool upgrade_lock)
{
THR_LOCK_DATA *data;
DBUG_ENTER("thr_abort_locks");
......@@ -1031,7 +1031,7 @@ void thr_abort_locks(THR_LOCK *lock)
lock->read_wait.last= &lock->read_wait.data;
lock->write_wait.last= &lock->write_wait.data;
lock->read_wait.data=lock->write_wait.data=0;
if (lock->write.data)
if (upgrade_lock && lock->write.data)
lock->write.data->type=TL_WRITE_ONLY;
pthread_mutex_unlock(&lock->mutex);
DBUG_VOID_RETURN;
......@@ -1089,6 +1089,213 @@ my_bool thr_abort_locks_for_thread(THR_LOCK *lock, pthread_t thread)
}
/*
Downgrade a WRITE_* to a lower WRITE level
SYNOPSIS
thr_downgrade_write_lock()
in_data Lock data of thread downgrading its lock
new_lock_type New write lock type
RETURN VALUE
NONE
DESCRIPTION
This can be used to downgrade a lock already owned. When the downgrade
occurs also other waiters, both readers and writers can be allowed to
start.
The previous lock is often TL_WRITE_ONLY but can also be
TL_WRITE and TL_WRITE_ALLOW_READ. The normal downgrade variants are
TL_WRITE_ONLY => TL_WRITE_ALLOW_READ After a short exclusive lock
TL_WRITE_ALLOW_READ => TL_WRITE_ALLOW_WRITE After discovering that the
operation didn't need such a high lock.
TL_WRITE_ONLY => TL_WRITE after a short exclusive lock while holding a
write table lock
TL_WRITE_ONLY => TL_WRITE_ALLOW_WRITE After a short exclusive lock after
already earlier having dongraded lock to TL_WRITE_ALLOW_WRITE
The implementation is conservative and rather don't start rather than
go on unknown paths to start, the common cases are handled.
NOTE:
In its current implementation it is only allowed to downgrade from
TL_WRITE_ONLY. In this case there are no waiters. Thus no wake up
logic is required.
*/
void thr_downgrade_write_lock(THR_LOCK_DATA *in_data,
enum thr_lock_type new_lock_type)
{
THR_LOCK *lock=in_data->lock;
THR_LOCK_DATA *data, *next;
enum thr_lock_type old_lock_type= in_data->type;
bool start_writers= FALSE;
bool start_readers= FALSE;
DBUG_ENTER("thr_downgrade_write_only_lock");
pthread_mutex_lock(&lock->mutex);
DBUG_ASSERT(old_lock_type == TL_WRITE_ONLY);
DBUG_ASSERT(old_lock_type > new_lock_type);
in_data->type= new_lock_type;
check_locks(lock,"after downgrading lock",0);
#if 0
switch (old_lock_type)
{
case TL_WRITE_ONLY:
case TL_WRITE:
case TL_WRITE_LOW_PRIORITY:
/*
Previous lock was exclusive we are now ready to start up most waiting
threads.
*/
switch (new_lock_type)
{
case TL_WRITE_ALLOW_READ:
/* Still cannot start WRITE operations. Can only start readers. */
start_readers= TRUE;
break;
case TL_WRITE:
case TL_WRITE_LOW_PRIORITY:
/*
Still cannot start anything, but new requests are no longer
aborted.
*/
break;
case TL_WRITE_ALLOW_WRITE:
/*
We can start both writers and readers.
*/
start_writers= TRUE;
start_readers= TRUE;
break;
case TL_WRITE_CONCURRENT_INSERT:
case TL_WRITE_DELAYED:
/*
This routine is not designed for those. Lock will be downgraded
but no start of waiters will occur. This is not the optimal but
should be a correct behaviour.
*/
break;
default:
DBUG_ASSERT(0);
}
break;
case TL_WRITE_DELAYED:
case TL_WRITE_CONCURRENT_INSERT:
/*
This routine is not designed for those. Lock will be downgraded
but no start of waiters will occur. This is not the optimal but
should be a correct behaviour.
*/
break;
case TL_WRITE_ALLOW_READ:
DBUG_ASSERT(new_lock_type == TL_WRITE_ALLOW_WRITE);
/*
Previously writers were not allowed to start, now it is ok to
start them again. Readers are already allowed so no reason to
handle them.
*/
start_writers= TRUE;
break;
default:
DBUG_ASSERT(0);
break;
}
if (start_writers)
{
/*
At this time the only active writer can be ourselves. Thus we need
not worry about that there are other concurrent write operations
active on the table. Thus we only need to worry about starting
waiting operations.
We also only come here with TL_WRITE_ALLOW_WRITE as the new
lock type, thus we can start other writers also of the same type.
If we find a lock at exclusive level >= TL_WRITE_LOW_PRIORITY we
don't start any more operations that would be mean those operations
will have to wait for things started afterwards.
*/
DBUG_ASSERT(new_lock_type == TL_WRITE_ALLOW_WRITE);
for (data=lock->write_wait.data; data ; data= next)
{
/*
All WRITE requests compatible with new lock type are also
started
*/
next= data->next;
if (start_writers && data->type == new_lock_type)
{
pthread_cond_t *cond= data->cond;
/*
It is ok to start this waiter.
Move from being first in wait queue to be last in write queue.
*/
if (((*data->prev)= data->next))
data->next->prev= data->prev;
else
lock->write_wait.last= data->prev;
data->prev= lock->write.last;
lock->write.last= &data->next;
data->next= 0;
check_locks(lock, "Started write lock after downgrade",0);
data->cond= 0;
pthread_cond_signal(cond);
}
else
{
/*
We found an incompatible lock, we won't start any more write
requests to avoid letting writers pass other writers in the
queue.
*/
start_writers= FALSE;
if (data->type >= TL_WRITE_LOW_PRIORITY)
{
/*
We have an exclusive writer in the queue so we won't start
readers either.
*/
start_readers= FALSE;
}
}
}
}
if (start_readers)
{
DBUG_ASSERT(new_lock_type == TL_WRITE_ALLOW_WRITE ||
new_lock_type == TL_WRITE_ALLOW_READ);
/*
When we come here we know that the write locks are
TL_WRITE_ALLOW_WRITE or TL_WRITE_ALLOW_READ. This means that reads
are ok
*/
for (data=lock->read_wait.data; data ; data=next)
{
next= data->next;
/*
All reads are ok to start now except TL_READ_NO_INSERT when
write lock is TL_WRITE_ALLOW_READ.
*/
if (new_lock_type != TL_WRITE_ALLOW_READ ||
data->type != TL_READ_NO_INSERT)
{
pthread_cond_t *cond= data->cond;
if (((*data->prev)= data->next))
data->next->prev= data->prev;
else
lock->read_wait.last= data->prev;
data->prev= lock->read.last;
lock->read.last= &data->next;
data->next= 0;
if (data->type == TL_READ_NO_INSERT)
lock->read_no_write_count++;
check_locks(lock, "Started read lock after downgrade",0);
data->cond= 0;
pthread_cond_signal(cond);
}
}
}
check_locks(lock,"after starting waiters after downgrading lock",0);
#endif
pthread_mutex_unlock(&lock->mutex);
DBUG_VOID_RETURN;
}
/* Upgrade a WRITE_DELAY lock to a WRITE_LOCK */
......
......@@ -170,6 +170,8 @@ handlerton archive_hton = {
NULL, /* Start Consistent Snapshot */
NULL, /* Flush logs */
NULL, /* Show status */
NULL, /* Partition flags */
NULL, /* Alter table flags */
NULL, /* Alter interface */
HTON_NO_FLAGS
};
......
......@@ -149,6 +149,8 @@ handlerton berkeley_hton = {
NULL, /* Start Consistent Snapshot */
berkeley_flush_logs, /* Flush logs */
berkeley_show_status, /* Show status */
NULL, /* Partition flags */
NULL, /* Alter table flags */
NULL, /* Alter Tablespace */
HTON_CLOSE_CURSORS_AT_COMMIT | HTON_FLUSH_AFTER_RENAME
};
......
......@@ -57,6 +57,8 @@ handlerton blackhole_hton= {
NULL, /* Start Consistent Snapshot */
NULL, /* Flush logs */
NULL, /* Show status */
NULL, /* Partition flags */
NULL, /* Alter table flags */
NULL, /* Alter Tablespace */
HTON_CAN_RECREATE
};
......
......@@ -394,6 +394,8 @@ handlerton federated_hton= {
NULL, /* Start Consistent Snapshot */
NULL, /* Flush logs */
NULL, /* Show status */
NULL, /* Partition flags */
NULL, /* Alter table flags */
NULL, /* Alter Tablespace */
HTON_ALTER_NOT_SUPPORTED
};
......
......@@ -54,6 +54,8 @@ handlerton heap_hton= {
NULL, /* Start Consistent Snapshot */
NULL, /* Flush logs */
NULL, /* Show status */
NULL, /* Partition flags */
NULL, /* Alter table flags */
NULL, /* Alter Tablespace */
HTON_CAN_RECREATE
};
......
......@@ -235,6 +235,8 @@ handlerton innobase_hton = {
innobase_start_trx_and_assign_read_view, /* Start Consistent Snapshot */
innobase_flush_logs, /* Flush logs */
innobase_show_status, /* Show status */
NULL, /* Partition flags */
NULL, /* Alter table flags */
HTON_NO_FLAGS
};
......
......@@ -86,6 +86,8 @@ handlerton myisam_hton= {
NULL, /* Start Consistent Snapshot */
NULL, /* Flush logs */
NULL, /* Show status */
NULL, /* Partition flags */
NULL, /* Alter table flags */
NULL, /* Alter Tablespace */
HTON_CAN_RECREATE
};
......
......@@ -64,6 +64,8 @@ handlerton myisammrg_hton= {
NULL, /* Start Consistent Snapshot */
NULL, /* Flush logs */
NULL, /* Show status */
NULL, /* Partition flags */
NULL, /* Alter table flags */
NULL, /* Alter Tablespace */
HTON_CAN_RECREATE
};
......
This diff is collapsed.
This diff is collapsed.
......@@ -260,7 +260,7 @@ void ndbcluster_binlog_init_share(NDB_SHARE *share, TABLE *_table)
break;
}
if ((error= open_table_from_share(thd, table_share, "", 0,
(uint) READ_ALL, 0, table)))
(uint) READ_ALL, 0, table, FALSE)))
{
sql_print_error("Unable to open table for %s, error=%d(%d)",
share->key, error, my_errno);
......@@ -1219,7 +1219,7 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp,
pOp->getReqNodeId() != g_ndb_cluster_connection->node_id())
{
ndb->setDatabaseName(share->table->s->db.str);
ha_ndbcluster::invalidate_dictionary_cache(share->table,
ha_ndbcluster::invalidate_dictionary_cache(share->table->s,
ndb,
share->table->s->table_name.str,
TRUE);
......
This diff is collapsed.
This diff is collapsed.
......@@ -63,7 +63,7 @@ const handlerton default_hton =
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL,
create_default,
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
HTON_NO_FLAGS
};
......@@ -2160,7 +2160,8 @@ int ha_create_table(THD *thd, const char *path,
init_tmp_table_share(&share, db, 0, table_name, path);
if (open_table_def(thd, &share, 0) ||
open_table_from_share(thd, &share, "", 0, (uint) READ_ALL, 0, &table))
open_table_from_share(thd, &share, "", 0, (uint) READ_ALL, 0, &table,
TRUE))
goto err;
if (update_create_info)
......@@ -2237,7 +2238,7 @@ int ha_create_table_from_engine(THD* thd, const char *db, const char *name)
{
DBUG_RETURN(3);
}
if (open_table_from_share(thd, &share, "" ,0, 0, 0, &table))
if (open_table_from_share(thd, &share, "" ,0, 0, 0, &table, FALSE))
{
free_table_share(&share);
DBUG_RETURN(3);
......
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