Commit 534a421b authored by Mattias Jonsson's avatar Mattias Jonsson

merge

parents 009d5097 d675e7b0
# connection default
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
CREATE TABLE t1
(
id SMALLINT NOT NULL,
PRIMARY KEY (id)
) ENGINE=innodb
PARTITION BY RANGE (id)
(
PARTITION p1 VALUES LESS THAN (2),
PARTITION p2 VALUES LESS THAN (4),
PARTITION p3 VALUES LESS THAN (10)
);
INSERT INTO t1 VALUES (1),(2),(3);
# Test READ COMMITTED -> REPEATABLE READ
FLUSH TABLES;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SELECT * FROM t1;
id
1
2
3
#connection con1
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
INSERT INTO t1 VALUES(7);
COMMIT;
# connection default
COMMIT;
FLUSH TABLES;
# Test REPEATABLE READ -> READ COMMITTED
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t1;
id
1
2
3
7
# connection con1
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
INSERT INTO t1 VALUES(9);
ERROR HY000: Binary logging not possible. Message: Transaction level 'READ-COMMITTED' in InnoDB is not safe for binlog mode 'STATEMENT'
COMMIT;
COMMIT;
DROP TABLE t1;
......@@ -43,8 +43,13 @@ SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
if (!$skip_update)
{
# InnoDB Does not handle this correctly, see bug#14793, bug#21641
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
FLUSH TABLES;
UPDATE t1 SET c1 = 40 WHERE c1 = 50;
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
AND TABLE_NAME='t1';
-- error 0, ER_BAD_NULL_ERROR
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
if (!$mysql_errno)
......@@ -83,6 +88,16 @@ TRUNCATE TABLE t1;
INSERT INTO t1 VALUES (NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1 ORDER BY c1;
INSERT INTO t1 VALUES (100);
INSERT INTO t1 VALUES (NULL);
if (!$skip_delete)
{
DELETE FROM t1 WHERE c1 >= 100;
}
# InnoDB does reset auto_increment on OPTIMIZE, Bug#18274
# Archive does reset auto_increment on OPTIMIZE, Bug#40216
OPTIMIZE TABLE t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
-- echo # Simple test with NULL
......@@ -184,6 +199,10 @@ if (!$skip_update)
{
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
FLUSH TABLES;
UPDATE t1 SET c1 = 140 WHERE c1 = 150;
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
AND TABLE_NAME='t1';
-- error 0, ER_BAD_NULL_ERROR
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
if (!$mysql_errno)
......@@ -295,6 +314,15 @@ TRUNCATE TABLE t1;
INSERT INTO t1 VALUES (NULL);
SHOW CREATE TABLE t1;
SELECT * FROM t1 ORDER BY c1;
INSERT INTO t1 VALUES (100);
INSERT INTO t1 VALUES (NULL);
if (!$skip_delete)
{
DELETE FROM t1 WHERE c1 >= 100;
}
# InnoDB does reset auto_increment on OPTIMIZE, Bug#18274
OPTIMIZE TABLE t1;
SHOW CREATE TABLE t1;
DROP TABLE t1;
-- echo # Test with two threads
......
......@@ -13,7 +13,6 @@
# part_optA-D Extra partitioning options (E.g. INDEX/DATA DIR) #
# #
# have_bug33158 NDB case insensitive create, but case sensitive rename #
# have_bug37719 Archive, crash when rename and then select #
#------------------------------------------------------------------------------#
# Original Author: mattiasj #
# Original Date: 2008-06-27 #
......@@ -125,18 +124,12 @@ PARTITION BY KEY (a)
PARTITION PartD $part_optD);
INSERT INTO tablea VALUES (1), (2), (7), (8), (9), (10);
SHOW TABLES;
if (!$have_bug37719)
{
RENAME TABLE TableA to tableA;
}
--sorted_result
SELECT * FROM tablea;
if (!$have_bug37719)
{
--sorted_result
SELECT * FROM tableA;
RENAME TABLE tableA to TableA;
}
SHOW CREATE TABLE tablea;
DROP TABLE tablea;
}
......@@ -262,18 +255,12 @@ PARTITION BY HASH (a)
PARTITION PartD $part_optD);
INSERT INTO tablea VALUES (1), (2), (7), (8), (9), (10);
SHOW TABLES;
if (!$have_bug37719)
{
RENAME TABLE TableA to tableA;
}
--sorted_result
SELECT * FROM tablea;
if (!$have_bug37719)
{
--sorted_result
SELECT * FROM tableA;
RENAME TABLE tableA to TableA;
}
SHOW CREATE TABLE tablea;
DROP TABLE tablea;
}
......@@ -388,18 +375,12 @@ PARTITION BY RANGE (a)
PARTITION PartD VALUES LESS THAN (13) $part_optD);
INSERT INTO tablea VALUES (1), (2), (7), (8), (9), (10);
SHOW TABLES;
if (!$have_bug37719)
{
RENAME TABLE TableA to tableA;
}
--sorted_result
SELECT * FROM tablea;
if (!$have_bug37719)
{
--sorted_result
SELECT * FROM tableA;
RENAME TABLE tableA to TableA;
}
SHOW CREATE TABLE tablea;
DROP TABLE tablea;
}
......@@ -516,18 +497,12 @@ PARTITION BY LIST (a)
PARTITION PartD VALUES IN (5,6,12) $part_optD);
INSERT INTO tablea VALUES (1), (2), (7), (8), (9), (10);
SHOW TABLES;
if (!$have_bug37719)
{
RENAME TABLE TableA to tableA;
}
--sorted_result
SELECT * FROM tablea;
if (!$have_bug37719)
{
--sorted_result
SELECT * FROM tableA;
RENAME TABLE tableA to TableA;
}
SHOW CREATE TABLE tablea;
DROP TABLE tablea;
}
......
......@@ -105,6 +105,17 @@ c1
5
6
7
INSERT INTO t1 VALUES (100);
INSERT INTO t1 VALUES (NULL);
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
DROP TABLE t1;
# Simple test with NULL
CREATE TABLE t1 (
......@@ -368,6 +379,19 @@ c1
25
26
27
INSERT INTO t1 VALUES (100);
INSERT INTO t1 VALUES (NULL);
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
DROP TABLE t1;
# Test with two threads
# con default
......
......@@ -36,6 +36,12 @@ SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
FLUSH TABLES;
UPDATE t1 SET c1 = 40 WHERE c1 = 50;
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
AND TABLE_NAME='t1';
AUTO_INCREMENT
1
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
INSERT INTO t1 VALUES (NULL);
......@@ -96,6 +102,18 @@ t1 CREATE TABLE `t1` (
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
SELECT * FROM t1 ORDER BY c1;
c1
INSERT INTO t1 VALUES (100);
INSERT INTO t1 VALUES (NULL);
DELETE FROM t1 WHERE c1 >= 100;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize note The storage engine for the table doesn't support optimize
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
DROP TABLE t1;
# Simple test with NULL
CREATE TABLE t1 (
......@@ -167,6 +185,12 @@ INSERT INTO t1 VALUES (NULL), (90);
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
FLUSH TABLES;
UPDATE t1 SET c1 = 140 WHERE c1 = 150;
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
AND TABLE_NAME='t1';
AUTO_INCREMENT
1
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
# ERROR (only OK if Blackhole) should give ER_DUP_KEY or ER_DUP_ENTRY
INSERT INTO t1 VALUES (NULL);
......@@ -278,6 +302,20 @@ t1 CREATE TABLE `t1` (
PARTITIONS 2 */
SELECT * FROM t1 ORDER BY c1;
c1
INSERT INTO t1 VALUES (100);
INSERT INTO t1 VALUES (NULL);
DELETE FROM t1 WHERE c1 >= 100;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize note The storage engine for the table doesn't support optimize
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
DROP TABLE t1;
# Test with two threads
# con default
......
......@@ -35,6 +35,12 @@ SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
FLUSH TABLES;
UPDATE t1 SET c1 = 40 WHERE c1 = 50;
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
AND TABLE_NAME='t1';
AUTO_INCREMENT
31
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
......@@ -52,7 +58,7 @@ c1
30
31
32
50
40
51
DROP TABLE t1;
CREATE TABLE t1 (
......@@ -110,6 +116,19 @@ t1 CREATE TABLE `t1` (
SELECT * FROM t1 ORDER BY c1;
c1
1
INSERT INTO t1 VALUES (100);
INSERT INTO t1 VALUES (NULL);
DELETE FROM t1 WHERE c1 >= 100;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
DROP TABLE t1;
# Simple test with NULL
CREATE TABLE t1 (
......@@ -189,6 +208,12 @@ INSERT INTO t1 VALUES (NULL), (90);
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
FLUSH TABLES;
UPDATE t1 SET c1 = 140 WHERE c1 = 150;
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
AND TABLE_NAME='t1';
AUTO_INCREMENT
141
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
......@@ -209,10 +234,10 @@ c1
60
90
91
150
140
141
142
151
152
153
DROP TABLE t1;
# Test with auto_increment_increment and auto_increment_offset.
CREATE TABLE t1 (
......@@ -359,6 +384,21 @@ PARTITIONS 2 */
SELECT * FROM t1 ORDER BY c1;
c1
1
INSERT INTO t1 VALUES (100);
INSERT INTO t1 VALUES (NULL);
DELETE FROM t1 WHERE c1 >= 100;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
DROP TABLE t1;
# Test with two threads
# con default
......
......@@ -35,6 +35,12 @@ SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
FLUSH TABLES;
UPDATE t1 SET c1 = 40 WHERE c1 = 50;
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
AND TABLE_NAME='t1';
AUTO_INCREMENT
52
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
......@@ -50,7 +56,7 @@ c1
22
23
30
50
40
51
52
53
......@@ -110,6 +116,18 @@ t1 CREATE TABLE `t1` (
SELECT * FROM t1 ORDER BY c1;
c1
1
INSERT INTO t1 VALUES (100);
INSERT INTO t1 VALUES (NULL);
DELETE FROM t1 WHERE c1 >= 100;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize note The storage engine for the table doesn't support optimize
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=MEMORY AUTO_INCREMENT=102 DEFAULT CHARSET=latin1
DROP TABLE t1;
# Simple test with NULL
CREATE TABLE t1 (
......@@ -189,6 +207,12 @@ INSERT INTO t1 VALUES (NULL), (90);
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
FLUSH TABLES;
UPDATE t1 SET c1 = 140 WHERE c1 = 150;
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
AND TABLE_NAME='t1';
AUTO_INCREMENT
152
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
......@@ -209,7 +233,7 @@ c1
60
90
91
150
140
151
152
153
......@@ -359,6 +383,20 @@ PARTITIONS 2 */
SELECT * FROM t1 ORDER BY c1;
c1
27
INSERT INTO t1 VALUES (100);
INSERT INTO t1 VALUES (NULL);
DELETE FROM t1 WHERE c1 >= 100;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize note The storage engine for the table doesn't support optimize
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=MEMORY AUTO_INCREMENT=102 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
DROP TABLE t1;
# Test with two threads
# con default
......
......@@ -35,6 +35,12 @@ SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
FLUSH TABLES;
UPDATE t1 SET c1 = 40 WHERE c1 = 50;
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
AND TABLE_NAME='t1';
AUTO_INCREMENT
52
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
......@@ -50,7 +56,7 @@ c1
22
23
30
50
40
51
52
53
......@@ -110,6 +116,18 @@ t1 CREATE TABLE `t1` (
SELECT * FROM t1 ORDER BY c1;
c1
1
INSERT INTO t1 VALUES (100);
INSERT INTO t1 VALUES (NULL);
DELETE FROM t1 WHERE c1 >= 100;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=MyISAM AUTO_INCREMENT=102 DEFAULT CHARSET=latin1
DROP TABLE t1;
# Simple test with NULL
CREATE TABLE t1 (
......@@ -189,6 +207,12 @@ INSERT INTO t1 VALUES (NULL), (90);
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
FLUSH TABLES;
UPDATE t1 SET c1 = 140 WHERE c1 = 150;
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
AND TABLE_NAME='t1';
AUTO_INCREMENT
152
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
......@@ -209,7 +233,7 @@ c1
60
90
91
150
140
151
152
153
......@@ -359,6 +383,20 @@ PARTITIONS 2 */
SELECT * FROM t1 ORDER BY c1;
c1
27
INSERT INTO t1 VALUES (100);
INSERT INTO t1 VALUES (NULL);
DELETE FROM t1 WHERE c1 >= 100;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize status OK
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=MyISAM AUTO_INCREMENT=102 DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
DROP TABLE t1;
# Test with two threads
# con default
......
......@@ -36,6 +36,12 @@ SET INSERT_ID = 30;
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 50 WHERE c1 = 17;
UPDATE t1 SET c1 = 51 WHERE c1 = 19;
FLUSH TABLES;
UPDATE t1 SET c1 = 40 WHERE c1 = 50;
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
AND TABLE_NAME='t1';
AUTO_INCREMENT
52
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
......@@ -51,7 +57,7 @@ c1
22
23
30
50
40
51
52
53
......@@ -111,6 +117,18 @@ t1 CREATE TABLE `t1` (
SELECT * FROM t1 ORDER BY c1;
c1
1
INSERT INTO t1 VALUES (100);
INSERT INTO t1 VALUES (NULL);
DELETE FROM t1 WHERE c1 >= 100;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize note The storage engine for the table doesn't support optimize
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
DROP TABLE t1;
# Simple test with NULL
CREATE TABLE t1 (
......@@ -190,6 +208,12 @@ INSERT INTO t1 VALUES (NULL), (90);
INSERT INTO t1 VALUES (NULL);
UPDATE t1 SET c1 = 150 WHERE c1 = 17;
UPDATE t1 SET c1 = 151 WHERE c1 = 19;
FLUSH TABLES;
UPDATE t1 SET c1 = 140 WHERE c1 = 150;
SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test'
AND TABLE_NAME='t1';
AUTO_INCREMENT
152
UPDATE t1 SET c1 = NULL WHERE c1 = 4;
INSERT INTO t1 VALUES (NULL);
INSERT INTO t1 VALUES (NULL);
......@@ -210,7 +234,7 @@ c1
60
90
91
150
140
151
152
153
......@@ -360,6 +384,20 @@ PARTITIONS 2 */
SELECT * FROM t1 ORDER BY c1;
c1
1
INSERT INTO t1 VALUES (100);
INSERT INTO t1 VALUES (NULL);
DELETE FROM t1 WHERE c1 >= 100;
OPTIMIZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 optimize note The storage engine for the table doesn't support optimize
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`c1`)
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
/*!50100 PARTITION BY HASH (c1)
PARTITIONS 2 */
DROP TABLE t1;
# Test with two threads
# con default
......
......@@ -170,26 +170,30 @@ SHOW TABLES;
Tables_in_MySQL_Test_DB
TableA
tablea
RENAME TABLE TableA to tableA;
SELECT * FROM tablea;
a
1
1
10
2
7
8
9
SELECT * FROM tableA;
a
1
10
11
12
2
2
3
4
5
6
7
7
8
8
9
9
RENAME TABLE tableA to TableA;
SHOW CREATE TABLE tablea;
Table Create Table
tablea CREATE TABLE `tablea` (
......@@ -206,7 +210,6 @@ ALTER TABLE TableA REMOVE PARTITIONING;
SELECT * FROM TableA;
a
1
1
10
11
12
......@@ -216,10 +219,7 @@ a
5
6
7
7
8
8
9
9
SHOW CREATE TABLE TableA;
Table Create Table
......@@ -406,26 +406,30 @@ SHOW TABLES;
Tables_in_MySQL_Test_DB
TableA
tablea
RENAME TABLE TableA to tableA;
SELECT * FROM tablea;
a
1
1
10
2
7
8
9
SELECT * FROM tableA;
a
1
10
11
12
2
2
3
4
5
6
7
7
8
8
9
9
RENAME TABLE tableA to TableA;
SHOW CREATE TABLE tablea;
Table Create Table
tablea CREATE TABLE `tablea` (
......@@ -442,21 +446,16 @@ ALTER TABLE TableA REMOVE PARTITIONING;
SELECT * FROM TableA;
a
1
1
10
10
11
12
2
2
3
4
5
6
7
8
8
9
9
SHOW CREATE TABLE TableA;
Table Create Table
......@@ -638,26 +637,30 @@ SHOW TABLES;
Tables_in_MySQL_Test_DB
TableA
tablea
RENAME TABLE TableA to tableA;
SELECT * FROM tablea;
a
1
1
10
2
7
8
9
SELECT * FROM tableA;
a
1
10
11
12
2
2
3
4
5
6
7
7
8
8
9
9
RENAME TABLE tableA to TableA;
SHOW CREATE TABLE tablea;
Table Create Table
tablea CREATE TABLE `tablea` (
......@@ -674,23 +677,17 @@ ALTER TABLE TableA REMOVE PARTITIONING;
SELECT * FROM TableA;
a
1
1
10
10
11
12
2
2
3
4
5
6
7
7
8
8
9
9
SHOW CREATE TABLE TableA;
Table Create Table
TableA CREATE TABLE `TableA` (
......@@ -866,23 +863,27 @@ SHOW TABLES;
Tables_in_MySQL_Test_DB
TableA
tablea
RENAME TABLE TableA to tableA;
SELECT * FROM tablea;
a
1
1
10
12
2
7
8
9
SELECT * FROM tableA;
a
1
12
3
4
5
6
7
7
8
8
9
9
RENAME TABLE tableA to TableA;
SHOW CREATE TABLE tablea;
Table Create Table
tablea CREATE TABLE `tablea` (
......@@ -899,19 +900,13 @@ ALTER TABLE TableA REMOVE PARTITIONING;
SELECT * FROM TableA;
a
1
1
10
12
2
3
4
5
6
7
7
8
8
9
9
SHOW CREATE TABLE TableA;
Table Create Table
......
......@@ -31,7 +31,6 @@
#------------------------------------------------------------------------------#
# Engine specific settings and requirements
let $have_bug37719= 1;
##### Storage engine to be tested
--source include/have_archive.inc
......
--source include/have_binlog_format_statement.inc
--source include/have_innodb.inc
--echo # connection default
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
CREATE TABLE t1
(
id SMALLINT NOT NULL,
PRIMARY KEY (id)
) ENGINE=innodb
PARTITION BY RANGE (id)
(
PARTITION p1 VALUES LESS THAN (2),
PARTITION p2 VALUES LESS THAN (4),
PARTITION p3 VALUES LESS THAN (10)
);
INSERT INTO t1 VALUES (1),(2),(3);
--echo # Test READ COMMITTED -> REPEATABLE READ
FLUSH TABLES;
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
SELECT * FROM t1;
connect (con1, localhost, root,,);
connection con1;
--echo #connection con1
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
INSERT INTO t1 VALUES(7);
COMMIT;
connection default;
--echo # connection default
COMMIT;
FLUSH TABLES;
--echo # Test REPEATABLE READ -> READ COMMITTED
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
BEGIN;
SELECT * FROM t1;
connection con1;
--echo # connection con1
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
BEGIN;
--error ER_BINLOG_LOGGING_IMPOSSIBLE
INSERT INTO t1 VALUES(9);
COMMIT;
disconnect con1;
connection default;
COMMIT;
DROP TABLE t1;
This diff is collapsed.
......@@ -48,6 +48,13 @@ typedef struct st_ha_data_partition
} HA_DATA_PARTITION;
#define PARTITION_BYTES_IN_POS 2
#define PARTITION_ENABLED_TABLE_FLAGS (HA_FILE_BASED | HA_REC_NOT_IN_SEQ)
#define PARTITION_DISABLED_TABLE_FLAGS (HA_CAN_GEOMETRY | \
HA_CAN_FULLTEXT | \
HA_DUPLICATE_POS | \
HA_CAN_SQL_HANDLER | \
HA_CAN_INSERT_DELAYED | \
HA_PRIMARY_KEY_REQUIRED_FOR_POSITION)
class ha_partition :public handler
{
private:
......@@ -92,8 +99,15 @@ private:
for this since the MySQL Server sometimes allocating the handler object
without freeing them.
*/
longlong m_table_flags;
ulong m_low_byte_first;
enum enum_handler_status
{
handler_not_initialized= 0,
handler_initialized,
handler_opened,
handler_closed
};
enum_handler_status m_handler_status;
uint m_reorged_parts; // Number of reorganised parts
uint m_tot_parts; // Total number of partitions;
......@@ -189,7 +203,7 @@ public:
enable later calls of the methods to retrieve constants from the under-
lying handlers. Returns false if not successful.
*/
bool initialise_partition(MEM_ROOT *mem_root);
bool initialize_partition(MEM_ROOT *mem_root);
/*
-------------------------------------------------------------------------
......@@ -594,6 +608,8 @@ public:
The partition handler will support whatever the underlying handlers
support except when specifically mentioned below about exceptions
to this rule.
NOTE: This cannot be cached since it can depend on TRANSACTION ISOLATION
LEVEL which is dynamic, see bug#39084.
HA_READ_RND_SAME:
Not currently used. (Means that the handler supports the rnd_same() call)
......@@ -718,9 +734,33 @@ public:
transfer those calls into index_read and other calls in the
index scan module.
(NDB)
HA_PRIMARY_KEY_REQUIRED_FOR_POSITION:
Does the storage engine need a PK for position?
Used with hidden primary key in InnoDB.
Hidden primary keys cannot be supported by partitioning, since the
partitioning expressions columns must be a part of the primary key.
(InnoDB)
HA_FILE_BASED is always set for partition handler since we use a
special file for handling names of partitions, engine types.
HA_REC_NOT_IN_SEQ is always set for partition handler since we cannot
guarantee that the records will be returned in sequence.
HA_CAN_GEOMETRY, HA_CAN_FULLTEXT, HA_CAN_SQL_HANDLER, HA_DUPLICATE_POS,
HA_CAN_INSERT_DELAYED, HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is disabled
until further investigated.
*/
virtual ulonglong table_flags() const
{ return m_table_flags; }
virtual Table_flags table_flags() const
{
DBUG_ENTER("ha_partition::table_flags");
if (m_handler_status < handler_initialized ||
m_handler_status >= handler_closed)
DBUG_RETURN(PARTITION_ENABLED_TABLE_FLAGS);
else
DBUG_RETURN((m_file[0]->ha_table_flags() &
~(PARTITION_DISABLED_TABLE_FLAGS)) |
(PARTITION_ENABLED_TABLE_FLAGS));
}
/*
This is a bitmap of flags that says how the storage engine
......@@ -892,10 +932,10 @@ private:
{
HA_DATA_PARTITION *ha_data= (HA_DATA_PARTITION*) table_share->ha_data;
lock_auto_increment();
DBUG_ASSERT(ha_data->auto_inc_initialized == TRUE);
/* must check when the mutex is taken */
if (nr >= ha_data->next_auto_inc_val)
ha_data->next_auto_inc_val= nr + 1;
ha_data->auto_inc_initialized= TRUE;
unlock_auto_increment();
}
......@@ -903,7 +943,7 @@ public:
/*
-------------------------------------------------------------------------
MODULE initialise handler for HANDLER call
MODULE initialize handler for HANDLER call
-------------------------------------------------------------------------
This method is a special InnoDB method called before a HANDLER query.
-------------------------------------------------------------------------
......
......@@ -263,7 +263,7 @@ handler *get_ha_partition(partition_info *part_info)
DBUG_ENTER("get_ha_partition");
if ((partition= new ha_partition(partition_hton, part_info)))
{
if (partition->initialise_partition(current_thd->mem_root))
if (partition->initialize_partition(current_thd->mem_root))
{
delete partition;
partition= 0;
......
......@@ -1198,6 +1198,9 @@ public:
{
return inited == INDEX ? ha_index_end() : inited == RND ? ha_rnd_end() : 0;
}
/**
The cached_table_flags is set at ha_open and ha_external_lock
*/
Table_flags ha_table_flags() const { return cached_table_flags; }
/**
These functions represent the public interface to *users* of the
......
......@@ -171,7 +171,7 @@ int archive_db_init(void *p)
if (pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST))
goto error;
if (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0,
if (hash_init(&archive_open_tables, table_alias_charset, 32, 0, 0,
(hash_get_key) archive_get_key, 0, 0))
{
VOID(pthread_mutex_destroy(&archive_mutex));
......
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