[Commits] eb55459: Re-commit in git: fake support for UNIQUE indexes. They can be created for RocksDB but won't be enforced.

Sergei Petrunia psergey at askmonty.org
Sat Jul 12 00:01:39 EEST 2014


revision-id: eb55459d5b4916ea9e17847e7674b6c6677c18a9
parent(s): dbf594d7bccf16585bd721e37bcf5d3559c4556e
committer: Sergei Petrunia
branch nick: webscalesql-5.6
timestamp: 2014-07-12 01:01:39 +0400
message:

Re-commit in git: fake support for UNIQUE indexes. They can be created for RocksDB but won't be enforced.

-----------------------

 sql/handler.h                  |    1 +
 sql/table.cc                   |    2 +-
 storage/leveldb/CMakeLists.txt |    6 +++---
 storage/leveldb/ha_leveldb.cc  |    3 ++-
 storage/rocksdb/ha_rocksdb.cc  |    4 ++++
 5 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/sql/handler.h b/sql/handler.h
index 0ad3b94..0929175 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -391,6 +391,7 @@ enum legacy_db_type
   DB_TYPE_FALCON,
   DB_TYPE_MARIA,
   DB_TYPE_LEVELDB, /* Need it here for extended keys to work */
+  DB_TYPE_ROCKSDB, /* Need it here for extended keys to work */
   /** Performance schema engine. */
   DB_TYPE_PERFORMANCE_SCHEMA,
   DB_TYPE_FIRST_DYNAMIC=42,
diff --git a/sql/table.cc b/sql/table.cc
index ba94470..6ff4abe 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -1877,7 +1877,7 @@ static int open_binary_frm(THD *thd, TABLE_SHARE *share, uchar *head,
           field->flags|= PRI_KEY_FLAG;
 
           /* 
-            LevelDB SE: we need to re-read to get correct value of 
+            LevelDB & RocksDB SE: we need to re-read to get correct value of 
             HA_PRIMARY_KEY_IN_READ_INDEX
           */
           ha_option= handler_file->ha_table_flags();
diff --git a/storage/leveldb/CMakeLists.txt b/storage/leveldb/CMakeLists.txt
index 41de2d6..8d7392b 100644
--- a/storage/leveldb/CMakeLists.txt
+++ b/storage/leveldb/CMakeLists.txt
@@ -7,7 +7,7 @@
 # LEVELDB_LIBRARIES= # path to leveldb shared or static libraries
 
 SET(LEVELDB_SE_PLUGIN_STATIC  "leveldb")
-SET(LEVELDB_SE_PLUGIN_MANDATORY TRUE)
+SET(LEVELDB_SE_PLUGIN_MANDATORY FALSE)
 
 FIND_PATH(Leveldb_INCLUDE_DIRS leveldb/db.h PATHS
 $ENV{LEVELDB_INCLUDE}      # environment variable to be used optionally
@@ -18,7 +18,7 @@ ${Leveldb_INCLUDE_DIR}     # this may be set
 /opt/include/leveldb
 )
 IF(NOT EXISTS ${Leveldb_INCLUDE_DIRS})
-  MESSAGE(SEND_ERROR "No leveldb include directory found! Consider using environment variable LEVELDB_INCLUDE=...")
+  # MESSAGE(SEND_ERROR "No leveldb include directory found! Consider using environment variable LEVELDB_INCLUDE=...")
   RETURN()
 ENDIF()
 
@@ -27,7 +27,7 @@ FIND_LIBRARY(Leveldb_LIBS NAMES leveldb
 IF(EXISTS ${Leveldb_LIBS})
   GET_FILENAME_COMPONENT(LINK_DIR ${Leveldb_LIBS} ABSOLUTE)
 ELSE()
-  MESSAGE(SEND_ERROR "No leveldb library directory found! Consider using environment variable LEVELDB_LIBRARIES=...")
+  # MESSAGE(SEND_ERROR "No leveldb library directory found! Consider using environment variable LEVELDB_LIBRARIES=...")
   RETURN()
 ENDIF()
 
diff --git a/storage/leveldb/ha_leveldb.cc b/storage/leveldb/ha_leveldb.cc
index e7039fd..1852a37 100644
--- a/storage/leveldb/ha_leveldb.cc
+++ b/storage/leveldb/ha_leveldb.cc
@@ -460,7 +460,8 @@ static int leveldb_init_func(void *p)
     TABLE to create an empty table from scratch. LevelDB cannot efficiently
     re-create a table.
   */
-  leveldb_hton->flags= HTON_TEMPORARY_NOT_SUPPORTED;
+  leveldb_hton->flags= HTON_TEMPORARY_NOT_SUPPORTED | 
+                       HTON_SUPPORTS_EXTENDED_KEYS;
 
   /*
     As for the datadir, innobase_init() uses mysql_real_data_home for
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index 28c1dc1..f475db3 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -926,6 +926,7 @@ int ha_rocksdb::create_key_defs(TABLE *table_arg, const char *db_table, uint len
   uint n_keys= table_arg->s->keys;
    
   /* Don't allow to create unique indexes */
+/* TODO mdcallag: disable this for now to pretend to support UNIQUE indexes
   for (i= 0; i < table_arg->s->keys; i++)
   {
     if (table_arg->key_info[i].flags & HA_NOSAME && 
@@ -934,6 +935,7 @@ int ha_rocksdb::create_key_defs(TABLE *table_arg, const char *db_table, uint len
       DBUG_RETURN(HA_ERR_ROCKSDB_UNIQUE_NOT_SUPPORTED); 
     }
   }
+*/
 
   /* Create table/key descriptions and put them into the data dictionary */
   if (!(key_descr= (RDBSE_KEYDEF**)my_malloc(sizeof(RDBSE_KEYDEF*) * n_keys,
@@ -1052,6 +1054,7 @@ int ha_rocksdb::create(const char *name, TABLE *table_arg,
   */ 
   Field *field;
   //if ((field= table_arg->next_number_field))
+  /* TODO mdcallag: disable this for now to let UNIQUE indexes kind of work
   if ((field= table_arg->found_next_number_field))
   {
     int pk= table_arg->s->primary_key;
@@ -1059,6 +1062,7 @@ int ha_rocksdb::create(const char *name, TABLE *table_arg,
     if (field->field_index !=  pk_field->field_index)
       DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
   }
+  */
   DBUG_RETURN(0);
 }
 


More information about the commits mailing list