summaryrefslogtreecommitdiff
path: root/storage/rocksdb
diff options
context:
space:
mode:
Diffstat (limited to 'storage/rocksdb')
-rw-r--r--storage/rocksdb/CMakeLists.txt8
-rw-r--r--storage/rocksdb/build_rocksdb.cmake38
-rw-r--r--storage/rocksdb/ha_rocksdb.cc38
-rw-r--r--storage/rocksdb/ha_rocksdb.h4
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/index_key_block_size.result5
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result9
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result41
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp.result28
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp_rev.result28
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/index_key_block_size.test6
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test28
-rw-r--r--storage/rocksdb/rdb_datadic.cc39
-rw-r--r--storage/rocksdb/rdb_datadic.h2
-rw-r--r--storage/rocksdb/rdb_i_s.cc41
-rw-r--r--storage/rocksdb/rdb_sst_info.cc2
17 files changed, 143 insertions, 178 deletions
diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt
index 9d1c13e11cd..d3f7ca90889 100644
--- a/storage/rocksdb/CMakeLists.txt
+++ b/storage/rocksdb/CMakeLists.txt
@@ -141,8 +141,12 @@ else()
SET(ATOMIC_EXTRA_LIBS)
endif()
+# don't use compression providers, there are standalone executables below
+GET_PROPERTY(dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
+LIST(REMOVE_ITEM dirs ${CMAKE_SOURCE_DIR}/include/providers)
+SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "${dirs}")
+
MYSQL_ADD_PLUGIN(rocksdb ${ROCKSDB_SE_SOURCES} MODULE_ONLY STORAGE_ENGINE
- MODULE_OUTPUT_NAME ha_rocksdb
LINK_LIBRARIES ${ATOMIC_EXTRA_LIBS}
COMPONENT rocksdb-engine)
@@ -151,8 +155,6 @@ IF(NOT TARGET rocksdb)
RETURN()
ENDIF()
-
-
CHECK_CXX_SOURCE_COMPILES("
#if defined(_MSC_VER) && !defined(__thread)
#define __thread __declspec(thread)
diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake
index 7ccd52283f3..096185af08f 100644
--- a/storage/rocksdb/build_rocksdb.cmake
+++ b/storage/rocksdb/build_rocksdb.cmake
@@ -35,48 +35,48 @@ endif()
# Optional compression libraries.
include(CheckFunctionExists)
-macro(check_lib package var)
- STRING(TOUPPER ${package} PACKAGE_NAME)
+macro(check_lib package)
SET(WITH_ROCKSDB_${package} AUTO CACHE STRING
"Build RocksDB with ${package} compression. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
+ STRING(TOUPPER ${package} var)
IF (NOT ${WITH_ROCKSDB_${package}} STREQUAL "OFF")
FIND_PACKAGE(${package} QUIET)
- SET(HAVE_ROCKSDB_${PACKAGE_NAME} TRUE)
- IF (${${PACKAGE_NAME}_FOUND})
- IF(${ARGC} GREATER 2)
+ SET(HAVE_ROCKSDB_${package} TRUE)
+ IF (${${package}_FOUND})
+ IF(${ARGC} GREATER 1)
SET(CMAKE_REQUIRED_LIBRARIES ${${var}_LIBRARIES})
- CHECK_FUNCTION_EXISTS(${ARGV2} ${var}_VALID)
+ CHECK_FUNCTION_EXISTS(${ARGV1} ${package}_VALID)
UNSET(CMAKE_REQUIRED_LIBRARIES)
ELSE()
- SET(${var}_VALID TRUE)
+ SET(${package}_VALID TRUE)
ENDIF()
ENDIF()
ENDIF()
- ADD_FEATURE_INFO(ROCKSDB_${PACKAGE_NAME} HAVE_ROCKSDB_${PACKAGE_NAME} "${package} Compression in the RocksDB storage engine")
+ ADD_FEATURE_INFO(ROCKSDB_${package} HAVE_ROCKSDB_${package} "${package} Compression in the RocksDB storage engine")
- IF(${${var}_VALID})
- MESSAGE_ONCE(rocksdb_${var} "Found ${package}: ${${var}_LIBRARIES}")
- add_definitions(-D${PACKAGE_NAME})
+ IF(${${package}_VALID})
+ MESSAGE_ONCE(rocksdb_${package} "Found ${package}: ${${var}_LIBRARIES}")
+ add_definitions(-D${var})
include_directories(${${var}_INCLUDE_DIR})
list(APPEND THIRDPARTY_LIBS ${${var}_LIBRARIES})
- ELSEIF(${${PACKAGE_NAME}_FOUND})
- MESSAGE_ONCE(rocksdb_${var} "Found unusable ${package}: ${${var}_LIBRARIES} [${ARGV2}]")
+ ELSEIF(${${package}_FOUND})
+ MESSAGE_ONCE(rocksdb_${package} "Found unusable ${package}: ${${var}_LIBRARIES} [${ARGV1}]")
ELSE()
- MESSAGE_ONCE(rocksdb_${var} "Could NOT find ${package}")
+ MESSAGE_ONCE(rocksdb_${package} "Could NOT find ${package}")
ENDIF()
- IF (${WITH_ROCKSDB_${package}} STREQUAL "ON" AND NOT ${${PACKAGE_NAME}_FOUND})
+ IF (${WITH_ROCKSDB_${package}} STREQUAL "ON" AND NOT ${${package}_FOUND})
MESSAGE(FATAL_ERROR
"${package} library was not found, but WITH_ROCKSDB_${package} option is ON.\
Either set WITH_ROCKSDB_${package} to OFF, or make sure ${package} is installed")
endif()
endmacro()
-check_lib(LZ4 LZ4)
-check_lib(BZip2 BZIP2)
-check_lib(snappy snappy) # rocksdb/cmake/modules/Findsnappy.cmake violates the convention
-check_lib(ZSTD ZSTD ZDICT_trainFromBuffer)
+check_lib(LZ4)
+check_lib(BZip2)
+check_lib(Snappy)
+check_lib(ZSTD ZDICT_trainFromBuffer)
add_definitions(-DZLIB)
list(APPEND THIRDPARTY_LIBS ${ZLIB_LIBRARY})
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index 8030a1e3453..2239970a4e3 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -704,7 +704,7 @@ static int rmdir_force(const char *dir) {
if (!dir_info)
return 1;
- for (uint i = 0; i < dir_info->number_of_files; i++) {
+ for (size_t i = 0; i < dir_info->number_of_files; i++) {
FILEINFO *file = dir_info->dir_entry + i;
strxnmov(path, sizeof(path), dir, sep, file->name, NULL);
@@ -5216,9 +5216,6 @@ static rocksdb::Status check_rocksdb_options_compatibility(
return status;
}
-bool prevent_myrocks_loading= false;
-
-
static int rocksdb_check_version(handlerton *hton,
const char *path,
const LEX_CUSTRING *version,
@@ -5239,14 +5236,6 @@ static int rocksdb_init_func(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- {
- my_error(ER_INTERNAL_ERROR, MYF(0),
- "Loading MyRocks plugin after it has been unloaded is not "
- "supported. Please restart mariadbd");
- DBUG_RETURN(1);
- }
-
if (rocksdb_ignore_datadic_errors)
{
sql_print_information(
@@ -5821,8 +5810,6 @@ static int rocksdb_init_func(void *const p) {
static int rocksdb_done_func(void *const p) {
DBUG_ENTER_FUNC();
- int error = 0;
-
// signal the drop index thread to stop
rdb_drop_idx_thread.signal(true);
@@ -5866,12 +5853,6 @@ static int rocksdb_done_func(void *const p) {
"RocksDB: Couldn't stop the manual compaction thread: (errno=%d)", err);
}
- if (rdb_open_tables.count()) {
- // Looks like we are getting unloaded and yet we have some open tables
- // left behind.
- error = 1;
- }
-
rdb_open_tables.free();
/*
destructors for static objects can be called at _exit(),
@@ -5923,7 +5904,7 @@ static int rocksdb_done_func(void *const p) {
MariaDB: don't clear rocksdb_db_options and rocksdb_tbl_options.
MyRocks' plugin variables refer to them.
- The plugin cannot be loaded again (see prevent_myrocks_loading) but plugin
+ The plugin cannot be loaded again but plugin
variables are processed before myrocks::rocksdb_init_func is invoked, so
they must point to valid memory.
*/
@@ -5938,12 +5919,12 @@ static int rocksdb_done_func(void *const p) {
my_error_unregister(HA_ERR_ROCKSDB_FIRST, HA_ERR_ROCKSDB_LAST);
/*
- Prevent loading the plugin after it has been loaded and then unloaded. This
- doesn't work currently.
+ returning non-zero status from the plugin deinit function will prevent
+ the server from unloading the plugin. it will only be marked unusable.
+ This is needed here, because RocksDB cannot be fully unloaded
+ and reloaded (see sql_plugin.cc near STB_GNU_UNIQUE).
*/
- prevent_myrocks_loading= true;
-
- DBUG_RETURN(error);
+ DBUG_RETURN(1);
}
static inline void rocksdb_smart_seek(bool seek_backward,
@@ -7599,8 +7580,7 @@ int ha_rocksdb::create_key_def(const TABLE *const table_arg, const uint i,
(*new_key_def)->m_ttl_column = ttl_column;
}
// initialize key_def
- (*new_key_def)->setup(table_arg, tbl_def_arg);
- DBUG_RETURN(HA_EXIT_SUCCESS);
+ DBUG_RETURN((*new_key_def)->setup(table_arg, tbl_def_arg));
}
int rdb_normalize_tablename(const std::string &tablename,
@@ -10832,7 +10812,7 @@ int ha_rocksdb::index_end() {
release_scan_iterator();
- bitmap_free(&m_lookup_bitmap);
+ my_bitmap_free(&m_lookup_bitmap);
active_index = MAX_KEY;
in_range_check_pushed_down = FALSE;
diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h
index 8580dcbc2e5..f847ee25cb8 100644
--- a/storage/rocksdb/ha_rocksdb.h
+++ b/storage/rocksdb/ha_rocksdb.h
@@ -397,7 +397,7 @@ class ha_rocksdb : public my_core::handler {
current lookup to be covered. If the bitmap field is null, that means this
index does not cover the current lookup for any record.
*/
- MY_BITMAP m_lookup_bitmap = {nullptr, nullptr, nullptr, 0, 0};
+ MY_BITMAP m_lookup_bitmap = {nullptr, nullptr, 0, 0};
int alloc_key_buffers(const TABLE *const table_arg,
const Rdb_tbl_def *const tbl_def_arg,
@@ -1062,8 +1062,6 @@ std::string rdb_corruption_marker_file_name();
const int MYROCKS_MARIADB_PLUGIN_MATURITY_LEVEL= MariaDB_PLUGIN_MATURITY_STABLE;
-extern bool prevent_myrocks_loading;
-
extern uint32_t rocksdb_ignore_datadic_errors;
void sql_print_verbose_info(const char *format, ...);
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result
index b3df869a0a7..a3a138555ee 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result
@@ -1455,7 +1455,7 @@ pk INT AUTO_INCREMENT PRIMARY KEY,
c DECIMAL NOT NULL DEFAULT 1.1
) ENGINE=rocksdb;
Warnings:
-Note 1265 Data truncated for column 'c' at row 1
+Note 1265 Data truncated for column 'c' at row 0
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
pk int(11) NO PRI NULL auto_increment
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result
index f0cd1a7e8b3..f0d377890c5 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result
@@ -1246,7 +1246,7 @@ c2 DECIMAL NULL DEFAULT 1.1,
pk INT AUTO_INCREMENT PRIMARY KEY
) ENGINE=rocksdb;
Warnings:
-Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c2' at row 0
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
c decimal(10,0) YES NULL
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/index_key_block_size.result b/storage/rocksdb/mysql-test/rocksdb/r/index_key_block_size.result
index 4695d94b3fe..c74ce6878c7 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/index_key_block_size.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/index_key_block_size.result
@@ -23,6 +23,11 @@ CREATE TABLE t1 (a INT,
b CHAR(8),
PRIMARY KEY ind2(b(1) DESC) KEY_BLOCK_SIZE=32768 COMMENT 'big key_block_size value'
) 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:
Warning 1280 Name 'ind2' ignored for PRIMARY key.
SHOW INDEX IN t1;
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result b/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result
index d3f0ee3bcd9..65255699551 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result
@@ -136,9 +136,6 @@ os_data_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status
os_pending_reads os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of reads pending
os_pending_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of writes pending
os_log_bytes_written os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Bytes of log written (innodb_os_log_written)
-os_log_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of fsync log writes (innodb_os_log_fsyncs)
-os_log_pending_fsyncs os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pending fsync write (innodb_os_log_pending_fsyncs)
-os_log_pending_writes os 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of pending log file writes (innodb_os_log_pending_writes)
trx_rw_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of read-write transactions committed
trx_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of read-only transactions committed
trx_nl_ro_commits transaction 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of non-locking auto-commit read-only transactions committed
@@ -156,20 +153,16 @@ purge_undo_log_pages purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL
purge_dml_delay_usec purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Microseconds DML to be delayed due to purge lagging
purge_stop_count purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of times purge was stopped
purge_resume_count purge 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of times purge was resumed
-log_checkpoints recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of checkpoints
+log_checkpoints recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of checkpoints
log_lsn_last_flush recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value LSN of Last flush
log_lsn_last_checkpoint recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value LSN at last checkpoint
log_lsn_current recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Current LSN value
log_lsn_checkpoint_age recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Current LSN value minus LSN at last checkpoint
log_lsn_buf_pool_oldest recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value The oldest modified block LSN in the buffer pool
log_max_modified_age_async recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Maximum LSN difference; when exceeded, start asynchronous preflush
-log_pending_log_flushes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Pending log flushes
-log_pending_checkpoint_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Pending checkpoints
-log_num_log_io recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 value Number of log I/Os
log_waits recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of log waits due to small log buffer (innodb_log_waits)
log_write_requests recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of log write requests (innodb_log_write_requests)
log_writes recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Number of log writes (innodb_log_writes)
-log_padded recovery 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 status_counter Bytes of log padded for log write ahead
compress_pages_compressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages compressed
compress_pages_decompressed compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of pages decompressed
compression_pad_increments compression 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL 0 counter Number of times padding is incremented to avoid compression failures
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result
index 6d6cb1db54e..a8e42a4e2b2 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result
@@ -10,26 +10,35 @@ connection default;
UNINSTALL SONAME 'ha_rocksdb';
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='ROCKSDB';
ENGINE SUPPORT
ROCKSDB NO
disconnect con1;
+select engine, support from information_schema.engines where engine='rocksdb';
+engine support
+select plugin_name,plugin_status from information_schema.plugins where plugin_name='rocksdb';
+plugin_name plugin_status
+ROCKSDB INACTIVE
#
# MDEV-15686: Loading MyRocks plugin back after it has been unloaded causes a crash
#
-call mtr.add_suppression("Plugin 'ROCKSDB.*' init function returned error.");
-call mtr.add_suppression("Plugin 'ROCKSDB.*' registration as a INFORMATION SCHEMA failed.");
-call mtr.add_suppression("Plugin 'ROCKSDB' registration as a STORAGE ENGINE failed");
-#
-# There are two possible scenarios:
-# ha_rocksdb.{dll,so} is still loaded into mysqld's address space. Its
-# global variables are in the state that doesn't allow it to be
-# initialized back (this is what MDEV-15686 is about). This is handled
-# by intentionally returning an error from rocksdb_init_func.
-#
-# The second case is when ha_rocksdb.{ddl,so} has been fully unloaded
-# and so it will be now loaded as if it happens for the first time.
-INSTALL SONAME 'ha_rocksdb';
-# Whatever happened on the previous step, restore things to the way they
-# were at testcase start.
-UNINSTALL SONAME 'ha_rocksdb';
+INSTALL PLUGIN rocksdb SONAME 'ha_rocksdb';
+ERROR HY000: Plugin 'rocksdb' already installed
+select engine, support from information_schema.engines where engine='rocksdb';
+engine support
+select plugin_name,plugin_status from information_schema.plugins where plugin_name='rocksdb';
+plugin_name plugin_status
+ROCKSDB INACTIVE
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp.result b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp.result
index 101e159eaf3..f9e3129c73f 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp.result
@@ -47,18 +47,22 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "range",
- "possible_keys": ["kp1"],
- "key": "kp1",
- "key_length": "5",
- "used_key_parts": ["kp1"],
- "rows": 1000,
- "filtered": 100,
- "index_condition": "t3.kp1 between 2 and 4 and t3.kp1 MOD 3 = 0",
- "attached_condition": "t3.kp2 like '%foo%'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "range",
+ "possible_keys": ["kp1"],
+ "key": "kp1",
+ "key_length": "5",
+ "used_key_parts": ["kp1"],
+ "rows": 1000,
+ "filtered": 100,
+ "index_condition": "t3.kp1 between 2 and 4 and t3.kp1 MOD 3 = 0",
+ "attached_condition": "t3.kp2 like '%foo%'"
+ }
+ }
+ ]
}
}
# Check that we handle the case where out-of-range is encountered sooner
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp_rev.result b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp_rev.result
index b00e0e14e46..3634f8c023e 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp_rev.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_icp_rev.result
@@ -47,18 +47,22 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
- "table": {
- "table_name": "t3",
- "access_type": "range",
- "possible_keys": ["kp1"],
- "key": "kp1",
- "key_length": "5",
- "used_key_parts": ["kp1"],
- "rows": 1000,
- "filtered": 100,
- "index_condition": "t3.kp1 between 2 and 4 and t3.kp1 MOD 3 = 0",
- "attached_condition": "t3.kp2 like '%foo%'"
- }
+ "nested_loop": [
+ {
+ "table": {
+ "table_name": "t3",
+ "access_type": "range",
+ "possible_keys": ["kp1"],
+ "key": "kp1",
+ "key_length": "5",
+ "used_key_parts": ["kp1"],
+ "rows": 1000,
+ "filtered": 100,
+ "index_condition": "t3.kp1 between 2 and 4 and t3.kp1 MOD 3 = 0",
+ "attached_condition": "t3.kp2 like '%foo%'"
+ }
+ }
+ ]
}
}
# Check that we handle the case where out-of-range is encountered sooner
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/index_key_block_size.test b/storage/rocksdb/mysql-test/rocksdb/t/index_key_block_size.test
index f156aec0021..4edf684383a 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/index_key_block_size.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/index_key_block_size.test
@@ -28,11 +28,17 @@ CREATE TABLE t1 (a INT,
SHOW INDEX IN t1;
DROP TABLE t1;
+--error ER_ILLEGAL_HA_CREATE_OPTION
CREATE TABLE t1 (a INT,
b CHAR(8),
PRIMARY KEY ind2(b(1) DESC) KEY_BLOCK_SIZE=32768 COMMENT 'big key_block_size value'
) 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 #
SHOW INDEX IN t1;
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test
index 0cf56c0cbd5..8f30d7c42b6 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test
@@ -31,29 +31,15 @@ disconnect con1;
let $wait_condition= SELECT VARIABLE_VALUE=1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Threads_cached';
--source include/wait_condition.inc
---echo #
---echo # MDEV-15686: Loading MyRocks plugin back after it has been unloaded causes a crash
---echo #
-call mtr.add_suppression("Plugin 'ROCKSDB.*' init function returned error.");
-call mtr.add_suppression("Plugin 'ROCKSDB.*' registration as a INFORMATION SCHEMA failed.");
-call mtr.add_suppression("Plugin 'ROCKSDB' registration as a STORAGE ENGINE failed");
+select engine, support from information_schema.engines where engine='rocksdb';
+select plugin_name,plugin_status from information_schema.plugins where plugin_name='rocksdb';
--echo #
---echo # There are two possible scenarios:
-
---echo # ha_rocksdb.{dll,so} is still loaded into mysqld's address space. Its
---echo # global variables are in the state that doesn't allow it to be
---echo # initialized back (this is what MDEV-15686 is about). This is handled
---echo # by intentionally returning an error from rocksdb_init_func.
+--echo # MDEV-15686: Loading MyRocks plugin back after it has been unloaded causes a crash
--echo #
---echo # The second case is when ha_rocksdb.{ddl,so} has been fully unloaded
---echo # and so it will be now loaded as if it happens for the first time.
-
---error 0,ER_INTERNAL_ERROR
-INSTALL SONAME 'ha_rocksdb';
---echo # Whatever happened on the previous step, restore things to the way they
---echo # were at testcase start.
---error 0,ER_SP_DOES_NOT_EXIST
-UNINSTALL SONAME 'ha_rocksdb';
+--error ER_PLUGIN_INSTALLED
+INSTALL PLUGIN rocksdb SONAME 'ha_rocksdb';
+select engine, support from information_schema.engines where engine='rocksdb';
+select plugin_name,plugin_status from information_schema.plugins where plugin_name='rocksdb';
diff --git a/storage/rocksdb/rdb_datadic.cc b/storage/rocksdb/rdb_datadic.cc
index 939fb085c4f..9afc2100069 100644
--- a/storage/rocksdb/rdb_datadic.cc
+++ b/storage/rocksdb/rdb_datadic.cc
@@ -390,7 +390,7 @@ Rdb_key_def::~Rdb_key_def() {
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) {
DBUG_ASSERT(tbl != nullptr);
DBUG_ASSERT(tbl_def != nullptr);
@@ -406,7 +406,7 @@ void Rdb_key_def::setup(const TABLE *const tbl,
RDB_MUTEX_LOCK_CHECK(m_mutex);
if (m_maxlength != 0) {
RDB_MUTEX_UNLOCK_CHECK(m_mutex);
- return;
+ return HA_EXIT_SUCCESS;
}
KEY *key_info = nullptr;
@@ -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++) {
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) {
DBUG_ASSERT(secondary_key);
/* Check if this field is already present in the key definition */
@@ -591,6 +599,7 @@ void Rdb_key_def::setup(const TABLE *const tbl,
RDB_MUTEX_UNLOCK_CHECK(m_mutex);
}
+ return HA_EXIT_SUCCESS;
}
/*
@@ -1102,12 +1111,12 @@ size_t Rdb_key_def::get_unpack_header_size(char tag) {
*/
void Rdb_key_def::get_lookup_bitmap(const TABLE *table, MY_BITMAP *map) const {
DBUG_ASSERT(map->bitmap == nullptr);
- bitmap_init(map, nullptr, MAX_REF_PARTS, false);
+ my_bitmap_init(map, nullptr, MAX_REF_PARTS);
uint curr_bitmap_pos = 0;
// Indicates which columns in the read set might be covered.
MY_BITMAP maybe_covered_bitmap;
- bitmap_init(&maybe_covered_bitmap, nullptr, table->read_set->n_bits, false);
+ my_bitmap_init(&maybe_covered_bitmap, nullptr, table->read_set->n_bits);
for (uint i = 0; i < m_key_parts; i++) {
if (table_has_hidden_pk(table) && i + 1 == m_key_parts) {
@@ -1135,8 +1144,8 @@ void Rdb_key_def::get_lookup_bitmap(const TABLE *table, MY_BITMAP *map) const {
}
curr_bitmap_pos++;
} else {
- bitmap_free(&maybe_covered_bitmap);
- bitmap_free(map);
+ my_bitmap_free(&maybe_covered_bitmap);
+ my_bitmap_free(map);
return;
}
break;
@@ -1144,8 +1153,8 @@ void Rdb_key_def::get_lookup_bitmap(const TABLE *table, MY_BITMAP *map) const {
// know this lookup will never be covered.
default:
if (bitmap_is_set(table->read_set, field->field_index)) {
- bitmap_free(&maybe_covered_bitmap);
- bitmap_free(map);
+ my_bitmap_free(&maybe_covered_bitmap);
+ my_bitmap_free(map);
return;
}
break;
@@ -1155,9 +1164,9 @@ void Rdb_key_def::get_lookup_bitmap(const TABLE *table, MY_BITMAP *map) const {
// If there are columns which are not covered in the read set, the lookup
// can't be covered.
if (!bitmap_cmp(table->read_set, &maybe_covered_bitmap)) {
- bitmap_free(map);
+ my_bitmap_free(map);
}
- bitmap_free(&maybe_covered_bitmap);
+ my_bitmap_free(&maybe_covered_bitmap);
}
/*
@@ -1187,7 +1196,7 @@ bool Rdb_key_def::covers_lookup(const rocksdb::Slice *const unpack_info,
MY_BITMAP covered_bitmap;
my_bitmap_map covered_bits;
- bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS, false);
+ my_bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS);
covered_bits = rdb_netbuf_to_uint16((const uchar *)unpack_header +
sizeof(RDB_UNPACK_COVERED_DATA_TAG) +
RDB_UNPACK_COVERED_DATA_LEN_SIZE);
@@ -1356,7 +1365,7 @@ uint Rdb_key_def::pack_record(const TABLE *const tbl, uchar *const pack_buffer,
MY_BITMAP covered_bitmap;
my_bitmap_map covered_bits;
uint curr_bitmap_pos = 0;
- bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS, false);
+ my_bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS);
for (uint i = 0; i < n_key_parts; i++) {
// Fill hidden pk id into the last key part for secondary keys for tables
@@ -1661,7 +1670,7 @@ int Rdb_key_def::unpack_record(TABLE *const table, uchar *const buf,
bool has_covered_bitmap =
has_unpack_info && (unpack_header[0] == RDB_UNPACK_COVERED_DATA_TAG);
if (has_covered_bitmap) {
- bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS, false);
+ my_bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS);
covered_bits = rdb_netbuf_to_uint16((const uchar *)unpack_header +
sizeof(RDB_UNPACK_COVERED_DATA_TAG) +
RDB_UNPACK_COVERED_DATA_LEN_SIZE);
@@ -3852,7 +3861,7 @@ bool Rdb_validate_tbls::scan_for_frms(const std::string &datadir,
/* Scan through the files in the directory */
struct fileinfo *file_info = dir_info->dir_entry;
- for (uint ii = 0; ii < dir_info->number_of_files; ii++, file_info++) {
+ for (size_t ii = 0; ii < dir_info->number_of_files; ii++, file_info++) {
/* Find .frm files that are not temp files (those that contain '#sql') */
const char *ext = strrchr(file_info->name, '.');
if (ext != nullptr && strstr(file_info->name, tmp_file_prefix) == nullptr &&
@@ -3897,7 +3906,7 @@ bool Rdb_validate_tbls::compare_to_actual_tables(const std::string &datadir,
}
file_info = dir_info->dir_entry;
- for (uint ii = 0; ii < dir_info->number_of_files; ii++, file_info++) {
+ for (size_t ii = 0; ii < dir_info->number_of_files; ii++, file_info++) {
/* Ignore files/dirs starting with '.' */
if (file_info->name[0] == '.') continue;
diff --git a/storage/rocksdb/rdb_datadic.h b/storage/rocksdb/rdb_datadic.h
index acff43ab565..e9fc1da728e 100644
--- a/storage/rocksdb/rdb_datadic.h
+++ b/storage/rocksdb/rdb_datadic.h
@@ -593,7 +593,7 @@ class Rdb_key_def {
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,
const Rdb_tbl_def *const tbl_def_arg,
diff --git a/storage/rocksdb/rdb_i_s.cc b/storage/rocksdb/rdb_i_s.cc
index 5350ec3bce9..a3d284dfa64 100644
--- a/storage/rocksdb/rdb_i_s.cc
+++ b/storage/rocksdb/rdb_i_s.cc
@@ -145,9 +145,6 @@ static int rdb_i_s_cfstats_fill_table(
static int rdb_i_s_cfstats_init(void *p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -241,9 +238,6 @@ static int rdb_i_s_dbstats_fill_table(
static int rdb_i_s_dbstats_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -344,8 +338,6 @@ static int rdb_i_s_perf_context_fill_table(
static int rdb_i_s_perf_context_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -413,9 +405,6 @@ static int rdb_i_s_perf_context_global_fill_table(
static int rdb_i_s_perf_context_global_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1045,9 +1034,6 @@ static int rdb_i_s_ddl_fill_table(my_core::THD *const thd,
static int rdb_i_s_ddl_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
my_core::ST_SCHEMA_TABLE *schema;
DBUG_ASSERT(p != nullptr);
@@ -1063,9 +1049,6 @@ static int rdb_i_s_ddl_init(void *const p) {
static int rdb_i_s_cfoptions_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1081,9 +1064,6 @@ static int rdb_i_s_cfoptions_init(void *const p) {
static int rdb_i_s_global_info_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1101,9 +1081,6 @@ static int rdb_i_s_compact_stats_init(void *p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
schema = reinterpret_cast<my_core::ST_SCHEMA_TABLE *>(p);
@@ -1438,9 +1415,6 @@ static int rdb_i_s_index_file_map_fill_table(
static int rdb_i_s_index_file_map_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1523,9 +1497,6 @@ static int rdb_i_s_lock_info_fill_table(
static int rdb_i_s_lock_info_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1651,9 +1622,6 @@ static int rdb_i_s_trx_info_fill_table(
static int rdb_i_s_trx_info_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1781,7 +1749,8 @@ static int rdb_i_s_deadlock_info_init(void *const p) {
static int rdb_i_s_deinit(void *p MY_ATTRIBUTE((__unused__))) {
DBUG_ENTER_FUNC();
- DBUG_RETURN(0);
+ /* see the comment at the end of rocksdb_done_func() */
+ DBUG_RETURN(1);
}
static struct st_mysql_information_schema rdb_i_s_info = {
@@ -1955,7 +1924,7 @@ struct st_maria_plugin rdb_i_s_lock_info = {
"RocksDB lock information",
PLUGIN_LICENSE_GPL,
rdb_i_s_lock_info_init,
- nullptr,
+ rdb_i_s_deinit,
0x0001, /* version number (0.1) */
nullptr, /* status variables */
nullptr, /* system variables */
@@ -1971,7 +1940,7 @@ struct st_maria_plugin rdb_i_s_trx_info = {
"RocksDB transaction information",
PLUGIN_LICENSE_GPL,
rdb_i_s_trx_info_init,
- nullptr,
+ rdb_i_s_deinit,
0x0001, /* version number (0.1) */
nullptr, /* status variables */
nullptr, /* system variables */
@@ -1987,7 +1956,7 @@ struct st_maria_plugin rdb_i_s_deadlock_info = {
"RocksDB transaction information",
PLUGIN_LICENSE_GPL,
rdb_i_s_deadlock_info_init,
- nullptr,
+ rdb_i_s_deinit,
0x0001, /* version number (0.1) */
nullptr, /* status variables */
nullptr, /* system variables */
diff --git a/storage/rocksdb/rdb_sst_info.cc b/storage/rocksdb/rdb_sst_info.cc
index 45ae89c1bd4..ae3938c3918 100644
--- a/storage/rocksdb/rdb_sst_info.cc
+++ b/storage/rocksdb/rdb_sst_info.cc
@@ -542,7 +542,7 @@ void Rdb_sst_info::init(const rocksdb::DB *const db) {
// Scan through the files in the directory
const struct fileinfo *file_info = dir_info->dir_entry;
- for (uint ii= 0; ii < dir_info->number_of_files; ii++, file_info++) {
+ for (size_t ii= 0; ii < dir_info->number_of_files; ii++, file_info++) {
// find any files ending with m_suffix ...
const std::string name = file_info->name;
const size_t pos = name.find(m_suffix);