Skip to content
This repository has been archived by the owner on Feb 10, 2023. It is now read-only.

Commit

Permalink
Add remaining tests to mysql-test/suite/rocksdb. This fixes Issue #1
Browse files Browse the repository at this point in the history
Two testcases are empty because RocksDB-SE doesn't support the feature:
-autoincrement.test
-autoinc_secondary.test
  • Loading branch information
spetrunia authored and jtolmer committed Jan 5, 2016
1 parent 0a00d2b commit 883b152
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 0 deletions.
1 change: 1 addition & 0 deletions mysql-test/suite/rocksdb/autoinc_secondary.result
@@ -0,0 +1 @@
# The test checks AUTO_INCREMENT capabilities that are not supported by RocksDB-SE.
2 changes: 2 additions & 0 deletions mysql-test/suite/rocksdb/autoinc_secondary.test
@@ -0,0 +1,2 @@
--echo # The test checks AUTO_INCREMENT capabilities that are not supported by RocksDB-SE.

64 changes: 64 additions & 0 deletions mysql-test/suite/rocksdb/autoinc_vars.result
@@ -0,0 +1,64 @@
DROP TABLE IF EXISTS t1;
#---------------------------
# auto_increment_offset
#---------------------------
SET auto_increment_offset = 200;
CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb;
INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b'),(NULL,'c');
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
1
SELECT a,b FROM t1 ORDER BY a;
a b
1 a
2 b
3 c
#---------------------------
# auto_increment_increment
#---------------------------
SET auto_increment_increment = 300;
INSERT INTO t1 (a,b) VALUES (NULL,'d'),(NULL,'e'),(NULL,'f');
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
200
SELECT a,b FROM t1 ORDER BY a;
a b
1 a
2 b
3 c
200 d
500 e
800 f
SET auto_increment_increment = 50;
INSERT INTO t1 (a,b) VALUES (NULL,'g'),(NULL,'h'),(NULL,'i');
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
850
SELECT a,b FROM t1 ORDER BY a;
a b
1 a
2 b
3 c
200 d
500 e
800 f
850 g
900 h
950 i
DROP TABLE t1;
#---------------------------
# offset is greater than the max value
#---------------------------
SET auto_increment_increment = 500;
SET auto_increment_offset = 300;
CREATE TABLE t1 (a TINYINT AUTO_INCREMENT PRIMARY KEY) ENGINE=rocksdb;
INSERT INTO t1 (a) VALUES (NULL);
Warnings:
Warning 1264 Out of range value for column 'a' at row 1
SELECT LAST_INSERT_ID();
LAST_INSERT_ID()
127
SELECT a FROM t1 ORDER BY a;
a
127
DROP TABLE t1;
63 changes: 63 additions & 0 deletions mysql-test/suite/rocksdb/autoinc_vars.test
@@ -0,0 +1,63 @@
#
# auto-increment-offset and auto-increment-increment
#

############################################
# TODO:
# This test currently produces wrong result
# on the line 36 of the result file and further
# due to bug MySQL:47118.
# When/if the bug is fixed,
# the result will need to be updated
############################################

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

--echo #---------------------------
--echo # auto_increment_offset
--echo #---------------------------
SET auto_increment_offset = 200;

CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb;

# If auto_increment_offset is greater than auto_increment_increment,
# the offset is ignored

INSERT INTO t1 (a,b) VALUES (NULL,'a'),(NULL,'b'),(NULL,'c');
SELECT LAST_INSERT_ID();
SELECT a,b FROM t1 ORDER BY a;

--echo #---------------------------
--echo # auto_increment_increment
--echo #---------------------------

SET auto_increment_increment = 300;
# offset should not be ignored anymore

INSERT INTO t1 (a,b) VALUES (NULL,'d'),(NULL,'e'),(NULL,'f');
SELECT LAST_INSERT_ID();
SELECT a,b FROM t1 ORDER BY a;

SET auto_increment_increment = 50;
INSERT INTO t1 (a,b) VALUES (NULL,'g'),(NULL,'h'),(NULL,'i');
SELECT LAST_INSERT_ID();
SELECT a,b FROM t1 ORDER BY a;
DROP TABLE t1;


--echo #---------------------------
--echo # offset is greater than the max value
--echo #---------------------------

SET auto_increment_increment = 500;
SET auto_increment_offset = 300;

CREATE TABLE t1 (a TINYINT AUTO_INCREMENT PRIMARY KEY) ENGINE=rocksdb;
INSERT INTO t1 (a) VALUES (NULL);
SELECT LAST_INSERT_ID();
SELECT a FROM t1 ORDER BY a;
DROP TABLE t1;


1 change: 1 addition & 0 deletions mysql-test/suite/rocksdb/autoincrement.result
@@ -0,0 +1 @@
# The test checks AUTO_INCREMENT capabilities that are not supported by RocksDB-SE.
1 change: 1 addition & 0 deletions mysql-test/suite/rocksdb/autoincrement.test
@@ -0,0 +1 @@
--echo # The test checks AUTO_INCREMENT capabilities that are not supported by RocksDB-SE.

0 comments on commit 883b152

Please sign in to comment.