Commit 4653b6e2 authored by Sergei Petrunia's avatar Sergei Petrunia

MDEV-12279: rocksdb.tbl_opt_data_index_dir fails, wrong error code

Change the returned error code to be ER_CANT_CREATE_TABLE.
Emit the warning text ourselves.

(When a query produces both an error and a warning, command-line client
with default settings will not provide any indication that the warning
is present, unfortunately. Need \W)
parent 4967c78a
...@@ -5417,12 +5417,16 @@ int ha_rocksdb::create(const char *const name, TABLE *const table_arg, ...@@ -5417,12 +5417,16 @@ int ha_rocksdb::create(const char *const name, TABLE *const table_arg,
// outside the MySQL data directory. We don't support this for MyRocks. // outside the MySQL data directory. We don't support this for MyRocks.
// The `rocksdb_datadir` setting should be used to configure RocksDB data // The `rocksdb_datadir` setting should be used to configure RocksDB data
// directory. // directory.
DBUG_RETURN(HA_ERR_ROCKSDB_TABLE_DATA_DIRECTORY_NOT_SUPPORTED); print_error(HA_ERR_ROCKSDB_TABLE_DATA_DIRECTORY_NOT_SUPPORTED,
MYF(ME_JUST_WARNING));
DBUG_RETURN(HA_WRONG_CREATE_OPTION);
} }
if (create_info->index_file_name) { if (create_info->index_file_name) {
// Similar check for INDEX DIRECTORY as well. // Similar check for INDEX DIRECTORY as well.
DBUG_RETURN(HA_ERR_ROCKSDB_TABLE_INDEX_DIRECTORY_NOT_SUPPORTED); print_error(HA_ERR_ROCKSDB_TABLE_INDEX_DIRECTORY_NOT_SUPPORTED,
MYF(ME_JUST_WARNING));
DBUG_RETURN(HA_WRONG_CREATE_OPTION);
} }
int res; int res;
......
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb DATA DIRECTORY = '/foo/bar/data'; CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb DATA DIRECTORY = '/foo/bar/data';
ERROR HY000: Got error 197 'Specifying DATA DIRECTORY for an individual table is not supported.' from ROCKSDB ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 1296 Got error 198 'Specifying DATA DIRECTORY for an individual table is not supported.' from ROCKSDB
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine ROCKSDB
CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb INDEX DIRECTORY = '/foo/bar/index'; CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb INDEX DIRECTORY = '/foo/bar/index';
ERROR HY000: Got error 198 'Specifying INDEX DIRECTORY for an individual table is not supported.' from ROCKSDB ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
show warnings;
Level Code Message
Warning 1296 Got error 199 'Specifying INDEX DIRECTORY for an individual table is not supported.' from ROCKSDB
Error 1005 Can't create table `test`.`t1` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine ROCKSDB
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=rocksdb PARTITION BY RANGE (id) CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=rocksdb PARTITION BY RANGE (id)
( (
PARTITION P0 VALUES LESS THAN (1000) PARTITION P0 VALUES LESS THAN (1000)
...@@ -11,7 +21,7 @@ PARTITION P1 VALUES LESS THAN (2000) ...@@ -11,7 +21,7 @@ PARTITION P1 VALUES LESS THAN (2000)
DATA DIRECTORY = '/foo/bar/data/', DATA DIRECTORY = '/foo/bar/data/',
PARTITION P2 VALUES LESS THAN (MAXVALUE) PARTITION P2 VALUES LESS THAN (MAXVALUE)
); );
ERROR HY000: Got error 197 'Specifying DATA DIRECTORY for an individual table is not supported.' from ROCKSDB ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
CREATE TABLE t1 (id int not null primary key) ENGINE=rocksdb PARTITION BY RANGE (id) CREATE TABLE t1 (id int not null primary key) ENGINE=rocksdb PARTITION BY RANGE (id)
( (
PARTITION P0 VALUES LESS THAN (1000) PARTITION P0 VALUES LESS THAN (1000)
...@@ -20,4 +30,4 @@ PARTITION P1 VALUES LESS THAN (2000) ...@@ -20,4 +30,4 @@ PARTITION P1 VALUES LESS THAN (2000)
INDEX DIRECTORY = '/foo/bar/data/', INDEX DIRECTORY = '/foo/bar/data/',
PARTITION P2 VALUES LESS THAN (MAXVALUE) PARTITION P2 VALUES LESS THAN (MAXVALUE)
); );
ERROR HY000: Got error 198 'Specifying INDEX DIRECTORY for an individual table is not supported.' from ROCKSDB ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
--source include/have_rocksdb.inc --source include/have_rocksdb.inc
--source include/have_partition.inc
# #
# Check that when either DATA DIRECTORY or INDEX DIRECTORY are specified # Check that when either DATA DIRECTORY or INDEX DIRECTORY are specified
# then MyRocks returns an appropriate error. We don't support this # then MyRocks returns an appropriate error. We don't support this
...@@ -10,17 +11,19 @@ ...@@ -10,17 +11,19 @@
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
--enable_warnings --enable_warnings
--error 1296 --error ER_CANT_CREATE_TABLE
eval CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb DATA DIRECTORY = '/foo/bar/data'; CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb DATA DIRECTORY = '/foo/bar/data';
show warnings;
--error 1296 --error ER_CANT_CREATE_TABLE
eval CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb INDEX DIRECTORY = '/foo/bar/index'; CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb INDEX DIRECTORY = '/foo/bar/index';
show warnings;
# #
# Verify that we'll get the same error codes when using the partitions. # Verify that we'll get the same error codes when using the partitions.
# #
--error 1296 --error ER_CANT_CREATE_TABLE
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=rocksdb PARTITION BY RANGE (id) CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=rocksdb PARTITION BY RANGE (id)
( (
PARTITION P0 VALUES LESS THAN (1000) PARTITION P0 VALUES LESS THAN (1000)
...@@ -30,7 +33,7 @@ CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=rocksdb PARTITION BY RANGE ...@@ -30,7 +33,7 @@ CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=rocksdb PARTITION BY RANGE
PARTITION P2 VALUES LESS THAN (MAXVALUE) PARTITION P2 VALUES LESS THAN (MAXVALUE)
); );
--error 1296 --error ER_CANT_CREATE_TABLE
CREATE TABLE t1 (id int not null primary key) ENGINE=rocksdb PARTITION BY RANGE (id) CREATE TABLE t1 (id int not null primary key) ENGINE=rocksdb PARTITION BY RANGE (id)
( (
PARTITION P0 VALUES LESS THAN (1000) PARTITION P0 VALUES LESS THAN (1000)
......
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