Skip to content
This repository has been archived by the owner on Jul 26, 2022. It is now read-only.

Commit

Permalink
Add passing tests in mysql-test/suite/rocksdb (based on mysql-test/su…
Browse files Browse the repository at this point in the history
…ite/leveldb)
  • Loading branch information
spetrunia authored and Jonah Cohen committed Dec 19, 2014
1 parent 7072722 commit de1fc8a
Show file tree
Hide file tree
Showing 174 changed files with 15,210 additions and 0 deletions.
22 changes: 22 additions & 0 deletions mysql-test/suite/rocksdb/1st.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (pk INT PRIMARY KEY DEFAULT '0', a INT(11), b CHAR(8)) ENGINE=rocksdb;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL DEFAULT '0',
`a` int(11) DEFAULT NULL,
`b` char(8) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
pk int(11) NO PRI 0
a int(11) YES NULL
b char(8) YES NULL
INSERT INTO t1 VALUES (1, 1,'a');
INSERT INTO t1 (a,b) VALUES (2,'b');
SELECT a,b FROM t1;
a b
1 a
2 b
DROP TABLE t1;
34 changes: 34 additions & 0 deletions mysql-test/suite/rocksdb/1st.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#
# This test checks some very basic capabilities
# which will be used in almost every other test,
# and will not be checked through support* variables.
# If this test does not pass, there is no point
# at executing other ones.
#
# Minimal requirements:
# - supported column types: INT, CHAR (default CHAR(8), INT(11));
# - column attributes as declared in define_engine.inc ($default_col_opts)
# (by default empty, which means no additional attributes apart from the type);
# - table attributes as declared in define_engine.inc ($default_tbl_opts)
# (by default empty, which means no additional attributes apart from ENGINE);
# - CREATE TABLE .. (column1 <column options>, column2 <column options>) ENGINE=<storage_engine>;
# - INSERT INTO TABLE .. VALUES (val1,val2);
# - DROP TABLE ..
# - SELECT a,b FROM ..
# - SHOW CREATE TABLE ..
# - SHOW COLUMNS IN ...
#

--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings

CREATE TABLE t1 (pk INT PRIMARY KEY DEFAULT '0', a INT(11), b CHAR(8)) ENGINE=rocksdb;
SHOW CREATE TABLE t1;
SHOW COLUMNS IN t1;
INSERT INTO t1 VALUES (1, 1,'a');
INSERT INTO t1 (a,b) VALUES (2,'b');
--sorted_result
SELECT a,b FROM t1;
DROP TABLE t1;

181 changes: 181 additions & 0 deletions mysql-test/suite/rocksdb/alter_table.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
DROP TABLE IF EXISTS t1, t2;
CREATE TABLE t1 (pk INT PRIMARY KEY, a INT, c CHAR(8)) ENGINE=rocksdb;
INSERT INTO t1 VALUES (1,1,'a'),(2,5,'z');
ALTER TABLE t1 ADD COLUMN b INT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`a` int(11) DEFAULT NULL,
`c` char(8) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
ALTER TABLE t1 ALTER COLUMN a SET DEFAULT '0';
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`a` int(11) DEFAULT '0',
`c` char(8) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
ALTER TABLE t1 ALTER a DROP DEFAULT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`a` int(11),
`c` char(8) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
ALTER TABLE t1 CHANGE COLUMN b b1 CHAR(8) FIRST;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b1` char(8) DEFAULT NULL,
`pk` int(11) NOT NULL,
`a` int(11),
`c` char(8) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
ALTER TABLE t1 CHANGE b1 b INT AFTER c;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`a` int(11),
`c` char(8) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
ALTER TABLE t1 CHANGE b b CHAR(8);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`a` int(11),
`c` char(8) DEFAULT NULL,
`b` char(8) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
ALTER TABLE t1 MODIFY COLUMN b INT;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`a` int(11),
`c` char(8) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
ALTER TABLE t1 MODIFY COLUMN b CHAR(8) FIRST;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`b` char(8) DEFAULT NULL,
`pk` int(11) NOT NULL,
`a` int(11),
`c` char(8) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
ALTER TABLE t1 MODIFY COLUMN b INT AFTER a;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`a` int(11),
`b` int(11) DEFAULT NULL,
`c` char(8) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
ALTER TABLE t1 DROP COLUMN b;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`a` int(11),
`c` char(8) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
ALTER TABLE t1 RENAME TO t2;
SHOW CREATE TABLE t1;
ERROR 42S02: Table 'test.t1' doesn't exist
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`pk` int(11) NOT NULL,
`a` int(11),
`c` char(8) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
DROP TABLE t2;
CREATE TABLE t1 (pk INT PRIMARY KEY, a INT, b INT) ENGINE=rocksdb;
INSERT INTO t1 VALUES (1,1,5),(2,2,2),(3,4,3);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
ALTER TABLE t1 ORDER BY b ASC, a DESC, pk DESC;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
SELECT * FROM t1;
pk a b
1 1 5
2 2 2
3 4 3
DROP TABLE t1;
CREATE TABLE t1 (pk INT PRIMARY KEY, a INT, b CHAR(8), c CHAR(8)) ENGINE=rocksdb CHARACTER SET latin1 COLLATE latin1_general_cs;
INSERT INTO t1 VALUES (1,5,'z','t');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`a` int(11) DEFAULT NULL,
`b` char(8) COLLATE latin1_general_cs DEFAULT NULL,
`c` char(8) COLLATE latin1_general_cs DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_cs
ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`a` int(11) DEFAULT NULL,
`b` char(8) DEFAULT NULL,
`c` char(8) DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=utf8
ALTER TABLE t1 DEFAULT CHARACTER SET = latin1 COLLATE latin1_general_ci;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`a` int(11) DEFAULT NULL,
`b` char(8) CHARACTER SET utf8 DEFAULT NULL,
`c` char(8) CHARACTER SET utf8 DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
ALTER TABLE t1 FORCE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`pk` int(11) NOT NULL,
`a` int(11) DEFAULT NULL,
`b` char(8) CHARACTER SET utf8 DEFAULT NULL,
`c` char(8) CHARACTER SET utf8 DEFAULT NULL,
PRIMARY KEY (`pk`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci
DROP TABLE t1;
92 changes: 92 additions & 0 deletions mysql-test/suite/rocksdb/alter_table.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#
# Basic ALTER TABLE statements.
#
# USAGE of table options in ALTER statements
# is covered in tbl_standard_opts and tbl_opt*.tests.
#
# Index operations are covered in index* tests.
#
# ALTER OFFLINE is not covered as it is not supported, as of 5.5.23
#

--disable_warnings
DROP TABLE IF EXISTS t1, t2;
--enable_warnings

CREATE TABLE t1 (pk INT PRIMARY KEY, a INT, c CHAR(8)) ENGINE=rocksdb;
INSERT INTO t1 VALUES (1,1,'a'),(2,5,'z');

# Column operations

ALTER TABLE t1 ADD COLUMN b INT;
SHOW CREATE TABLE t1;

ALTER TABLE t1 ALTER COLUMN a SET DEFAULT '0';
SHOW CREATE TABLE t1;

ALTER TABLE t1 ALTER a DROP DEFAULT;
SHOW CREATE TABLE t1;

ALTER TABLE t1 CHANGE COLUMN b b1 CHAR(8) FIRST;
SHOW CREATE TABLE t1;

ALTER TABLE t1 CHANGE b1 b INT AFTER c;
SHOW CREATE TABLE t1;

ALTER TABLE t1 CHANGE b b CHAR(8);
SHOW CREATE TABLE t1;

ALTER TABLE t1 MODIFY COLUMN b INT;
SHOW CREATE TABLE t1;

ALTER TABLE t1 MODIFY COLUMN b CHAR(8) FIRST;
SHOW CREATE TABLE t1;

ALTER TABLE t1 MODIFY COLUMN b INT AFTER a;
SHOW CREATE TABLE t1;

ALTER TABLE t1 DROP COLUMN b;
SHOW CREATE TABLE t1;


# Rename table

ALTER TABLE t1 RENAME TO t2;
--error ER_NO_SUCH_TABLE
SHOW CREATE TABLE t1;
SHOW CREATE TABLE t2;
DROP TABLE t2;


# ORDER BY
CREATE TABLE t1 (pk INT PRIMARY KEY, a INT, b INT) ENGINE=rocksdb;
INSERT INTO t1 VALUES (1,1,5),(2,2,2),(3,4,3);
SHOW CREATE TABLE t1;

ALTER TABLE t1 ORDER BY b ASC, a DESC, pk DESC;
SHOW CREATE TABLE t1;
SELECT * FROM t1;
DROP TABLE t1;


# Character set, collate

CREATE TABLE t1 (pk INT PRIMARY KEY, a INT, b CHAR(8), c CHAR(8)) ENGINE=rocksdb CHARACTER SET latin1 COLLATE latin1_general_cs;
INSERT INTO t1 VALUES (1,5,'z','t');
SHOW CREATE TABLE t1;

ALTER TABLE t1 CONVERT TO CHARACTER SET utf8;
SHOW CREATE TABLE t1;

ALTER TABLE t1 DEFAULT CHARACTER SET = latin1 COLLATE latin1_general_ci;
SHOW CREATE TABLE t1;


# A 'null' ALTER operation

ALTER TABLE t1 FORCE;
SHOW CREATE TABLE t1;

DROP TABLE t1;


29 changes: 29 additions & 0 deletions mysql-test/suite/rocksdb/analyze_table.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (pk INT PRIMARY KEY, a INT(11), b CHAR(8)) ENGINE=rocksdb;
INSERT INTO t1 VALUES (1,1,'a'),(2,2,'b');
CREATE TABLE t2 (pk INT PRIMARY KEY, a INT(11), b CHAR(8)) ENGINE=rocksdb;
INSERT INTO t1 VALUES (3,3,'c');
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze note The storage engine for the table doesn't support analyze
INSERT INTO t2 VALUES (1,4,'d');
ANALYZE NO_WRITE_TO_BINLOG TABLE t2;
Table Op Msg_type Msg_text
test.t2 analyze note The storage engine for the table doesn't support analyze
INSERT INTO t1 VALUES (4,5,'e');
INSERT INTO t2 VALUES (2,6,'f');
ANALYZE LOCAL TABLE t1, t2;
Table Op Msg_type Msg_text
test.t1 analyze note The storage engine for the table doesn't support analyze
test.t2 analyze note The storage engine for the table doesn't support analyze
DROP TABLE t1, t2;
CREATE TABLE t1 (pk INT PRIMARY KEY, a INT(11), KEY(a)) ENGINE=rocksdb;
INSERT INTO t1 VALUES (1,1),(2,2),(3,4),(4,7);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze note The storage engine for the table doesn't support analyze
INSERT INTO t1 VALUES (5,8),(6,10),(7,11),(8,12);
ANALYZE TABLE t1;
Table Op Msg_type Msg_text
test.t1 analyze note The storage engine for the table doesn't support analyze
DROP TABLE t1;
29 changes: 29 additions & 0 deletions mysql-test/suite/rocksdb/analyze_table.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#
# ANALYZE TABLE statements
#

--disable_warnings
DROP TABLE IF EXISTS t1,t2;
--enable_warnings

CREATE TABLE t1 (pk INT PRIMARY KEY, a INT(11), b CHAR(8)) ENGINE=rocksdb;
INSERT INTO t1 VALUES (1,1,'a'),(2,2,'b');
CREATE TABLE t2 (pk INT PRIMARY KEY, a INT(11), b CHAR(8)) ENGINE=rocksdb;
INSERT INTO t1 VALUES (3,3,'c');
ANALYZE TABLE t1;
INSERT INTO t2 VALUES (1,4,'d');
ANALYZE NO_WRITE_TO_BINLOG TABLE t2;
INSERT INTO t1 VALUES (4,5,'e');
INSERT INTO t2 VALUES (2,6,'f');
ANALYZE LOCAL TABLE t1, t2;

DROP TABLE t1, t2;

--let $create_definition = a $int_indexed_col, $default_index(a)
CREATE TABLE t1 (pk INT PRIMARY KEY, a INT(11), KEY(a)) ENGINE=rocksdb;
INSERT INTO t1 VALUES (1,1),(2,2),(3,4),(4,7);
ANALYZE TABLE t1;
INSERT INTO t1 VALUES (5,8),(6,10),(7,11),(8,12);
ANALYZE TABLE t1;
DROP TABLE t1;

Loading

0 comments on commit de1fc8a

Please sign in to comment.