Commit 7d00f098 authored by Sergei Petrunia's avatar Sergei Petrunia

Merge between local changes bb-10.2-mariarocks and the merge from upstream

parents 5e47d08e 7facbc54
find_path(LZ4_INCLUDE_DIR NAMES lz4.h)
find_library(LZ4_LIBRARY NAMES lz4)
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
LZ4 DEFAULT_MSG
LZ4_LIBRARY LZ4_INCLUDE_DIR)
mark_as_advanced(LZ4_INCLUDE_DIR LZ4_LIBRARY)
find_path(
ZSTD_INCLUDE_DIR
NAMES "zstd.h"
)
find_library(
ZSTD_LIBRARY
NAMES zstd
)
set(ZSTD_LIBRARIES ${ZSTD_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
ZSTD DEFAULT_MSG ZSTD_INCLUDE_DIR ZSTD_LIBRARIES)
mark_as_advanced(ZSTD_INCLUDE_DIR ZSTD_LIBRARIES ZSTD_FOUND)
......@@ -360,7 +360,7 @@ struct my_collation_handler_st
};
extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler;
extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler;
extern MYSQL_PLUGIN_IMPORT MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler;
extern MY_COLLATION_HANDLER my_collation_8bit_nopad_bin_handler;
extern MY_COLLATION_HANDLER my_collation_8bit_simple_nopad_ci_handler;
extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler;
......@@ -586,83 +586,83 @@ extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1_nopad;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_filename;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_general_ci;
extern struct charset_info_st my_charset_big5_bin;
extern struct charset_info_st my_charset_big5_chinese_ci;
extern struct charset_info_st my_charset_big5_nopad_bin;
extern struct charset_info_st my_charset_big5_chinese_nopad_ci;
extern struct charset_info_st my_charset_cp1250_czech_ci;
extern struct charset_info_st my_charset_cp932_bin;
extern struct charset_info_st my_charset_cp932_japanese_ci;
extern struct charset_info_st my_charset_cp932_nopad_bin;
extern struct charset_info_st my_charset_cp932_japanese_nopad_ci;
extern struct charset_info_st my_charset_eucjpms_bin;
extern struct charset_info_st my_charset_eucjpms_japanese_ci;
extern struct charset_info_st my_charset_eucjpms_nopad_bin;
extern struct charset_info_st my_charset_eucjpms_japanese_nopad_ci;
extern struct charset_info_st my_charset_euckr_bin;
extern struct charset_info_st my_charset_euckr_korean_ci;
extern struct charset_info_st my_charset_euckr_nopad_bin;
extern struct charset_info_st my_charset_euckr_korean_nopad_ci;
extern struct charset_info_st my_charset_gb2312_bin;
extern struct charset_info_st my_charset_gb2312_chinese_ci;
extern struct charset_info_st my_charset_gb2312_nopad_bin;
extern struct charset_info_st my_charset_gb2312_chinese_nopad_ci;
extern struct charset_info_st my_charset_gbk_bin;
extern struct charset_info_st my_charset_gbk_chinese_ci;
extern struct charset_info_st my_charset_gbk_nopad_bin;
extern struct charset_info_st my_charset_gbk_chinese_nopad_ci;
extern struct charset_info_st my_charset_latin1_bin;
extern struct charset_info_st my_charset_latin1_nopad_bin;
extern struct charset_info_st my_charset_latin1_german2_ci;
extern struct charset_info_st my_charset_latin2_czech_ci;
extern struct charset_info_st my_charset_sjis_bin;
extern struct charset_info_st my_charset_sjis_japanese_ci;
extern struct charset_info_st my_charset_sjis_nopad_bin;
extern struct charset_info_st my_charset_sjis_japanese_nopad_ci;
extern struct charset_info_st my_charset_tis620_bin;
extern struct charset_info_st my_charset_tis620_thai_ci;
extern struct charset_info_st my_charset_tis620_nopad_bin;
extern struct charset_info_st my_charset_tis620_thai_nopad_ci;
extern struct charset_info_st my_charset_ucs2_bin;
extern struct charset_info_st my_charset_ucs2_general_ci;
extern struct charset_info_st my_charset_ucs2_nopad_bin;
extern struct charset_info_st my_charset_ucs2_general_nopad_ci;
extern struct charset_info_st my_charset_ucs2_general_mysql500_ci;
extern struct charset_info_st my_charset_ucs2_unicode_ci;
extern struct charset_info_st my_charset_ucs2_unicode_nopad_ci;
extern struct charset_info_st my_charset_ucs2_general_mysql500_ci;
extern struct charset_info_st my_charset_ujis_bin;
extern struct charset_info_st my_charset_ujis_japanese_ci;
extern struct charset_info_st my_charset_ujis_nopad_bin;
extern struct charset_info_st my_charset_ujis_japanese_nopad_ci;
extern struct charset_info_st my_charset_utf16_bin;
extern struct charset_info_st my_charset_utf16_general_ci;
extern struct charset_info_st my_charset_utf16_unicode_ci;
extern struct charset_info_st my_charset_utf16_unicode_nopad_ci;
extern struct charset_info_st my_charset_utf16le_bin;
extern struct charset_info_st my_charset_utf16le_general_ci;
extern struct charset_info_st my_charset_utf16_general_nopad_ci;
extern struct charset_info_st my_charset_utf16_nopad_bin;
extern struct charset_info_st my_charset_utf16le_nopad_bin;
extern struct charset_info_st my_charset_utf16le_general_nopad_ci;
extern struct charset_info_st my_charset_utf32_bin;
extern struct charset_info_st my_charset_utf32_general_ci;
extern struct charset_info_st my_charset_utf32_unicode_ci;
extern struct charset_info_st my_charset_utf32_unicode_nopad_ci;
extern struct charset_info_st my_charset_utf32_nopad_bin;
extern struct charset_info_st my_charset_utf32_general_nopad_ci;
extern struct charset_info_st my_charset_utf8_bin;
extern struct charset_info_st my_charset_utf8_nopad_bin;
extern struct charset_info_st my_charset_utf8_general_nopad_ci;
extern struct charset_info_st my_charset_utf8_general_mysql500_ci;
extern struct charset_info_st my_charset_utf8_unicode_ci;
extern struct charset_info_st my_charset_utf8_unicode_nopad_ci;
extern struct charset_info_st my_charset_utf8mb4_bin;
extern struct charset_info_st my_charset_utf8mb4_general_ci;
extern struct charset_info_st my_charset_utf8mb4_nopad_bin;
extern struct charset_info_st my_charset_utf8mb4_general_nopad_ci;
extern struct charset_info_st my_charset_utf8mb4_unicode_ci;
extern struct charset_info_st my_charset_utf8mb4_unicode_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_big5_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_big5_chinese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_big5_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_big5_chinese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_cp1250_czech_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_cp932_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_cp932_japanese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_cp932_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_cp932_japanese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_eucjpms_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_eucjpms_japanese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_eucjpms_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_eucjpms_japanese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_euckr_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_euckr_korean_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_euckr_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_euckr_korean_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gb2312_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gb2312_chinese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gb2312_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gb2312_chinese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gbk_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gbk_chinese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gbk_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_gbk_chinese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin1_german2_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_latin2_czech_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_sjis_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_sjis_japanese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_sjis_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_sjis_japanese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_tis620_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_tis620_thai_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_tis620_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_tis620_thai_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_general_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_general_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_general_mysql500_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_unicode_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_unicode_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ucs2_general_mysql500_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ujis_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ujis_japanese_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ujis_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_ujis_japanese_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_general_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_unicode_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_unicode_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16le_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16le_general_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_general_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16le_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf16le_general_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_general_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_unicode_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_unicode_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf32_general_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_general_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_general_mysql500_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_unicode_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8_unicode_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_general_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_nopad_bin;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_general_nopad_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_unicode_ci;
extern MYSQL_PLUGIN_IMPORT struct charset_info_st my_charset_utf8mb4_unicode_nopad_ci;
#define MY_UTF8MB3 "utf8"
#define MY_UTF8MB4 "utf8mb4"
......
......@@ -25,7 +25,6 @@
C_MODE_START
extern const char _my_bits_nbits[256];
extern const uchar _my_bits_reverse_table[256];
/*
......@@ -40,37 +39,32 @@ static inline uint my_bit_log2(ulong value)
return bit;
}
static inline uint my_count_bits(ulonglong v)
/*
Count bits in 32bit integer
Algorithm by Sean Anderson, according to:
http://graphics.stanford.edu/~seander/bithacks.html
under "Counting bits set, in parallel"
(Orignal code public domain).
*/
static inline uint my_count_bits_uint32(uint32 v)
{
#if SIZEOF_LONG_LONG > 4
/* The following code is a bit faster on 16 bit machines than if we would
only shift v */
ulong v2=(ulong) (v >> 32);
return (uint) (uchar) (_my_bits_nbits[(uchar) v] +
_my_bits_nbits[(uchar) (v >> 8)] +
_my_bits_nbits[(uchar) (v >> 16)] +
_my_bits_nbits[(uchar) (v >> 24)] +
_my_bits_nbits[(uchar) (v2)] +
_my_bits_nbits[(uchar) (v2 >> 8)] +
_my_bits_nbits[(uchar) (v2 >> 16)] +
_my_bits_nbits[(uchar) (v2 >> 24)]);
#else
return (uint) (uchar) (_my_bits_nbits[(uchar) v] +
_my_bits_nbits[(uchar) (v >> 8)] +
_my_bits_nbits[(uchar) (v >> 16)] +
_my_bits_nbits[(uchar) (v >> 24)]);
#endif
v = v - ((v >> 1) & 0x55555555);
v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
return (((v + (v >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
}
static inline uint my_count_bits_uint32(uint32 v)
static inline uint my_count_bits(ulonglong x)
{
return (uint) (uchar) (_my_bits_nbits[(uchar) v] +
_my_bits_nbits[(uchar) (v >> 8)] +
_my_bits_nbits[(uchar) (v >> 16)] +
_my_bits_nbits[(uchar) (v >> 24)]);
return my_count_bits_uint32((uint32)x) + my_count_bits_uint32((uint32)(x >> 32));
}
/*
Next highest power of two
......
......@@ -393,6 +393,23 @@ 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), \
......
......@@ -17,24 +17,6 @@
#include <my_bit.h>
const char _my_bits_nbits[256] = {
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8,
};
/*
perl -e 'print map{", 0x".unpack H2,pack B8,unpack b8,chr$_}(0..255)'
......
build_version.cc
.*
# TODO: Copyrights
IF(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/rocksdb/Makefile AND GIT_EXECUTABLE)
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule init
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
ENDIF()
IF (NOT EXISTS "${CMAKE_SOURCE_DIR}/storage/rocksdb/rocksdb/Makefile")
IF (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/rocksdb/Makefile")
MESSAGE(SEND_ERROR "Missing Makefile in rocksdb directory. Try \"git submodule update\".")
ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
MACRO(SKIP_ROCKSDB_PLUGIN msg)
MESSAGE_ONCE(SKIP_ROCKSDB_PLUGIN "Can't build rocksdb engine - ${msg}")
RETURN()
ENDMACRO()
# This plugin needs recent C++ compilers (it is using C++11 features)
# Skip build for the old compilers
SET(CXX11_FLAGS)
SET(OLD_COMPILER_MSG "requires c++11 -capable compiler (minimal supported versions are g++ 4.8, clang 3.3, VS2015)")
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
IF (GCC_VERSION VERSION_LESS 4.8)
SKIP_ROCKSDB_PLUGIN("${OLD_COMPILER_MSG}")
ENDIF()
SET(CXX11_FLAGS "-std=c++11")
ELSEIF (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
IF ((CMAKE_CXX_COMPILER_VERSION AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3) OR
(CLANG_VERSION_STRING AND CLANG_VERSION_STRING VERSION_LESS 3.3))
SKIP_ROCKSDB_PLUGIN("${OLD_COMPILER_MSG}")
ENDIF()
SET(CXX11_FLAGS "-std=c++11 -stdlib=libstdc++")
ELSEIF(MSVC)
IF (MSVC_VERSION LESS 1900)
SKIP_ROCKSDB_PLUGIN("${OLD_COMPILER_MSG}")
ENDIF()
ELSE()
SKIP_ROCKSDB_PLUGIN("Compiler not supported")
ENDIF()
CHECK_FUNCTION_EXISTS(sched_getcpu HAVE_SCHED_GETCPU)
IF(HAVE_SCHED_GETCPU)
ADD_DEFINITIONS(-DHAVE_SCHED_GETCPU=1)
IF(CXX11_FLAGS)
ADD_DEFINITIONS(${CXX11_FLAGS})
ENDIF()
# get a list of rocksdb library source files
# run with env -i to avoid passing variables
EXECUTE_PROCESS(
COMMAND env -i ${CMAKE_SOURCE_DIR}/storage/rocksdb/get_rocksdb_files.sh
OUTPUT_VARIABLE SCRIPT_OUTPUT
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
SET(ROCKSDB_SE_SOURCES
rdb_mariadb_server_port.cc
rdb_mariadb_server_port.h
ha_rocksdb.cc
ha_rocksdb.h
rdb_i_s.cc
rdb_i_s.h
rdb_mutex_wrapper.cc
rdb_mutex_wrapper.h
rdb_index_merge.cc
rdb_index_merge.h
properties_collector.cc
properties_collector.h
rdb_datadic.cc
rdb_datadic.h
rdb_cf_manager.cc
rdb_cf_manager.h
rdb_utils.cc rdb_utils.h
rdb_threads.cc
rdb_threads.h
)
# split the list into lines
STRING(REGEX MATCHALL "[^\n]+" ROCKSDB_LIB_SOURCES ${SCRIPT_OUTPUT})
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/storage/rocksdb/rocksdb
${CMAKE_SOURCE_DIR}/storage/rocksdb/rocksdb/include
${CMAKE_SOURCE_DIR}/storage/rocksdb/rocksdb/third-party/gtest-1.7.0/fused-src
)
MYSQL_ADD_PLUGIN(rocksdb_se ${ROCKSDB_SE_SOURCES} STORAGE_ENGINE MODULE_OUTPUT_NAME ha_rocksdb)
ADD_DEFINITIONS(-DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX -DOS_LINUX
-DZLIB)
# MARIAROCKS_NOT_YET: Add -frtti flag when compiling RocksDB files.
# TODO: is this the right way to do this?
# - SQL layer and storage/rocksdb/*.cc are compiled with -fnortti
# - RocksDB files are compiled with "-fnortti ... -frtti"
# - This causes RocksDB headers to be compiled with different settings:
# = with RTTI when compiling RocksDB
# = without RTTI when compiling storage/rocksdb/*.cc
#
# (facebook/mysql-5.6 just compiles everything without -f*rtti, which means
# everything is compiled with -frtti)
#
# (also had to add -frtti above, because something that event_listener.cc
# includes requires it. So, now everything in MariaRocks is compiled with
# -frtti)
set_source_files_properties(${ROCKSDB_LIB_SOURCES} PROPERTIES COMPILE_FLAGS -frtti)
set_source_files_properties(event_listener.cc PROPERTIES COMPILE_FLAGS -frtti)
set_source_files_properties(rdb_cf_options.cc PROPERTIES COMPILE_FLAGS -frtti)
ADD_CONVENIENCE_LIBRARY(
ROCKSDB_AUX_LIB
IF(NOT TARGET rocksdb_se)
# Bail out if compilation with rocksdb engine is not requested
RETURN()
ENDIF()
INCLUDE(build_rocksdb.cmake)
ADD_CONVENIENCE_LIBRARY(rocksdb_aux_lib
ha_rocksdb_proto.h
logger.h
rdb_comparator.h
rdb_datadic.cc rdb_datadic.h
rdb_cf_options.cc rdb_cf_options.h
rdb_cf_manager.cc rdb_cf_manager.h
properties_collector.cc properties_collector.h
event_listener.cc event_listener.h
rdb_i_s.cc rdb_i_s.h
rdb_index_merge.cc rdb_index_merge.h
rdb_perf_context.cc rdb_perf_context.h
rdb_mutex_wrapper.cc rdb_mutex_wrapper.h
rdb_sst_info.cc rdb_sst_info.h
rdb_utils.cc rdb_utils.h rdb_buff.h
rdb_threads.cc rdb_threads.h
rdb_mariadb_port.h
${ROCKSDB_LIB_SOURCES}
)
# We include storage/innobase/include/ut0counter.h, which includes
# univ.i, which includes mysqld_error.h.
# Indicate that MyRocks is dependent on that file (just like innochecksum does)
ADD_DEPENDENCIES(ROCKSDB_AUX_LIB GenError)
SET(ROCKSDB_SOURCES
rdb_mariadb_server_port.cc rdb_mariadb_server_port.h
ha_rocksdb.cc ha_rocksdb.h
)
IF(WITH_FB_TSAN)
SET(PIC_EXT "_pic")
ELSE()
SET(PIC_EXT "")
rdb_cf_options.cc
rdb_cf_options.h
event_listener.cc
event_listener.h
rdb_perf_context.cc
rdb_perf_context.h
rdb_sst_info.cc
rdb_sst_info.h
rdb_buff.h
rdb_mariadb_port.h)
ADD_DEPENDENCIES(rocksdb_aux_lib GenError)
TARGET_LINK_LIBRARIES(rocksdb_aux_lib rocksdblib ${ZLIB_LIBRARY})
TARGET_LINK_LIBRARIES(rocksdb_se rocksdb_aux_lib)
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# MARIAROCKS_NOT_YET: Add -frtti flag when compiling RocksDB files.
# TODO: is this the right way to do this?
# - SQL layer and storage/rocksdb/*.cc are compiled with -fnortti
# - RocksDB files are compiled with "-fnortti ... -frtti"
# - This causes RocksDB headers to be compiled with different settings:
# = with RTTI when compiling RocksDB
# = without RTTI when compiling storage/rocksdb/*.cc
#
# (facebook/mysql-5.6 just compiles everything without -f*rtti, which means
# everything is compiled with -frtti)
#
# (also had to add -frtti above, because something that event_listener.cc
# includes requires it. So, now everything in MariaRocks is compiled with
# -frtti)
set_source_files_properties(event_listener.cc rdb_cf_options.cc
PROPERTIES COMPILE_FLAGS -frtti)
ENDIF()
SET(rocksdb_static_libs )
IF (NOT "$ENV{WITH_SNAPPY}" STREQUAL "")
SET(rocksdb_static_libs ${rocksdb_static_libs}
$ENV{WITH_SNAPPY}/libsnappy${PIC_EXT}.a)
ADD_DEFINITIONS(-DSNAPPY)
CHECK_FUNCTION_EXISTS(sched_getcpu HAVE_SCHED_GETCPU)
IF(HAVE_SCHED_GETCPU)
ADD_DEFINITIONS(-DHAVE_SCHED_GETCPU=1)
ENDIF()
IF (NOT "$ENV{WITH_LZ4}" STREQUAL "")
SET(rocksdb_static_libs ${rocksdb_static_libs}
$ENV{WITH_LZ4}/liblz4${PIC_EXT}.a)
ADD_DEFINITIONS(-DLZ4)
IF(WITH_UNIT_TESTS AND WITH_EMBEDDED_SERVER)
ADD_SUBDIRECTORY(unittest)
ENDIF()
IF (NOT "$ENV{WITH_BZ2}" STREQUAL "")
SET(rocksdb_static_libs ${rocksdb_static_libs}
$ENV{WITH_BZ2}/libbz2${PIC_EXT}.a)
ADD_DEFINITIONS(-DBZIP2)
ENDIF()
ADD_LIBRARY(rocksdb_tools STATIC
rocksdb/tools/ldb_tool.cc
rocksdb/tools/ldb_cmd.cc
rocksdb/tools/sst_dump_tool.cc
)
# link ZSTD only if instructed
IF (NOT "$ENV{WITH_ZSTD}" STREQUAL "")
SET(rocksdb_static_libs ${rocksdb_static_libs}
$ENV{WITH_ZSTD}/libzstd${PIC_EXT}.a)
ADD_DEFINITIONS(-DZSTD)
ENDIF()
MYSQL_ADD_EXECUTABLE(sst_dump rocksdb/tools/sst_dump.cc)
TARGET_LINK_LIBRARIES(sst_dump rocksdblib)
SET(rocksdb_static_libs ROCKSDB_AUX_LIB ${rocksdb_static_libs} ${ZLIB_LIBRARY} "-lrt")
MYSQL_ADD_EXECUTABLE(ldb rocksdb/tools/ldb.cc)
TARGET_LINK_LIBRARIES(ldb rocksdb_tools rocksdblib)
MYSQL_ADD_PLUGIN(rocksdb_se ${ROCKSDB_SOURCES} STORAGE_ENGINE DEFAULT MODULE_ONLY
LINK_LIBRARIES ${rocksdb_static_libs}
)
MYSQL_ADD_EXECUTABLE(mysql_ldb tools/mysql_ldb.cc)
TARGET_LINK_LIBRARIES(mysql_ldb rocksdb_tools rocksdb_aux_lib)
IF(WITH_EMBEDDED_SERVER)
ADD_SUBDIRECTORY(unittest)
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
SET_TARGET_PROPERTIES(rocksdb_tools sst_dump ldb mysql_ldb PROPERTIES COMPILE_FLAGS -frtti)
ENDIF()
IF (WITH_ROCKSDB_SE_STORAGE_ENGINE)
# TODO: read this file list from src.mk:TOOL_SOURCES
SET(ROCKSDB_TOOL_SOURCES
${CMAKE_SOURCE_DIR}/storage/rocksdb/rocksdb/tools/ldb_tool.cc
${CMAKE_SOURCE_DIR}/storage/rocksdb/rocksdb/tools/ldb_cmd.cc
${CMAKE_SOURCE_DIR}/storage/rocksdb/rocksdb/tools/sst_dump_tool.cc
)
set_source_files_properties(${ROCKSDB_TOOL_SOURCES} PROPERTIES COMPILE_FLAGS -frtti)
MYSQL_ADD_EXECUTABLE(sst_dump ${CMAKE_SOURCE_DIR}/storage/rocksdb/rocksdb/tools/sst_dump.cc ${ROCKSDB_TOOL_SOURCES})
TARGET_LINK_LIBRARIES(sst_dump ${rocksdb_static_libs})
MYSQL_ADD_EXECUTABLE(ldb ${CMAKE_SOURCE_DIR}/storage/rocksdb/rocksdb/tools/ldb.cc ${ROCKSDB_TOOL_SOURCES})
TARGET_LINK_LIBRARIES(ldb ${rocksdb_static_libs})
MYSQL_ADD_EXECUTABLE(mysql_ldb ${CMAKE_SOURCE_DIR}/storage/rocksdb/tools/mysql_ldb.cc ${ROCKSDB_TOOL_SOURCES})
TARGET_LINK_LIBRARIES(mysql_ldb ${rocksdb_static_libs})
IF(MSVC)
# RocksDB, the storage engine, overdoes "const" by adding
# additional const qualifiers to parameters of the overriden virtual functions
# This creates a lot of warnings, that we silence here.
ADD_DEFINITIONS(/wd4373)
# Some checks in C++ runtime that make debug build much slower
ADD_DEFINITIONS(-D_ITERATOR_DEBUG_LEVEL=0)
ENDIF()
if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
SET(ROCKSDB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/rocksdb)
INCLUDE_DIRECTORIES(
${ROCKSDB_SOURCE_DIR}
${ROCKSDB_SOURCE_DIR}/include
${ROCKSDB_SOURCE_DIR}/third-party/gtest-1.7.0/fused-src
)
list(APPEND CMAKE_MODULE_PATH "${ROCKSDB_SOURCE_DIR}/cmake/modules/")
if(WIN32)
# include(${ROCKSDB_SOURCE_DIR}/thirdparty.inc)
else()
option(WITH_ROCKSDB_JEMALLOC "build RocksDB with JeMalloc" OFF)
if(WITH_ROCKSDB_JEMALLOC)
find_package(JeMalloc REQUIRED)
add_definitions(-DROCKSDB_JEMALLOC)
include_directories(${JEMALLOC_INCLUDE_DIR})
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
# FreeBSD has jemaloc as default malloc
add_definitions(-DROCKSDB_JEMALLOC)
set(WITH_JEMALLOC ON)
endif()
endif()
# Optional compression libraries.
foreach(compression_lib LZ4 BZIP2 ZSTD snappy)
FIND_PACKAGE(${compression_lib} QUIET)
SET(WITH_ROCKSDB_${compression_lib} AUTO CACHE STRING
"Build RocksDB with ${compression_lib} compression. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
if(${WITH_ROCKSDB_${compression_lib}} STREQUAL "ON" AND NOT ${${compression_lib}_FOUND})
MESSAGE(FATAL_ERROR
"${compression_lib} library was not found, but WITH_ROCKSDB${compression_lib} option is ON.\
Either set WITH_ROCKSDB${compression_lib} to OFF, or make sure ${compression_lib} is installed")
endif()
endforeach()
if(LZ4_FOUND AND (NOT WITH_ROCKSDB_LZ4 STREQUAL "OFF"))
add_definitions(-DLZ4)
include_directories(${LZ4_INCLUDE_DIR})
list(APPEND THIRDPARTY_LIBS ${LZ4_LIBRARY})
endif()
if(BZIP2_FOUND AND (NOT WITH_ROCKSDB_BZIP2 STREQUAL "OFF"))
add_definitions(-DBZIP2)
include_directories(${BZIP2_INCLUDE_DIR})
list(APPEND THIRDPARTY_LIBS ${BZIP2_LIBRARIES})
endif()
if(SNAPPY_FOUND AND (NOT WITH_ROCKSDB_SNAPPY STREQUAL "OFF"))
add_definitions(-DSNAPPY)
include_directories(${SNAPPY_INCLUDE_DIR})
list(APPEND THIRDPARTY_LIBS ${SNAPPY_LIBRARIES})
endif()
if(ZSTD_FOUND AND (NOT WITH_ROCKSDB_ZSTD STREQUAL "OFF"))
add_definitions(-DZSTD)
include_directories(${ZSTD_INCLUDE_DIR})
list(APPEND THIRDPARTY_LIBS ${ZSTD_LIBRARY})
endif()
add_definitions(-DZLIB)
list(APPEND THIRDPARTY_LIBS ${ZLIB_LIBRARY})
if(CMAKE_SYSTEM_NAME MATCHES "Cygwin")
add_definitions(-fno-builtin-memcmp -DCYGWIN)
elseif(CMAKE_SYSTEM_NAME MATCHES "Darwin")
add_definitions(-DOS_MACOSX)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_definitions(-DOS_LINUX)
elseif(CMAKE_SYSTEM_NAME MATCHES "SunOS")
add_definitions(-DOS_SOLARIS)
elseif(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
add_definitions(-DOS_FREEBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "NetBSD")
add_definitions(-DOS_NETBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
add_definitions(-DOS_OPENBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "DragonFly")
add_definitions(-DOS_DRAGONFLYBSD)
elseif(CMAKE_SYSTEM_NAME MATCHES "Android")
add_definitions(-DOS_ANDROID)
elseif(CMAKE_SYSTEM_NAME MATCHES "Windows")
add_definitions(-DOS_WIN)
endif()
IF(MSVC)
add_definitions(/wd4244)
ENDIF()
if(NOT WIN32)
add_definitions(-DROCKSDB_PLATFORM_POSIX -DROCKSDB_LIB_IO_POSIX)
endif()
option(WITH_FALLOCATE "build with fallocate" ON)
if(WITH_FALLOCATE AND UNIX)
include(CheckCSourceCompiles)
CHECK_C_SOURCE_COMPILES("
#include <fcntl.h>
#include <linux/falloc.h>
int main() {
int fd = open(\"/dev/null\", 0);
fallocate(fd, FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE, 0, 1024);
}
" HAVE_FALLOCATE)
if(HAVE_FALLOCATE)
add_definitions(-DROCKSDB_FALLOCATE_PRESENT)
endif()
endif()
include(CheckFunctionExists)
CHECK_FUNCTION_EXISTS(malloc_usable_size HAVE_MALLOC_USABLE_SIZE)
if(HAVE_MALLOC_USABLE_SIZE)
add_definitions(-DROCKSDB_MALLOC_USABLE_SIZE)
endif()
include_directories(${ROCKSDB_SOURCE_DIR})
include_directories(${ROCKSDB_SOURCE_DIR}/include)
include_directories(SYSTEM ${ROCKSDB_SOURCE_DIR}/third-party/gtest-1.7.0/fused-src)
find_package(Threads REQUIRED)
if(WIN32)
set(SYSTEM_LIBS ${SYSTEM_LIBS} Shlwapi.lib Rpcrt4.lib)
else()
set(SYSTEM_LIBS ${CMAKE_THREAD_LIBS_INIT})
endif()
set(ROCKSDB_LIBS rocksdblib})
set(LIBS ${ROCKSDB_LIBS} ${THIRDPARTY_LIBS} ${SYSTEM_LIBS})
#add_subdirectory(${ROCKSDB_SOURCE_DIR}/tools)
# Main library source code
set(ROCKSDB_SOURCES
db/auto_roll_logger.cc
db/builder.cc
db/c.cc
db/column_family.cc
db/compacted_db_impl.cc
db/compaction.cc
db/compaction_iterator.cc
db/compaction_job.cc
db/compaction_picker.cc
db/convenience.cc
db/dbformat.cc
db/db_filesnapshot.cc
db/db_impl.cc
db/db_impl_debug.cc
db/db_impl_experimental.cc
db/db_impl_readonly.cc
db/db_info_dumper.cc
db/db_iter.cc
db/event_helpers.cc
db/external_sst_file_ingestion_job.cc
db/experimental.cc
db/filename.cc
db/file_indexer.cc
db/flush_job.cc
db/flush_scheduler.cc
db/forward_iterator.cc
db/internal_stats.cc
db/log_reader.cc
db/log_writer.cc
db/managed_iterator.cc
db/memtable.cc
db/memtable_allocator.cc
db/memtable_list.cc
db/merge_helper.cc
db/merge_operator.cc
db/range_del_aggregator.cc
db/repair.cc
db/snapshot_impl.cc
db/table_cache.cc
db/table_properties_collector.cc
db/transaction_log_impl.cc
db/version_builder.cc
db/version_edit.cc
db/version_set.cc
db/wal_manager.cc
db/write_batch.cc
db/write_batch_base.cc
db/write_controller.cc
db/write_thread.cc
db/xfunc_test_points.cc
memtable/hash_cuckoo_rep.cc
memtable/hash_linklist_rep.cc
memtable/hash_skiplist_rep.cc
memtable/skiplistrep.cc
memtable/vectorrep.cc
port/stack_trace.cc
table/adaptive_table_factory.cc
table/block.cc
table/block_based_filter_block.cc
table/block_based_table_builder.cc
table/block_based_table_factory.cc
table/block_based_table_reader.cc
table/block_builder.cc
table/block_prefix_index.cc
table/bloom_block.cc
table/cuckoo_table_builder.cc
table/cuckoo_table_factory.cc
table/cuckoo_table_reader.cc
table/flush_block_policy.cc
table/format.cc
table/full_filter_block.cc
table/get_context.cc
table/iterator.cc
table/merger.cc
table/sst_file_writer.cc
table/meta_blocks.cc
table/plain_table_builder.cc
table/plain_table_factory.cc
table/plain_table_index.cc
table/plain_table_key_coding.cc
table/plain_table_reader.cc
table/persistent_cache_helper.cc
table/table_properties.cc
table/two_level_iterator.cc
tools/sst_dump_tool.cc
tools/db_bench_tool.cc
tools/dump/db_dump_tool.cc
util/arena.cc
util/bloom.cc
util/cf_options.cc
util/clock_cache.cc
util/coding.cc
util/compaction_job_stats_impl.cc
util/comparator.cc
util/concurrent_arena.cc
util/crc32c.cc
util/db_options.cc
util/delete_scheduler.cc
util/dynamic_bloom.cc
util/env.cc
util/env_chroot.cc
util/env_hdfs.cc
util/event_logger.cc
util/file_util.cc
util/file_reader_writer.cc
util/sst_file_manager_impl.cc
util/filter_policy.cc
util/hash.cc
util/histogram.cc
util/histogram_windowing.cc
util/instrumented_mutex.cc
util/iostats_context.cc
util/lru_cache.cc
tools/ldb_cmd.cc
tools/ldb_tool.cc
util/logging.cc
util/log_buffer.cc
util/memenv.cc
util/murmurhash.cc
util/options.cc
util/options_helper.cc
util/options_parser.cc
util/options_sanity_check.cc
util/perf_context.cc
util/perf_level.cc
util/random.cc
util/rate_limiter.cc
util/sharded_cache.cc
util/slice.cc
util/statistics.cc
util/status.cc
util/status_message.cc
util/string_util.cc
util/sync_point.cc
util/testutil.cc
util/thread_local.cc
util/threadpool_imp.cc
util/thread_status_impl.cc
util/thread_status_updater.cc
util/thread_status_util.cc
util/thread_status_util_debug.cc
util/transaction_test_util.cc
util/xfunc.cc
util/xxhash.cc
utilities/backupable/backupable_db.cc
utilities/blob_db/blob_db.cc
utilities/checkpoint/checkpoint.cc
utilities/compaction_filters/remove_emptyvalue_compactionfilter.cc
utilities/date_tiered/date_tiered_db_impl.cc
utilities/document/document_db.cc
utilities/document/json_document.cc
utilities/document/json_document_builder.cc
utilities/env_mirror.cc
utilities/env_registry.cc
utilities/geodb/geodb_impl.cc
utilities/leveldb_options/leveldb_options.cc
utilities/lua/rocks_lua_compaction_filter.cc
utilities/memory/memory_util.cc
utilities/merge_operators/string_append/stringappend.cc
utilities/merge_operators/string_append/stringappend2.cc
utilities/merge_operators/put.cc
utilities/merge_operators/max.cc
utilities/merge_operators/uint64add.cc
utilities/option_change_migration/option_change_migration.cc
utilities/options/options_util.cc
utilities/persistent_cache/block_cache_tier.cc
utilities/persistent_cache/block_cache_tier_file.cc
utilities/persistent_cache/block_cache_tier_metadata.cc
utilities/persistent_cache/persistent_cache_tier.cc
utilities/persistent_cache/volatile_tier_impl.cc
utilities/redis/redis_lists.cc
utilities/simulator_cache/sim_cache.cc
utilities/spatialdb/spatial_db.cc
utilities/table_properties_collectors/compact_on_deletion_collector.cc
utilities/transactions/optimistic_transaction_impl.cc
utilities/transactions/optimistic_transaction_db_impl.cc
utilities/transactions/transaction_base.cc
utilities/transactions/transaction_impl.cc
utilities/transactions/transaction_db_impl.cc
utilities/transactions/transaction_db_mutex_impl.cc
utilities/transactions/transaction_lock_mgr.cc
utilities/transactions/transaction_util.cc
utilities/ttl/db_ttl_impl.cc
utilities/write_batch_with_index/write_batch_with_index.cc
utilities/write_batch_with_index/write_batch_with_index_internal.cc
utilities/col_buf_encoder.cc
utilities/col_buf_decoder.cc
utilities/column_aware_encoding_util.cc
)
if(WIN32)
list(APPEND ROCKSDB_SOURCES
port/win/io_win.cc
port/win/env_win.cc
port/win/env_default.cc
port/win/port_win.cc
port/win/win_logger.cc
port/win/xpress_win.cc)
else()
list(APPEND ROCKSDB_SOURCES
port/port_posix.cc
util/env_posix.cc
util/io_posix.cc)
endif()
SET(SOURCES)
FOREACH(s ${ROCKSDB_SOURCES})
list(APPEND SOURCES ${ROCKSDB_SOURCE_DIR}/${s})
ENDFOREACH()
IF(CMAKE_VERSION VERSION_GREATER "2.8.10")
STRING(TIMESTAMP GIT_DATE_TIME "%Y-%m-%d %H:%M:%S")
ENDIF()
CONFIGURE_FILE(${ROCKSDB_SOURCE_DIR}/util/build_version.cc.in build_version.cc @ONLY)
INCLUDE_DIRECTORIES(${ROCKSDB_SOURCE_DIR}/util)
list(APPEND SOURCES ${CMAKE_CURRENT_BINARY_DIR}/build_version.cc)
ADD_CONVENIENCE_LIBRARY(rocksdblib ${SOURCES})
target_link_libraries(rocksdblib ${THIRDPARTY_LIBS} ${SYSTEM_LIBS})
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set_target_properties(rocksdblib PROPERTIES COMPILE_FLAGS "-fPIC -fno-builtin-memcmp -frtti")
endif()
......@@ -359,10 +359,10 @@ static unsigned long long // NOLINT(runtime/int)
rocksdb_rate_limiter_bytes_per_sec;
static unsigned long // NOLINT(runtime/int)
rocksdb_persistent_cache_size;
static uint64_t rocksdb_info_log_level;
static ulong rocksdb_info_log_level;
static char *rocksdb_wal_dir;
static char *rocksdb_persistent_cache_path;
static uint64_t rocksdb_index_type;
static ulong rocksdb_index_type;
static char rocksdb_background_sync;
static uint32_t rocksdb_debug_optimizer_n_rows;
static my_bool rocksdb_debug_optimizer_no_zero_cardinality;
......@@ -594,13 +594,13 @@ static MYSQL_SYSVAR_UINT(
/* min */ (uint)rocksdb::WALRecoveryMode::kTolerateCorruptedTailRecords,
/* max */ (uint)rocksdb::WALRecoveryMode::kSkipAnyCorruptedRecords, 0);
static MYSQL_SYSVAR_ULONG(compaction_readahead_size,
static MYSQL_SYSVAR_SIZE_T(compaction_readahead_size,
rocksdb_db_options.compaction_readahead_size,
PLUGIN_VAR_RQCMDARG,
"DBOptions::compaction_readahead_size for RocksDB",
nullptr, nullptr,
rocksdb_db_options.compaction_readahead_size,
/* min */ 0L, /* max */ ULONG_MAX, 0);
/* min */ 0L, /* max */ SIZE_T_MAX, 0);
static MYSQL_SYSVAR_BOOL(
new_table_reader_for_compaction_inputs,
......@@ -640,12 +640,12 @@ static MYSQL_SYSVAR_INT(max_open_files, rocksdb_db_options.max_open_files,
nullptr, rocksdb_db_options.max_open_files,
/* min */ -1, /* max */ INT_MAX, 0);
static MYSQL_SYSVAR_ULONG(max_total_wal_size,
static MYSQL_SYSVAR_UINT64_T(max_total_wal_size,
rocksdb_db_options.max_total_wal_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"DBOptions::max_total_wal_size for RocksDB", nullptr,
nullptr, rocksdb_db_options.max_total_wal_size,
/* min */ 0L, /* max */ LONG_MAX, 0);
/* min */ 0, /* max */ LONGLONG_MAX, 0);
static MYSQL_SYSVAR_BOOL(
disabledatasync,
......@@ -678,13 +678,13 @@ static MYSQL_SYSVAR_ULONG(
nullptr, nullptr, rocksdb_persistent_cache_size,
/* min */ 0L, /* max */ ULONG_MAX, 0);
static MYSQL_SYSVAR_ULONG(
static MYSQL_SYSVAR_UINT64_T(
delete_obsolete_files_period_micros,
rocksdb_db_options.delete_obsolete_files_period_micros,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"DBOptions::delete_obsolete_files_period_micros for RocksDB", nullptr,
nullptr, rocksdb_db_options.delete_obsolete_files_period_micros,
/* min */ 0L, /* max */ LONG_MAX, 0);
/* min */ 0, /* max */ LONGLONG_MAX, 0);
static MYSQL_SYSVAR_INT(base_background_compactions,
rocksdb_db_options.base_background_compactions,
......@@ -717,35 +717,35 @@ static MYSQL_SYSVAR_UINT(max_subcompactions,
nullptr, rocksdb_db_options.max_subcompactions,
/* min */ 1, /* max */ MAX_SUBCOMPACTIONS, 0);
static MYSQL_SYSVAR_ULONG(max_log_file_size,
static MYSQL_SYSVAR_SIZE_T(max_log_file_size,
rocksdb_db_options.max_log_file_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"DBOptions::max_log_file_size for RocksDB", nullptr,
nullptr, rocksdb_db_options.max_log_file_size,
/* min */ 0L, /* max */ LONG_MAX, 0);
/* min */ 0L, /* max */ SIZE_T_MAX, 0);
static MYSQL_SYSVAR_ULONG(log_file_time_to_roll,
static MYSQL_SYSVAR_SIZE_T(log_file_time_to_roll,
rocksdb_db_options.log_file_time_to_roll,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"DBOptions::log_file_time_to_roll for RocksDB",
nullptr, nullptr,
rocksdb_db_options.log_file_time_to_roll,
/* min */ 0L, /* max */ LONG_MAX, 0);
/* min */ 0L, /* max */ SIZE_T_MAX, 0);
static MYSQL_SYSVAR_ULONG(keep_log_file_num,
static MYSQL_SYSVAR_SIZE_T(keep_log_file_num,
rocksdb_db_options.keep_log_file_num,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"DBOptions::keep_log_file_num for RocksDB", nullptr,
nullptr, rocksdb_db_options.keep_log_file_num,
/* min */ 0L, /* max */ LONG_MAX, 0);
/* min */ 0L, /* max */ SIZE_T_MAX, 0);
static MYSQL_SYSVAR_ULONG(max_manifest_file_size,
static MYSQL_SYSVAR_UINT64_T(max_manifest_file_size,
rocksdb_db_options.max_manifest_file_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"DBOptions::max_manifest_file_size for RocksDB",
nullptr, nullptr,
rocksdb_db_options.max_manifest_file_size,
/* min */ 0L, /* max */ ULONG_MAX, 0);
/* min */ 0L, /* max */ ULONGLONG_MAX, 0);
static MYSQL_SYSVAR_INT(table_cache_numshardbits,
rocksdb_db_options.table_cache_numshardbits,
......@@ -755,26 +755,26 @@ static MYSQL_SYSVAR_INT(table_cache_numshardbits,
rocksdb_db_options.table_cache_numshardbits,
/* min */ 0, /* max */ INT_MAX, 0);
static MYSQL_SYSVAR_ULONG(wal_ttl_seconds, rocksdb_db_options.WAL_ttl_seconds,
static MYSQL_SYSVAR_UINT64_T(wal_ttl_seconds, rocksdb_db_options.WAL_ttl_seconds,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"DBOptions::WAL_ttl_seconds for RocksDB", nullptr,
nullptr, rocksdb_db_options.WAL_ttl_seconds,
/* min */ 0L, /* max */ LONG_MAX, 0);
/* min */ 0L, /* max */ LONGLONG_MAX, 0);
static MYSQL_SYSVAR_ULONG(wal_size_limit_mb,
static MYSQL_SYSVAR_UINT64_T(wal_size_limit_mb,
rocksdb_db_options.WAL_size_limit_MB,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"DBOptions::WAL_size_limit_MB for RocksDB", nullptr,
nullptr, rocksdb_db_options.WAL_size_limit_MB,
/* min */ 0L, /* max */ LONG_MAX, 0);
/* min */ 0L, /* max */ LONGLONG_MAX, 0);
static MYSQL_SYSVAR_ULONG(manifest_preallocation_size,
static MYSQL_SYSVAR_SIZE_T(manifest_preallocation_size,
rocksdb_db_options.manifest_preallocation_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"DBOptions::manifest_preallocation_size for RocksDB",
nullptr, nullptr,
rocksdb_db_options.manifest_preallocation_size,
/* min */ 0L, /* max */ LONG_MAX, 0);
/* min */ 0L, /* max */ SIZE_T_MAX, 0);
static MYSQL_SYSVAR_BOOL(
use_direct_reads,
......@@ -826,13 +826,13 @@ static MYSQL_SYSVAR_BOOL(
"DBOptions::advise_random_on_open for RocksDB", nullptr, nullptr,
rocksdb_db_options.advise_random_on_open);
static MYSQL_SYSVAR_ULONG(db_write_buffer_size,
static MYSQL_SYSVAR_SIZE_T(db_write_buffer_size,
rocksdb_db_options.db_write_buffer_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"DBOptions::db_write_buffer_size for RocksDB",
nullptr, nullptr,
rocksdb_db_options.db_write_buffer_size,
/* min */ 0L, /* max */ LONG_MAX, 0);
/* min */ 0L, /* max */ SIZE_T_MAX, 0);
static MYSQL_SYSVAR_BOOL(
use_adaptive_mutex,
......@@ -841,18 +841,18 @@ static MYSQL_SYSVAR_BOOL(
"DBOptions::use_adaptive_mutex for RocksDB", nullptr, nullptr,
rocksdb_db_options.use_adaptive_mutex);
static MYSQL_SYSVAR_ULONG(bytes_per_sync, rocksdb_db_options.bytes_per_sync,
static MYSQL_SYSVAR_UINT64_T(bytes_per_sync, rocksdb_db_options.bytes_per_sync,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"DBOptions::bytes_per_sync for RocksDB", nullptr,
nullptr, rocksdb_db_options.bytes_per_sync,
/* min */ 0L, /* max */ LONG_MAX, 0);
/* min */ 0L, /* max */ ULONGLONG_MAX, 0);
static MYSQL_SYSVAR_ULONG(wal_bytes_per_sync,
static MYSQL_SYSVAR_UINT64_T(wal_bytes_per_sync,
rocksdb_db_options.wal_bytes_per_sync,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"DBOptions::wal_bytes_per_sync for RocksDB", nullptr,
nullptr, rocksdb_db_options.wal_bytes_per_sync,
/* min */ 0L, /* max */ LONG_MAX, 0);
/* min */ 0L, /* max */ ULONGLONG_MAX, 0);
static MYSQL_SYSVAR_BOOL(
enable_thread_tracking,
......@@ -897,7 +897,7 @@ static MYSQL_SYSVAR_ENUM(index_type, rocksdb_index_type,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"BlockBasedTableOptions::index_type for RocksDB",
nullptr, nullptr,
(uint64_t)rocksdb_tbl_options.index_type,
(ulong)rocksdb_tbl_options.index_type,
&index_type_typelib);
static MYSQL_SYSVAR_BOOL(
......@@ -915,11 +915,11 @@ static MYSQL_SYSVAR_BOOL(
"BlockBasedTableOptions::no_block_cache for RocksDB", nullptr, nullptr,
rocksdb_tbl_options.no_block_cache);
static MYSQL_SYSVAR_ULONG(block_size, rocksdb_tbl_options.block_size,
static MYSQL_SYSVAR_SIZE_T(block_size, rocksdb_tbl_options.block_size,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"BlockBasedTableOptions::block_size for RocksDB",
nullptr, nullptr, rocksdb_tbl_options.block_size,
/* min */ 1L, /* max */ LONG_MAX, 0);
/* min */ 1L, /* max */ SIZE_T_MAX, 0);
static MYSQL_SYSVAR_INT(
block_size_deviation, rocksdb_tbl_options.block_size_deviation,
......@@ -2852,7 +2852,8 @@ class Rdb_snapshot_status : public Rdb_tx_list_walker {
m_data += format_string("---SNAPSHOT, ACTIVE %lld sec\n"
"%s\n"
"lock count %llu, write count %llu\n",
curr_time - snapshot_timestamp, buffer,
(longlong)(curr_time - snapshot_timestamp),
buffer,
tx->get_lock_count(), tx->get_write_count());
}
}
......@@ -3035,20 +3036,20 @@ static bool rocksdb_show_status(handlerton *const hton, THD *const thd,
str.clear();
rocksdb::MemoryUtil::GetApproximateMemoryUsageByType(dbs, cache_set,
&temp_usage_by_type);
snprintf(buf, sizeof(buf), "\nMemTable Total: %lu",
temp_usage_by_type[rocksdb::MemoryUtil::kMemTableTotal]);
snprintf(buf, sizeof(buf), "\nMemTable Total: %llu",
(ulonglong)temp_usage_by_type[rocksdb::MemoryUtil::kMemTableTotal]);
str.append(buf);
snprintf(buf, sizeof(buf), "\nMemTable Unflushed: %lu",
temp_usage_by_type[rocksdb::MemoryUtil::kMemTableUnFlushed]);
snprintf(buf, sizeof(buf), "\nMemTable Unflushed: %llu",
(ulonglong)temp_usage_by_type[rocksdb::MemoryUtil::kMemTableUnFlushed]);
str.append(buf);
snprintf(buf, sizeof(buf), "\nTable Readers Total: %lu",
temp_usage_by_type[rocksdb::MemoryUtil::kTableReadersTotal]);
snprintf(buf, sizeof(buf), "\nTable Readers Total: %llu",
(ulonglong)temp_usage_by_type[rocksdb::MemoryUtil::kTableReadersTotal]);
str.append(buf);
snprintf(buf, sizeof(buf), "\nCache Total: %lu",
temp_usage_by_type[rocksdb::MemoryUtil::kCacheTotal]);
snprintf(buf, sizeof(buf), "\nCache Total: %llu",
(ulonglong)temp_usage_by_type[rocksdb::MemoryUtil::kCacheTotal]);
str.append(buf);
snprintf(buf, sizeof(buf), "\nDefault Cache Capacity: %lu",
internal_cache_count * kDefaultInternalCacheSize);
snprintf(buf, sizeof(buf), "\nDefault Cache Capacity: %llu",
(ulonglong)internal_cache_count * kDefaultInternalCacheSize);
str.append(buf);
res |= print_stats(thd, "Memory_Stats", "rocksdb", str, stat_print);
#ifdef MARIAROCKS_NOT_YET
......@@ -3424,7 +3425,11 @@ static int rocksdb_init_func(void *const p) {
and RocksDB doesn't provide any way to check what kind of error it was.
Checking system errno happens to work right now.
*/
if (status.IsIOError() && errno == ENOENT) {
if (status.IsIOError()
#ifndef _WIN32
&& errno == ENOENT
#endif
) {
sql_print_information("RocksDB: Got ENOENT when listing column families");
sql_print_information(
"RocksDB: assuming that we're creating a new database");
......@@ -5214,12 +5219,12 @@ int rdb_normalize_tablename(const std::string &tablename,
std::string *const strbuf) {
DBUG_ASSERT(strbuf != nullptr);
if (tablename.size() < 2 || tablename[0] != '.' || tablename[1] != '/') {
if (tablename.size() < 2 || tablename[0] != '.' || tablename[1] != FN_LIBCHAR) {
DBUG_ASSERT(0); // We were not passed table name?
return HA_ERR_INTERNAL_ERROR;
}
size_t pos = tablename.find_first_of('/', 2);
size_t pos = tablename.find_first_of(FN_LIBCHAR, 2);
if (pos == std::string::npos) {
DBUG_ASSERT(0); // We were not passed table name?
return HA_ERR_INTERNAL_ERROR;
......@@ -8472,10 +8477,10 @@ void Rdb_drop_index_thread::run() {
}
timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_sec += dict_manager.is_drop_index_empty()
int sec= dict_manager.is_drop_index_empty()
? 24 * 60 * 60 // no filtering
: 60; // filtering
set_timespec(ts,sec);
const auto ret MY_ATTRIBUTE((__unused__)) =
mysql_cond_timedwait(&m_signal_cond, &m_signal_mutex, &ts);
......@@ -9987,8 +9992,7 @@ void Rdb_background_thread::run() {
const int WAKE_UP_INTERVAL = 1;
timespec ts_next_sync;
clock_gettime(CLOCK_REALTIME, &ts_next_sync);
ts_next_sync.tv_sec += WAKE_UP_INTERVAL;
set_timespec(ts_next_sync, WAKE_UP_INTERVAL);
for (;;) {
// Wait until the next timeout or until we receive a signal to stop the
......@@ -10019,8 +10023,9 @@ void Rdb_background_thread::run() {
ddl_manager.persist_stats();
}
timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
// Set the next timestamp for mysql_cond_timedwait() (which ends up calling
// pthread_cond_timedwait()) to wait on.
set_timespec(ts_next_sync, WAKE_UP_INTERVAL);
// Flush the WAL.
if (rdb && rocksdb_background_sync) {
......@@ -10030,10 +10035,6 @@ void Rdb_background_thread::run() {
rdb_handle_io_error(s, RDB_IO_ERROR_BG_THREAD);
}
}
// Set the next timestamp for mysql_cond_timedwait() (which ends up calling
// pthread_cond_timedwait()) to wait on.
ts_next_sync.tv_sec = ts.tv_sec + WAKE_UP_INTERVAL;
}
// save remaining stats which might've left unsaved
......
......@@ -30,6 +30,14 @@
#include "./my_global.h" /* ulonglong */
#include "./sql_string.h"
#ifdef _WIN32
#undef pthread_key_create
#undef pthread_key_delete
#undef pthread_setspecific
#undef pthread_getspecific
#endif
/* RocksDB header files */
#include "rocksdb/cache.h"
#include "rocksdb/perf_context.h"
......
......@@ -9,7 +9,7 @@ ERROR 23000: Duplicate entry '5' for key 'kb'
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL DEFAULT '0',
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`)
) ENGINE=ROCKSDB DEFAULT CHARSET=latin1
......@@ -25,7 +25,7 @@ INSERT INTO t1 (a,b) VALUES (5,8);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL DEFAULT '0',
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `kb` (`b`)
......@@ -46,7 +46,7 @@ INSERT INTO t1 (a, b) VALUES (4, NULL);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL DEFAULT '0',
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
UNIQUE KEY `kb` (`b`)
......@@ -64,7 +64,7 @@ ALTER TABLE t1 ADD UNIQUE INDEX kbc(b,c), ALGORITHM=INPLACE;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) NOT NULL DEFAULT '0',
`a` int(11) NOT NULL,
`b` int(11) DEFAULT NULL,
`c` int(11) DEFAULT NULL,
PRIMARY KEY (`a`),
......
SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX;
trx_id trx_state trx_started trx_requested_lock_id trx_wait_started trx_weight trx_mysql_thread_id trx_query trx_operation_state trx_tables_in_use trx_tables_locked trx_lock_structs trx_lock_memory_bytes trx_rows_locked trx_rows_modified trx_concurrency_tickets trx_isolation_level trx_unique_checks trx_foreign_key_checks trx_last_foreign_key_error trx_adaptive_hash_latched trx_adaptive_hash_timeout trx_is_read_only trx_autocommit_non_locking
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_TRX but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;
lock_id lock_trx_id lock_mode lock_type lock_table lock_index lock_space lock_page lock_rec lock_data
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_LOCKS but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
requesting_trx_id requested_lock_id blocking_trx_id blocking_lock_id
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_LOCK_WAITS but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP;
page_size compress_ops compress_ops_ok compress_time uncompress_ops uncompress_time
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_CMP but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_RESET;
page_size compress_ops compress_ops_ok compress_time uncompress_ops uncompress_time
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_CMP_RESET but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX;
database_name table_name index_name compress_ops compress_ops_ok compress_time uncompress_ops uncompress_time
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX_RESET;
database_name table_name index_name compress_ops compress_ops_ok compress_time uncompress_ops uncompress_time
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_CMP_PER_INDEX_RESET but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM;
page_size buffer_pool_instance pages_used pages_free relocation_ops relocation_time
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_CMPMEM but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_CMPMEM_RESET;
page_size buffer_pool_instance pages_used pages_free relocation_ops relocation_time
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_CMPMEM_RESET but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_METRICS;
NAME SUBSYSTEM COUNT MAX_COUNT MIN_COUNT AVG_COUNT COUNT_RESET MAX_COUNT_RESET MIN_COUNT_RESET AVG_COUNT_RESET TIME_ENABLED TIME_DISABLED TIME_ELAPSED TIME_RESET STATUS TYPE COMMENT
metadata_table_handles_opened metadata 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of table handles opened
......@@ -346,49 +328,25 @@ SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG;
KEY VALUE
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
POOL_ID POOL_SIZE FREE_BUFFERS DATABASE_PAGES OLD_DATABASE_PAGES MODIFIED_DATABASE_PAGES PENDING_DECOMPRESS PENDING_READS PENDING_FLUSH_LRU PENDING_FLUSH_LIST PAGES_MADE_YOUNG PAGES_NOT_MADE_YOUNG PAGES_MADE_YOUNG_RATE PAGES_MADE_NOT_YOUNG_RATE NUMBER_PAGES_READ NUMBER_PAGES_CREATED NUMBER_PAGES_WRITTEN PAGES_READ_RATE PAGES_CREATE_RATE PAGES_WRITTEN_RATE NUMBER_PAGES_GET HIT_RATE YOUNG_MAKE_PER_THOUSAND_GETS NOT_YOUNG_MAKE_PER_THOUSAND_GETS NUMBER_PAGES_READ_AHEAD NUMBER_READ_AHEAD_EVICTED READ_AHEAD_RATE READ_AHEAD_EVICTED_RATE LRU_IO_TOTAL LRU_IO_CURRENT UNCOMPRESS_TOTAL UNCOMPRESS_CURRENT
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
POOL_ID BLOCK_ID SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE PAGE_STATE IO_FIX IS_OLD FREE_PAGE_CLOCK
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_BUFFER_PAGE but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU;
POOL_ID LRU_POSITION SPACE PAGE_NUMBER PAGE_TYPE FLUSH_TYPE FIX_COUNT IS_HASHED NEWEST_MODIFICATION OLDEST_MODIFICATION ACCESS_TIME TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE COMPRESSED_SIZE COMPRESSED IO_FIX IS_OLD FREE_PAGE_CLOCK
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
TABLE_ID NAME FLAG N_COLS SPACE FILE_FORMAT ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_SYS_TABLES but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
TABLE_ID NAME STATS_INITIALIZED NUM_ROWS CLUST_INDEX_SIZE OTHER_INDEX_SIZE MODIFIED_COUNTER AUTOINC REF_COUNT
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES;
INDEX_ID NAME TABLE_ID TYPE N_FIELDS PAGE_NO SPACE MERGE_THRESHOLD
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_SYS_INDEXES but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS;
TABLE_ID NAME POS MTYPE PRTYPE LEN
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_SYS_COLUMNS but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS;
INDEX_ID NAME POS
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_SYS_FIELDS but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID FOR_NAME REF_NAME N_COLS TYPE
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_SYS_FOREIGN but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID FOR_COL_NAME REF_COL_NAME POS
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES;
SPACE NAME FLAG FILE_FORMAT ROW_FORMAT PAGE_SIZE ZIP_PAGE_SIZE SPACE_TYPE FS_BLOCK_SIZE FILE_SIZE ALLOCATED_SIZE
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES but the InnoDB storage engine is not installed
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_DATAFILES;
SPACE PATH
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.INNODB_SYS_DATAFILES but the InnoDB storage engine is not installed
......@@ -3,12 +3,12 @@ DROP TABLE IF EXISTS VAR_POP;
DROP TABLE IF EXISTS TEMP0;
DROP TABLE IF EXISTS VAR_SAMP;
CREATE TABLE t1 (i INT, j INT, k INT, PRIMARY KEY (i)) ENGINE = ROCKSDB PARTITION BY KEY(i) PARTITIONS 4;
SHOW TABLES;
Tables_in_test
TEMP0
VAR_POP
VAR_SAMP
show tables;
tables_in_test
t1
temp0
var_pop
var_samp
SELECT * FROM t1 ORDER BY i LIMIT 10;
i j k
1 1 1
......
--ignore-db-dirs=.rocksdb --plugin-load=ha_rocksdb_se
--ignore-db-dirs=.rocksdb --plugin-load=$HA_ROCKSDB_SO
--source include/have_rocksdb.inc
# Unixisms ("exec ls" in set_checkpoint.inc etc)
--source include/not_windows.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
......
......@@ -3,6 +3,10 @@
# following check is commented out:
# --source include/have_fullregex.inc
# Unixisms (exec grep)
--source include/not_windows.inc
SET @start_global_value = @@global.ROCKSDB_STRICT_COLLATION_EXCEPTIONS;
--disable_warnings
......
--source include/not_windows.inc
--source include/have_rocksdb.inc
--disable_warnings
......
--source include/have_rocksdb.inc
# Bash
--source include/not_windows.inc
#
# Generate concurrent requests to alter a table using mysqlslap
#
......
--source include/have_rocksdb.inc
#Unixisms (possibly Linuxisms, exec truncate)
--source include/not_windows.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
......
--source include/have_rocksdb.inc
#Unixisms (--exec truncate, du, grep ,sed)
--source include/not_windows.inc
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
......
......@@ -7,10 +7,10 @@ INSERT INTO t values (1), (2), (3);
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE t(id int primary key) engine=rocksdb;
FLUSH TABLES;
--exec mv $MYSQLTEST_VARDIR/mysqld.1/data/test/t.frm $MYSQLTEST_VARDIR/mysqld.1/data/test/t.frm.tmp
move_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t.frm $MYSQLTEST_VARDIR/mysqld.1/data/test/t.frm.tmp;
--error ER_UNKNOWN_ERROR
CREATE TABLE t(id int primary key) engine=rocksdb;
--exec mv $MYSQLTEST_VARDIR/mysqld.1/data/test/t.frm.tmp $MYSQLTEST_VARDIR/mysqld.1/data/test/t.frm
move_file $MYSQLTEST_VARDIR/mysqld.1/data/test/t.frm.tmp $MYSQLTEST_VARDIR/mysqld.1/data/test/t.frm;
FLUSH TABLES;
SELECT * FROM t;
DROP TABLE t;
......@@ -3,8 +3,14 @@
# Make sure that the InnoDb information schema tables are disabled when InnoDB
# is turned off and attempting to access them doesn't crash.
# Disable warnings, as the table names in warnings appear in lower or uppercase
# depending on platform
--disable_warnings
SELECT * FROM INFORMATION_SCHEMA.INNODB_TRX;
#Not in MariaDB: SELECT * FROM INFORMATION_SCHEMA.INNODB_FILE_STATUS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCKS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_LOCK_WAITS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_CMP;
......@@ -33,3 +39,5 @@ SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_DATAFILES;
#Not in MariaDB: SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_DOCSTORE_FIELDS;
--enable_warnings
--source include/have_rocksdb.inc
--source include/have_partition.inc
......@@ -30,7 +31,7 @@ CREATE TABLE TEMP0 (a int) ENGINE = ROCKSDB PARTITION BY HASH (a) PARTITIONS 3;
CREATE TABLE VAR_SAMP (a int) ENGINE = ROCKSDB PARTITION BY HASH (a) PARTITIONS 10;
--enable_query_log
--lowercase_result
SHOW TABLES;
SELECT * FROM t1 ORDER BY i LIMIT 10;
......
--source include/have_rocksdb.inc
# Does not run on Windows, because of unixisms (exec grep, cut, truncate file with exec echo)
--source include/not_windows.inc
#
# Tests for row checksums feature
......
--source include/have_rocksdb.inc
# Unixisms (exec ls | wc -l)
--source include/not_windows.inc
let $ddir = $MYSQL_TMP_DIR/.rocksdb_datadir.test.install.db;
let $rdb_ddir = $MYSQL_TMP_DIR/.rocksdb_datadir.test;
let $sql_file = $MYSQL_TMP_DIR/rocksdb_datadir.sql;
......
......@@ -99,6 +99,7 @@ drop table t1, t2;
--echo #
CREATE TABLE t1 (c1 INT NOT NULL, c2 CHAR(5)) PARTITION BY HASH(c1) PARTITIONS 4;
INSERT INTO t1 VALUES(1,'a');
--replace_result \\ /
--error ER_ERROR_ON_RENAME
RENAME TABLE t1 TO db3.t3;
SELECT * FROM t1;
......
......@@ -20,10 +20,11 @@ let TESTDB = $TESTDB;
--perl
$ENV{'RQG_HOME'}=$ENV{'RQG_BASE'};
foreach $grammar_file (split(/ /, $ENV{'GRAMMAR_FILES'})) {
# Errors from the gentest.pl file will be captured in the results file
my $cmd = "RQG_HOME=$ENV{'RQG_BASE'} perl $ENV{'RQG_BASE'}/gentest.pl " .
my $cmd = "perl $ENV{'RQG_BASE'}/gentest.pl " .
"--dsn=dbi:mysql:host=:port=:user=root:database=$ENV{'TESTDB'}" .
":mysql_socket=$ENV{'MYSQL_SOCKET'} " .
"--gendata=$ENV{'RQG_BASE'}/conf/$ENV{'TESTDIR'}/$ENV{'DATA_FILE'} " .
......
--source include/have_rocksdb.inc
#Unixism (exec awk)
-- source include/not_windows.inc
SET @cur_long_query_time = @@long_query_time;
# Set the long query time to something big so that nothing unexpected gets into it
SET @@long_query_time = 600;
......
......@@ -60,7 +60,7 @@ SELECT table_name, data_length>0, index_length>0 FROM information_schema.tables
--source include/restart_mysqld.inc
# give the server a chance to load in statistics
--exec sleep 5
--sleep 5
SELECT table_name, table_rows FROM information_schema.tables WHERE table_schema = DATABASE();
SELECT table_name, data_length>0, index_length>0 FROM information_schema.tables WHERE table_schema = DATABASE();
......
--source include/have_rocksdb.inc
--source include/have_partition.inc
# Unixism, exec sed
--source include/not_windows.inc
let ddl= $MYSQL_TMP_DIR/unique_sec.sql;
--exec sed s/##CF##//g ../storage/rocksdb/mysql-test/rocksdb/t/unique_sec.inc > $ddl
......
......@@ -15,7 +15,11 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <my_config.h>
#ifdef _WIN32
#define _CRT_RAND_S
#include <stdlib.h>
#define rand_r rand_s
#endif
/* This C++ file's header file */
#include "./properties_collector.h"
......@@ -114,9 +118,9 @@ void Rdb_tbl_prop_coll::AdjustDeletedRows(rocksdb::EntryType type) {
}
Rdb_index_stats *Rdb_tbl_prop_coll::AccessStats(const rocksdb::Slice &key) {
GL_INDEX_ID gl_index_id = {.cf_id = m_cf_id,
.index_id = rdb_netbuf_to_uint32(
reinterpret_cast<const uchar *>(key.data()))};
GL_INDEX_ID gl_index_id;
gl_index_id.cf_id = m_cf_id;
gl_index_id.index_id = rdb_netbuf_to_uint32(reinterpret_cast<const uchar*>(key.data()));
if (m_last_stats == nullptr || m_last_stats->m_gl_index_id != gl_index_id) {
m_keydef = nullptr;
......
......@@ -20,6 +20,16 @@
#include <string>
#include <vector>
#ifdef _WIN32
#include <stdlib.h>
#define htobe64 _byteswap_uint64
#define be64toh _byteswap_uint64
#define htobe32 _byteswap_ulong
#define be32toh _byteswap_ulong
#define htobe16 _byteswap_ushort
#define be16toh _byteswap_ushort
#endif
namespace myrocks {
/*
......
......@@ -1425,7 +1425,7 @@ static void rdb_pack_with_varchar_encoding(
// pad with zeros if necessary;
for (size_t idx = 0; idx < padding_bytes; idx++)
*(ptr++) = 0;
*(ptr++) = 255 - padding_bytes;
*(ptr++) = 255 - (uchar)padding_bytes;
xfrm_len -= copy_len;
encoded_size += RDB_ESCAPE_LENGTH;
......@@ -1686,7 +1686,7 @@ static int rdb_unpack_binary_or_utf8_varchar(
/* Save the length */
if (field_var->length_bytes == 1) {
d0[0] = len;
d0[0] = (uchar)len;
} else {
DBUG_ASSERT(field_var->length_bytes == 2);
int2store(d0, len);
......@@ -1796,7 +1796,7 @@ static int rdb_unpack_binary_or_utf8_varchar_space_pad(
/* Save the length */
if (field_var->length_bytes == 1) {
d0[0] = len;
d0[0] = (uchar)len;
} else {
DBUG_ASSERT(field_var->length_bytes == 2);
int2store(d0, len);
......@@ -2055,7 +2055,7 @@ int rdb_unpack_simple_varchar_space_pad(Rdb_field_packing *const fpi,
/* Save the length */
if (field_var->length_bytes == 1) {
d0[0] = len;
d0[0] = (uchar)len;
} else {
DBUG_ASSERT(field_var->length_bytes == 2);
int2store(d0, len);
......@@ -3415,7 +3415,7 @@ Rdb_binlog_manager::pack_value(uchar *const buf, const char *const binlog_name,
// store binlog file name length
DBUG_ASSERT(strlen(binlog_name) <= FN_REFLEN);
const uint16_t binlog_name_len = strlen(binlog_name);
const uint16_t binlog_name_len = (uint16_t)strlen(binlog_name);
rdb_netbuf_store_uint16(buf + pack_len, binlog_name_len);
pack_len += sizeof(uint16);
......@@ -3429,7 +3429,7 @@ Rdb_binlog_manager::pack_value(uchar *const buf, const char *const binlog_name,
// store binlog gtid length.
// If gtid was not set, store 0 instead
const uint16_t binlog_gtid_len = binlog_gtid ? strlen(binlog_gtid) : 0;
const uint16_t binlog_gtid_len = binlog_gtid ? (uint16_t)strlen(binlog_gtid) : 0;
rdb_netbuf_store_uint16(buf + pack_len, binlog_gtid_len);
pack_len += sizeof(uint16);
......
......@@ -24,9 +24,12 @@
#include <unordered_set>
#include <utility>
#include <vector>
#include <array>
/* C standard header files */
#ifndef _WIN32
#include <arpa/inet.h>
#endif
/* MyRocks header files */
#include "./ha_rocksdb.h"
......
......@@ -750,7 +750,7 @@ static int rdb_i_s_global_info_fill_table(
char gtid_buf[GTID_BUF_LEN] = {0};
if (blm->read(file_buf, &pos, gtid_buf)) {
snprintf(pos_buf, INT_BUF_LEN, "%lu", (uint64_t)pos);
snprintf(pos_buf, INT_BUF_LEN, "%llu", (ulonglong)pos);
ret |= rdb_global_info_fill_row(thd, tables, "BINLOG", "FILE", file_buf);
ret |= rdb_global_info_fill_row(thd, tables, "BINLOG", "POS", pos_buf);
ret |= rdb_global_info_fill_row(thd, tables, "BINLOG", "GTID", gtid_buf);
......@@ -1552,7 +1552,7 @@ struct st_maria_plugin rdb_i_s_index_file_map = {
0, /* flags */
};
struct st_mysql_plugin rdb_i_s_lock_info = {
struct st_maria_plugin rdb_i_s_lock_info = {
MYSQL_INFORMATION_SCHEMA_PLUGIN,
&rdb_i_s_info,
"ROCKSDB_LOCKS",
......@@ -1568,7 +1568,7 @@ struct st_mysql_plugin rdb_i_s_lock_info = {
0, /* flags */
};
struct st_mysql_plugin rdb_i_s_trx_info = {
struct st_maria_plugin rdb_i_s_trx_info = {
MYSQL_INFORMATION_SCHEMA_PLUGIN,
&rdb_i_s_info,
"ROCKSDB_TRX",
......
......@@ -64,7 +64,7 @@ bool Regex_list_handler::set_patterns(const std::string& pattern_str)
delete m_pattern;
m_pattern= pattern;
}
catch (const std::regex_error& e)
catch (const std::regex_error&)
{
// This pattern is invalid.
pattern_valid= false;
......
......@@ -67,7 +67,7 @@ class Rdb_sst_info {
const rocksdb::DBOptions &m_db_options;
uint64_t m_curr_size;
uint64_t m_max_size;
uint m_sst_count;
uint32_t m_sst_count;
std::string m_error_msg;
std::string m_prefix;
static std::string m_suffix;
......
......@@ -21,6 +21,17 @@
/* MySQL includes */
#include "./my_global.h"
#ifdef _WIN32
#include <my_pthread.h>
/*
Rocksdb implements their own pthread_key functions
undefine some my_pthread.h macros
*/
#undef pthread_key_create
#undef pthread_key_delete
#undef pthread_setspecific
#undef pthread_getspecific
#endif
#include <mysql/psi/mysql_table.h>
#ifdef MARIAROCKS_NOT_YET
#include <mysql/thread_pool_priv.h>
......@@ -65,6 +76,21 @@ class Rdb_thread {
void signal(const bool &stop_thread = false);
int join() { return pthread_join(m_handle, nullptr); }
#ifndef _WIN32
#else
/*
mysys on Windows creates "detached" threads in pthread_create().
m_handle here is the thread id I(it is not reused by the OS
thus it is safe to state there can't be other thread with
the same id at this point).
If thread is already finished before pthread_join(),
we get EINVAL, and it is safe to ignore and handle this as success.
*/
(void)pthread_join(m_handle, nullptr);
return 0;
#endif
void uninit();
......
......@@ -9,7 +9,7 @@
int main(int argc, char** argv) {
rocksdb::Options db_options;
const myrocks::Rdb_pk_comparator pk_comparator;
myrocks::Rdb_pk_comparator pk_comparator;
db_options.comparator= &pk_comparator;
rocksdb::LDBTool tool;
......
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