This repository has been archived by the owner on Jul 26, 2022. It is now read-only.
forked from facebook/mysql-5.6
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More tests in suite/rocksdb: tbl_opt_ai, update_with_keys.
- Loading branch information
Showing
4 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
DROP TABLE IF EXISTS t1; | ||
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE=rocksdb AUTO_INCREMENT=10; | ||
SHOW CREATE TABLE t1; | ||
Table Create Table | ||
t1 CREATE TABLE `t1` ( | ||
`a` int(11) NOT NULL AUTO_INCREMENT, | ||
PRIMARY KEY (`a`) | ||
) ENGINE=ROCKSDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1 | ||
INSERT INTO t1 VALUES (NULL); | ||
SELECT * FROM t1; | ||
a | ||
10 | ||
ALTER TABLE t1 AUTO_INCREMENT=100; | ||
SHOW CREATE TABLE t1; | ||
Table Create Table | ||
t1 CREATE TABLE `t1` ( | ||
`a` int(11) NOT NULL AUTO_INCREMENT, | ||
PRIMARY KEY (`a`) | ||
) ENGINE=ROCKSDB AUTO_INCREMENT=100 DEFAULT CHARSET=latin1 | ||
INSERT INTO t1 VALUES (NULL); | ||
SELECT * FROM t1 ORDER BY a; | ||
a | ||
10 | ||
100 | ||
ALTER TABLE t1 AUTO_INCREMENT=50; | ||
SHOW CREATE TABLE t1; | ||
Table Create Table | ||
t1 CREATE TABLE `t1` ( | ||
`a` int(11) NOT NULL AUTO_INCREMENT, | ||
PRIMARY KEY (`a`) | ||
) ENGINE=ROCKSDB AUTO_INCREMENT=101 DEFAULT CHARSET=latin1 | ||
INSERT INTO t1 VALUES (NULL); | ||
SELECT * FROM t1 ORDER BY a; | ||
a | ||
10 | ||
100 | ||
101 | ||
DROP TABLE t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# | ||
# Check whether AUTO_INCREMENT option | ||
# is supported in CREATE and ALTER TABLE | ||
# | ||
|
||
--disable_warnings | ||
DROP TABLE IF EXISTS t1; | ||
--enable_warnings | ||
|
||
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY) ENGINE=rocksdb AUTO_INCREMENT=10; | ||
SHOW CREATE TABLE t1; | ||
INSERT INTO t1 VALUES (NULL); | ||
SELECT * FROM t1; | ||
|
||
ALTER TABLE t1 AUTO_INCREMENT=100; | ||
SHOW CREATE TABLE t1; | ||
INSERT INTO t1 VALUES (NULL); | ||
SELECT * FROM t1 ORDER BY a; | ||
|
||
ALTER TABLE t1 AUTO_INCREMENT=50; | ||
SHOW CREATE TABLE t1; | ||
INSERT INTO t1 VALUES (NULL); | ||
SELECT * FROM t1 ORDER BY a; | ||
|
||
DROP TABLE t1; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
DROP TABLE IF EXISTS t1; | ||
CREATE TABLE t1 (a INT, b CHAR(8), pk INT AUTO_INCREMENT PRIMARY KEY, INDEX(b)) ENGINE=rocksdb; | ||
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'x'),(7,'y'),(8,'z'); | ||
UPDATE t1 SET a=100, b='f' WHERE b IN ('b','c'); | ||
UPDATE t1 SET b='m' WHERE b = 'f'; | ||
UPDATE t1 SET b='z' WHERE a < 2; | ||
UPDATE t1 SET b=''; | ||
SELECT a,b FROM t1; | ||
a b | ||
1 | ||
100 | ||
100 | ||
4 | ||
5 | ||
6 | ||
7 | ||
8 | ||
DROP TABLE t1; | ||
# RocksDB: skip the test for secondary UNIQUE keys. | ||
CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb; | ||
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(0,'f'),(100,'a'); | ||
UPDATE t1 SET a=a+200; | ||
UPDATE t1 SET a=0 WHERE a > 250; | ||
UPDATE t1 SET a=205 WHERE a=200; | ||
ERROR 23000: Duplicate entry '205' for key 'PRIMARY' | ||
UPDATE t1 SET a=12345 ORDER BY a DESC, b LIMIT 1; | ||
SELECT a,b FROM t1; | ||
a b | ||
0 a | ||
12345 e | ||
200 f | ||
201 a | ||
202 b | ||
203 c | ||
204 d | ||
UPDATE t1 SET a=80 WHERE a IN (202,203); | ||
ERROR 23000: Duplicate entry '80' for key 'PRIMARY' | ||
DROP TABLE t1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# | ||
# UPDATE statements for tables with keys | ||
# | ||
|
||
############################################# | ||
# TODO: | ||
# The test doesn't work quite as expected, | ||
# apparently due to "can't see own changes" | ||
############################################# | ||
|
||
--disable_warnings | ||
DROP TABLE IF EXISTS t1; | ||
--enable_warnings | ||
|
||
CREATE TABLE t1 (a INT, b CHAR(8), pk INT AUTO_INCREMENT PRIMARY KEY, INDEX(b)) ENGINE=rocksdb; | ||
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(6,'x'),(7,'y'),(8,'z'); | ||
UPDATE t1 SET a=100, b='f' WHERE b IN ('b','c'); | ||
UPDATE t1 SET b='m' WHERE b = 'f'; | ||
UPDATE t1 SET b='z' WHERE a < 2; | ||
UPDATE t1 SET b=''; | ||
--sorted_result | ||
SELECT a,b FROM t1; | ||
DROP TABLE t1; | ||
|
||
--echo # RocksDB: skip the test for secondary UNIQUE keys. | ||
--disable_parsing | ||
--error ER_GET_ERRMSG | ||
CREATE TABLE t1 (a INT, b CHAR(8), pk INT AUTO_INCREMENT PRIMARY KEY, UNIQUE INDEX(a)) ENGINE=innodb; | ||
|
||
|
||
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(0,'f'),(100,'a'); | ||
UPDATE t1 SET a=a+200; | ||
UPDATE t1 SET a=0 WHERE a > 250; | ||
--error ER_DUP_ENTRY | ||
UPDATE t1 SET a=205 WHERE a=200; | ||
UPDATE t1 SET a=12345 ORDER BY a, b LIMIT 1; | ||
--sorted_result | ||
SELECT a,b FROM t1; | ||
|
||
--error ER_DUP_ENTRY | ||
UPDATE t1 SET a=80 WHERE a IN (202,203); | ||
--sorted_result | ||
SELECT a,b FROM t1; | ||
DROP TABLE t1; | ||
|
||
CREATE TABLE t1 (a INT, b CHAR(8), pk INT AUTO_INCREMENT PRIMARY KEY, UNIQUE INDEX(a,b)) ENGINE=rocksdb; | ||
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(100,'a'),(6,'f'); | ||
UPDATE t1 SET a=6 WHERE a=3; | ||
--error ER_DUP_ENTRY | ||
UPDATE t1 SET a=100 WHERE a=1; | ||
--error ER_DUP_ENTRY | ||
UPDATE t1 SET a=4, b='d' WHERE b='f'; | ||
UPDATE t1 SET a=a+1; | ||
--sorted_result | ||
SELECT a,b FROM t1; | ||
--error ER_DUP_ENTRY | ||
UPDATE t1 SET b='z'; | ||
DROP TABLE t1; | ||
|
||
--enable_parsing | ||
|
||
CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb; | ||
INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'),(4,'d'),(5,'e'),(0,'f'),(100,'a'); | ||
UPDATE t1 SET a=a+200; | ||
UPDATE t1 SET a=0 WHERE a > 250; | ||
--error ER_DUP_ENTRY | ||
UPDATE t1 SET a=205 WHERE a=200; | ||
UPDATE t1 SET a=12345 ORDER BY a DESC, b LIMIT 1; | ||
|
||
--sorted_result | ||
SELECT a,b FROM t1; | ||
|
||
--error ER_DUP_ENTRY | ||
UPDATE t1 SET a=80 WHERE a IN (202,203); | ||
DROP TABLE t1; | ||
|