[Commits] 4653b6e: MDEV-12279: rocksdb.tbl_opt_data_index_dir fails, wrong error code

Sergei Petrunia psergey at askmonty.org
Thu Mar 23 10:06:26 EET 2017


revision-id: 4653b6e2a3a459b5ef9bbc0907c141426830f23c
parent(s): 4967c78aa07c9f657ae4825ff16c176a0f75193a
committer: Sergei Petrunia
branch nick: 10.2-mariarocks
timestamp: 2017-03-23 11:06:26 +0300
message:

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)

---
 storage/rocksdb/ha_rocksdb.cc                          |  8 ++++++--
 .../mysql-test/rocksdb/r/tbl_opt_data_index_dir.result | 18 ++++++++++++++----
 .../mysql-test/rocksdb/t/tbl_opt_data_index_dir.test   | 15 +++++++++------
 3 files changed, 29 insertions(+), 12 deletions(-)

diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index 35e91a9..06b82dd 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -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.
     // The `rocksdb_datadir` setting should be used to configure RocksDB data
     // 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) {
     // 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;
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/tbl_opt_data_index_dir.result b/storage/rocksdb/mysql-test/rocksdb/r/tbl_opt_data_index_dir.result
index bbdd604..d1e445f 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/tbl_opt_data_index_dir.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/tbl_opt_data_index_dir.result
@@ -1,8 +1,18 @@
 DROP TABLE IF EXISTS t1;
 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';
-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)
 (
 PARTITION P0 VALUES LESS THAN (1000)
@@ -11,7 +21,7 @@ PARTITION P1 VALUES LESS THAN (2000)
 DATA DIRECTORY =  '/foo/bar/data/',
 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)
 (
 PARTITION P0 VALUES LESS THAN (1000)
@@ -20,4 +30,4 @@ PARTITION P1 VALUES LESS THAN (2000)
 INDEX DIRECTORY =  '/foo/bar/data/',
 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")
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/tbl_opt_data_index_dir.test b/storage/rocksdb/mysql-test/rocksdb/t/tbl_opt_data_index_dir.test
index ab3f240..1b3a1b1 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/tbl_opt_data_index_dir.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/tbl_opt_data_index_dir.test
@@ -1,5 +1,6 @@
 --source include/have_rocksdb.inc
 
+--source include/have_partition.inc
 #
 # Check that when either DATA DIRECTORY or INDEX DIRECTORY are specified
 # then MyRocks returns an appropriate error. We don't support this
@@ -10,17 +11,19 @@
 DROP TABLE IF EXISTS t1;
 --enable_warnings
 
---error 1296
-eval CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb DATA DIRECTORY = '/foo/bar/data';
+--error ER_CANT_CREATE_TABLE
+CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb DATA DIRECTORY = '/foo/bar/data';
+show warnings;
 
---error 1296
-eval CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb INDEX DIRECTORY = '/foo/bar/index';
+--error ER_CANT_CREATE_TABLE
+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.
 #
 
---error 1296
+--error ER_CANT_CREATE_TABLE
 CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=rocksdb PARTITION BY RANGE (id)
 (
     PARTITION P0 VALUES LESS THAN (1000)
@@ -30,7 +33,7 @@ CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=rocksdb PARTITION BY RANGE
     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)
 (
    PARTITION P0 VALUES LESS THAN (1000)


More information about the commits mailing list