Commit 7703095d authored by Varun Gupta's avatar Varun Gupta

MDEV-12458: Variable and log records to indicate RocksDB version are missing

Added a system variabe rocsdb_git_hash to MyRocks which tell us the version of RocksDB being used
parent a118c20c
...@@ -52,6 +52,9 @@ IF(GIT_EXECUTABLE) ...@@ -52,6 +52,9 @@ IF(GIT_EXECUTABLE)
ENDIF() ENDIF()
ENDIF() ENDIF()
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/storage/rocksdb/rdb_source_revision.h
${PACKAGE_DIR}/storage/rocksdb/rdb_source_revision.h COPYONLY)
IF(NOT GIT_EXECUTABLE) IF(NOT GIT_EXECUTABLE)
MESSAGE(STATUS "git not found or source dir is not a repo, use CPack") MESSAGE(STATUS "git not found or source dir is not a repo, use CPack")
......
...@@ -220,3 +220,18 @@ IF(MSVC) ...@@ -220,3 +220,18 @@ IF(MSVC)
# Some checks in C++ runtime that make debug build much slower # Some checks in C++ runtime that make debug build much slower
ADD_DEFINITIONS(-D_ITERATOR_DEBUG_LEVEL=0) ADD_DEFINITIONS(-D_ITERATOR_DEBUG_LEVEL=0)
ENDIF() ENDIF()
IF(GIT_EXECUTABLE)
EXECUTE_PROCESS(
COMMAND ${GIT_EXECUTABLE} rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/rocksdb
OUTPUT_VARIABLE OUT RESULT_VARIABLE RES)
IF(RES EQUAL 0)
STRING(REGEX REPLACE "\n$" "" ROCKSDB_GIT_HASH "${OUT}")
ENDIF()
ENDIF()
IF(ROCKSDB_GIT_HASH OR
(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/rdb_source_revision.h))
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/rdb_source_revision.h.in
${CMAKE_CURRENT_BINARY_DIR}/rdb_source_revision.h )
ENDIF()
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
#include "rocksdb/utilities/memory_util.h" #include "rocksdb/utilities/memory_util.h"
#include "rocksdb/utilities/sim_cache.h" #include "rocksdb/utilities/sim_cache.h"
#include "util/stop_watch.h" #include "util/stop_watch.h"
#include "./rdb_source_revision.h"
/* MyRocks includes */ /* MyRocks includes */
#include "./event_listener.h" #include "./event_listener.h"
...@@ -494,6 +495,7 @@ static uint32_t rocksdb_table_stats_sampling_pct; ...@@ -494,6 +495,7 @@ static uint32_t rocksdb_table_stats_sampling_pct;
static my_bool rocksdb_enable_bulk_load_api = 1; static my_bool rocksdb_enable_bulk_load_api = 1;
static my_bool rocksdb_print_snapshot_conflict_queries = 0; static my_bool rocksdb_print_snapshot_conflict_queries = 0;
static my_bool rocksdb_large_prefix = 0; static my_bool rocksdb_large_prefix = 0;
static char* rocksdb_git_hash;
char *compression_types_val= char *compression_types_val=
const_cast<char*>(get_rocksdb_supported_compression_types()); const_cast<char*>(get_rocksdb_supported_compression_types());
...@@ -650,6 +652,11 @@ static MYSQL_SYSVAR_BOOL(enable_bulk_load_api, rocksdb_enable_bulk_load_api, ...@@ -650,6 +652,11 @@ static MYSQL_SYSVAR_BOOL(enable_bulk_load_api, rocksdb_enable_bulk_load_api,
"Enables using SstFileWriter for bulk loading", "Enables using SstFileWriter for bulk loading",
nullptr, nullptr, rocksdb_enable_bulk_load_api); nullptr, nullptr, rocksdb_enable_bulk_load_api);
static MYSQL_SYSVAR_STR(git_hash, rocksdb_git_hash,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Git revision of the RocksDB library used by MyRocks",
nullptr, nullptr, ROCKSDB_GIT_HASH);
static MYSQL_THDVAR_STR(tmpdir, PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_MEMALLOC, static MYSQL_THDVAR_STR(tmpdir, PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_MEMALLOC,
"Directory for temporary files during DDL operations.", "Directory for temporary files during DDL operations.",
nullptr, nullptr, ""); nullptr, nullptr, "");
...@@ -1633,6 +1640,7 @@ static struct st_mysql_sys_var *rocksdb_system_variables[] = { ...@@ -1633,6 +1640,7 @@ static struct st_mysql_sys_var *rocksdb_system_variables[] = {
MYSQL_SYSVAR(table_stats_sampling_pct), MYSQL_SYSVAR(table_stats_sampling_pct),
MYSQL_SYSVAR(large_prefix), MYSQL_SYSVAR(large_prefix),
MYSQL_SYSVAR(git_hash),
nullptr}; nullptr};
static rocksdb::WriteOptions static rocksdb::WriteOptions
......
...@@ -924,6 +924,7 @@ rocksdb_force_compute_memtable_stats_cachetime 0 ...@@ -924,6 +924,7 @@ rocksdb_force_compute_memtable_stats_cachetime 0
rocksdb_force_flush_memtable_and_lzero_now OFF rocksdb_force_flush_memtable_and_lzero_now OFF
rocksdb_force_flush_memtable_now OFF rocksdb_force_flush_memtable_now OFF
rocksdb_force_index_records_in_range 0 rocksdb_force_index_records_in_range 0
rocksdb_git_hash #
rocksdb_hash_index_allow_collision ON rocksdb_hash_index_allow_collision ON
rocksdb_index_type kBinarySearch rocksdb_index_type kBinarySearch
rocksdb_info_log_level error_level rocksdb_info_log_level error_level
......
...@@ -786,6 +786,8 @@ drop table t45; ...@@ -786,6 +786,8 @@ drop table t45;
--echo # Now it fails if there is data overlap with what --echo # Now it fails if there is data overlap with what
--echo # already exists --echo # already exists
--echo # --echo #
--replace_regex /[a-f0-9]{40}/#/
show variables show variables
where where
variable_name like 'rocksdb%' and variable_name like 'rocksdb%' and
......
--source include/have_rocksdb.inc
--let $sys_var=ROCKSDB_GIT_HASH
--let $read_only=1
--let $session=0
--source include/rocksdb_sys_var.inc
#define ROCKSDB_GIT_HASH "@ROCKSDB_GIT_HASH@"
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