From 6e899642fe65eb3f36ff33fbb7b77052a0f216e6 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 11 Mar 2017 16:25:03 +0100 Subject: [PATCH] move rocksdb specific changes into rocksdb --- include/mysql/plugin.h | 17 ----------------- sql/handler.cc | 8 -------- sql/handler.h | 1 - storage/rocksdb/build_rocksdb.cmake | 6 ++++++ storage/rocksdb/ha_rocksdb.cc | 20 ++++++++++++++++++++ storage/rocksdb/ha_rocksdb.h | 1 + 6 files changed, 27 insertions(+), 26 deletions(-) diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index 2f077d8440e..a5bfa1bbc9e 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -393,23 +393,6 @@ DECLARE_MYSQL_SYSVAR_SIMPLE(name, unsigned long long) = { \ PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, min, max, blk } -#define MYSQL_SYSVAR_UINT64_T(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, uint64_t) = { \ - PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } - -#ifdef _WIN64 -#define MYSQL_SYSVAR_SIZE_T(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, size_t) = { \ - PLUGIN_VAR_LONGLONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } -#else -#define MYSQL_SYSVAR_SIZE_T(name, varname, opt, comment, check, update, def, min, max, blk) \ -DECLARE_MYSQL_SYSVAR_SIMPLE(name, size_t) = { \ - PLUGIN_VAR_LONG | PLUGIN_VAR_UNSIGNED | ((opt) & PLUGIN_VAR_MASK), \ - #name, comment, check, update, &varname, def, min, max, blk } -#endif - #define MYSQL_SYSVAR_ENUM(name, varname, opt, comment, check, update, def, typelib) \ DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long) = { \ PLUGIN_VAR_ENUM | ((opt) & PLUGIN_VAR_MASK), \ diff --git a/sql/handler.cc b/sql/handler.cc index e927ba011aa..c28ab2a7bd7 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2728,14 +2728,6 @@ int handler::ha_index_first(uchar * buf) return result; } -bool handler::is_using_full_key(key_part_map keypart_map, - uint actual_key_parts) -{ - return (keypart_map == HA_WHOLE_KEY) || - (keypart_map == ((key_part_map(1) << actual_key_parts) - - 1)); -} - int handler::ha_index_last(uchar * buf) { int result; diff --git a/sql/handler.h b/sql/handler.h index 028f40e5dab..830e45a139f 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -3193,7 +3193,6 @@ public: size_t size) { return 0; } - bool is_using_full_key(key_part_map keypart_map, uint actual_key_parts); virtual int read_range_first(const key_range *start_key, const key_range *end_key, bool eq_range, bool sorted); diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake index f29b4e5fabe..0cbca0f3b05 100644 --- a/storage/rocksdb/build_rocksdb.cmake +++ b/storage/rocksdb/build_rocksdb.cmake @@ -29,6 +29,12 @@ else() endif() endif() +include (CheckTypeSize) +check_type_size(size_t SIZEOF_SIZE_T) +check_type_size(uint64_t SIZEOF_UINT64_T) +set_property(SOURCE ha_rocksdb.cc APPEND PROPERTY COMPILE_DEFINITIONS + SIZEOF_SIZE_T=${SIZEOF_SIZE_T} SIZEOF_UINT64_T=${SIZEOF_UINT64_T}) + # Optional compression libraries. foreach(compression_lib LZ4 BZIP2 ZSTD snappy) diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index c27835ac1be..72b23f2655c 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -454,6 +454,18 @@ const int64 RDB_DEFAULT_BLOCK_CACHE_SIZE = 512 * 1024 * 1024; const int64 RDB_MIN_BLOCK_CACHE_SIZE = 1024; const int RDB_MAX_CHECKSUMS_PCT = 100; +#if SIZEOF_ULONG == SIZEOF_SIZE_T +#define MYSQL_SYSVAR_SIZE_T MYSQL_SYSVAR_ULONG +#else +#define MYSQL_SYSVAR_SIZE_T MYSQL_SYSVAR_ULONGLONG +#endif + +#if SIZEOF_ULONG == SIZEOF_UINT64_T +#define MYSQL_SYSVAR_UINT64_T MYSQL_SYSVAR_ULONG +#else +#define MYSQL_SYSVAR_UINT64_T MYSQL_SYSVAR_ULONGLONG +#endif + // TODO: 0 means don't wait at all, and we don't support it yet? static MYSQL_THDVAR_ULONG(lock_wait_timeout, PLUGIN_VAR_RQCMDARG, "Number of seconds to wait for lock", nullptr, @@ -5922,6 +5934,14 @@ int ha_rocksdb::secondary_index_read(const int keyno, uchar *const buf) { return HA_ERR_END_OF_FILE; } +bool ha_rocksdb::is_using_full_key(key_part_map keypart_map, + uint actual_key_parts) +{ + return (keypart_map == HA_WHOLE_KEY) || + (keypart_map == ((key_part_map(1) << actual_key_parts) + - 1)); +} + /* ha_rocksdb::read_range_first overrides handler::read_range_first. The only difference from handler::read_range_first is that diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h index 6e9f6b41afe..5852ad4e954 100644 --- a/storage/rocksdb/ha_rocksdb.h +++ b/storage/rocksdb/ha_rocksdb.h @@ -866,6 +866,7 @@ public: const key_range *end_key) MY_ATTRIBUTE((__warn_unused_result__)); + bool is_using_full_key(key_part_map keypart_map, uint actual_key_parts); int read_range_first(const key_range *const start_key, const key_range *const end_key, bool eq_range, bool sorted) override