mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge branch 'merge-myrocks' of github.com:MariaDB/mergetrees into bb-10.2-mariarocks
Manually resolved a few conflicts
This commit is contained in:
@@ -20,8 +20,11 @@
|
||||
/* C++ standard header files */
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
/* MySQL header files */
|
||||
#include "../sql/log.h"
|
||||
#include "./my_stacktrace.h"
|
||||
#include "./sql_string.h"
|
||||
|
||||
/* RocksDB header files */
|
||||
@@ -135,6 +138,16 @@ namespace myrocks {
|
||||
#define HA_EXIT_SUCCESS FALSE
|
||||
#define HA_EXIT_FAILURE TRUE
|
||||
|
||||
/*
|
||||
Macros to better convey the intent behind checking the results from locking
|
||||
and unlocking mutexes.
|
||||
*/
|
||||
#define RDB_MUTEX_LOCK_CHECK(m) \
|
||||
rdb_check_mutex_call_result(__PRETTY_FUNCTION__, true, mysql_mutex_lock(&m))
|
||||
#define RDB_MUTEX_UNLOCK_CHECK(m) \
|
||||
rdb_check_mutex_call_result(__PRETTY_FUNCTION__, false, \
|
||||
mysql_mutex_unlock(&m))
|
||||
|
||||
/*
|
||||
Generic constant.
|
||||
*/
|
||||
@@ -209,6 +222,28 @@ inline int purge_all_jemalloc_arenas() {
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
Helper function to check the result of locking or unlocking a mutex. We'll
|
||||
intentionally abort in case of a failure because it's better to terminate
|
||||
the process instead of continuing in an undefined state and corrupting data
|
||||
as a result.
|
||||
*/
|
||||
inline void rdb_check_mutex_call_result(const char *function_name,
|
||||
const bool attempt_lock,
|
||||
const int result) {
|
||||
if (unlikely(result)) {
|
||||
/* NO_LINT_DEBUG */
|
||||
sql_print_error("%s a mutex inside %s failed with an "
|
||||
"error code %d.",
|
||||
attempt_lock ? "Locking" : "Unlocking", function_name,
|
||||
result);
|
||||
|
||||
// This will hopefully result in a meaningful stack trace which we can use
|
||||
// to efficiently debug the root cause.
|
||||
abort_with_stack_traces();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Helper functions to parse strings.
|
||||
*/
|
||||
@@ -236,6 +271,9 @@ const char *rdb_parse_id(const struct charset_info_st *const cs,
|
||||
const char *rdb_skip_id(const struct charset_info_st *const cs, const char *str)
|
||||
MY_ATTRIBUTE((__nonnull__, __warn_unused_result__));
|
||||
|
||||
const std::vector<std::string> parse_into_tokens(const std::string& s,
|
||||
const char delim);
|
||||
|
||||
/*
|
||||
Helper functions to populate strings.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user