Commit 918f5244 authored by Sergei Golubchik's avatar Sergei Golubchik

RocksDB doesn't support DESC indexes yet

disallow descending indexes in rocksdb
parent fca37e49
...@@ -7533,8 +7533,7 @@ int ha_rocksdb::create_key_def(const TABLE *const table_arg, const uint i, ...@@ -7533,8 +7533,7 @@ int ha_rocksdb::create_key_def(const TABLE *const table_arg, const uint i,
(*new_key_def)->m_ttl_column = ttl_column; (*new_key_def)->m_ttl_column = ttl_column;
} }
// initialize key_def // initialize key_def
(*new_key_def)->setup(table_arg, tbl_def_arg); DBUG_RETURN((*new_key_def)->setup(table_arg, tbl_def_arg));
DBUG_RETURN(HA_EXIT_SUCCESS);
} }
int rdb_normalize_tablename(const std::string &tablename, int rdb_normalize_tablename(const std::string &tablename,
......
...@@ -23,6 +23,11 @@ CREATE TABLE t1 (a INT, ...@@ -23,6 +23,11 @@ CREATE TABLE t1 (a INT,
b CHAR(8), b CHAR(8),
PRIMARY KEY ind2(b(1) DESC) KEY_BLOCK_SIZE=32768 COMMENT 'big key_block_size value' PRIMARY KEY ind2(b(1) DESC) KEY_BLOCK_SIZE=32768 COMMENT 'big key_block_size value'
) ENGINE=rocksdb; ) ENGINE=rocksdb;
ERROR HY000: Table storage engine 'ROCKSDB' does not support the create option 'DESC'
CREATE TABLE t1 (a INT,
b CHAR(8),
PRIMARY KEY ind2(b(1)) KEY_BLOCK_SIZE=32768 COMMENT 'big key_block_size value'
) ENGINE=rocksdb;
Warnings: Warnings:
Warning 1280 Name 'ind2' ignored for PRIMARY key. Warning 1280 Name 'ind2' ignored for PRIMARY key.
SHOW INDEX IN t1; SHOW INDEX IN t1;
......
...@@ -28,11 +28,17 @@ CREATE TABLE t1 (a INT, ...@@ -28,11 +28,17 @@ CREATE TABLE t1 (a INT,
SHOW INDEX IN t1; SHOW INDEX IN t1;
DROP TABLE t1; DROP TABLE t1;
--error ER_ILLEGAL_HA_CREATE_OPTION
CREATE TABLE t1 (a INT, CREATE TABLE t1 (a INT,
b CHAR(8), b CHAR(8),
PRIMARY KEY ind2(b(1) DESC) KEY_BLOCK_SIZE=32768 COMMENT 'big key_block_size value' PRIMARY KEY ind2(b(1) DESC) KEY_BLOCK_SIZE=32768 COMMENT 'big key_block_size value'
) ENGINE=rocksdb; ) ENGINE=rocksdb;
CREATE TABLE t1 (a INT,
b CHAR(8),
PRIMARY KEY ind2(b(1)) KEY_BLOCK_SIZE=32768 COMMENT 'big key_block_size value'
) ENGINE=rocksdb;
--replace_column 7 # --replace_column 7 #
SHOW INDEX IN t1; SHOW INDEX IN t1;
......
...@@ -390,7 +390,7 @@ Rdb_key_def::~Rdb_key_def() { ...@@ -390,7 +390,7 @@ Rdb_key_def::~Rdb_key_def() {
m_pack_info = nullptr; m_pack_info = nullptr;
} }
void Rdb_key_def::setup(const TABLE *const tbl, uint Rdb_key_def::setup(const TABLE *const tbl,
const Rdb_tbl_def *const tbl_def) { const Rdb_tbl_def *const tbl_def) {
DBUG_ASSERT(tbl != nullptr); DBUG_ASSERT(tbl != nullptr);
DBUG_ASSERT(tbl_def != nullptr); DBUG_ASSERT(tbl_def != nullptr);
...@@ -406,7 +406,7 @@ void Rdb_key_def::setup(const TABLE *const tbl, ...@@ -406,7 +406,7 @@ void Rdb_key_def::setup(const TABLE *const tbl,
RDB_MUTEX_LOCK_CHECK(m_mutex); RDB_MUTEX_LOCK_CHECK(m_mutex);
if (m_maxlength != 0) { if (m_maxlength != 0) {
RDB_MUTEX_UNLOCK_CHECK(m_mutex); RDB_MUTEX_UNLOCK_CHECK(m_mutex);
return; return HA_EXIT_SUCCESS;
} }
KEY *key_info = nullptr; KEY *key_info = nullptr;
...@@ -488,6 +488,14 @@ void Rdb_key_def::setup(const TABLE *const tbl, ...@@ -488,6 +488,14 @@ void Rdb_key_def::setup(const TABLE *const tbl,
for (uint src_i = 0; src_i < m_key_parts; src_i++, keypart_to_set++) { for (uint src_i = 0; src_i < m_key_parts; src_i++, keypart_to_set++) {
Field *const field = key_part ? key_part->field : nullptr; Field *const field = key_part ? key_part->field : nullptr;
if (key_part && key_part->key_part_flag & HA_REVERSE_SORT)
{
my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0),
"ROCKSDB", "DESC");
RDB_MUTEX_UNLOCK_CHECK(m_mutex);
return HA_EXIT_FAILURE;
}
if (simulating_extkey && !hidden_pk_exists) { if (simulating_extkey && !hidden_pk_exists) {
DBUG_ASSERT(secondary_key); DBUG_ASSERT(secondary_key);
/* Check if this field is already present in the key definition */ /* Check if this field is already present in the key definition */
...@@ -591,6 +599,7 @@ void Rdb_key_def::setup(const TABLE *const tbl, ...@@ -591,6 +599,7 @@ void Rdb_key_def::setup(const TABLE *const tbl,
RDB_MUTEX_UNLOCK_CHECK(m_mutex); RDB_MUTEX_UNLOCK_CHECK(m_mutex);
} }
return HA_EXIT_SUCCESS;
} }
/* /*
......
...@@ -593,7 +593,7 @@ class Rdb_key_def { ...@@ -593,7 +593,7 @@ class Rdb_key_def {
SECONDARY_FORMAT_VERSION_UPDATE3 = 65535, SECONDARY_FORMAT_VERSION_UPDATE3 = 65535,
}; };
void setup(const TABLE *const table, const Rdb_tbl_def *const tbl_def); uint setup(const TABLE *const table, const Rdb_tbl_def *const tbl_def);
static uint extract_ttl_duration(const TABLE *const table_arg, static uint extract_ttl_duration(const TABLE *const table_arg,
const Rdb_tbl_def *const tbl_def_arg, const Rdb_tbl_def *const tbl_def_arg,
......
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