Commit 01e57069 authored by Barry Perlman's avatar Barry Perlman Committed by Yoni Fogel

[t:4187] #4187 Failed assert in handlerton will call new DB_ENV->crash()...

[t:4187] #4187 Failed assert in handlerton will call new DB_ENV->crash() function which prints engine status to error log.

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@37370 c7de825b-a66e-492c-adef-691d508d4ae1
parent 47020ee4
......@@ -11,6 +11,7 @@ extern "C" {
#include "misc.h"
#endif
}
#include "hatoku_assert.h"
static inline void *thd_data_get(THD *thd, int slot) {
return thd->ha_data[slot].ha_ptr;
......
#ifndef TOKU_ASSERT_H
#define TOKU_ASSERT_H
/* The purpose of this file is to define assert() for use by the handlerton.
* The intention is for a failed handlerton assert to invoke a failed assert
* in the fractal tree layer, which dumps engine status to the error log.
*/
void toku_hton_assert_fail(const char*/*expr_as_string*/,const char */*fun*/,const char*/*file*/,int/*line*/, int/*errno*/) __attribute__((__visibility__("default"))) __attribute__((__noreturn__));
#define assert(expr) ((expr) ? (void)0 : toku_hton_assert_fail(#expr, __FUNCTION__, __FILE__, __LINE__, errno))
#endif
......@@ -5,6 +5,7 @@ extern "C" {
}
#include "hatoku_cmp.h"
#include "hatoku_assert.h"
#ifdef WORDS_BIGENDIAN
#error "WORDS_BIGENDIAN not supported"
......
......@@ -24,6 +24,7 @@ extern "C" {
#include "hatoku_hton.h"
#include "hatoku_defines.h"
#include "ha_tokudb.h"
#include "hatoku_assert.h"
#undef PACKAGE
#undef VERSION
......@@ -192,6 +193,25 @@ static ulonglong tokudb_lock_timeout;
static ulong tokudb_cleaner_period;
static ulong tokudb_cleaner_iterations;
#define ASSERT_MSGLEN 1024
void toku_hton_assert_fail(const char* expr_as_string, const char * fun, const char * file, int line, int caller_errno) {
char msg[ASSERT_MSGLEN];
if (db_env) {
snprintf(msg, ASSERT_MSGLEN, "Handlerton: %s ", expr_as_string);
db_env->crash(db_env, msg, fun, file, line,caller_errno);
}
else {
snprintf(msg, ASSERT_MSGLEN, "Handlerton assertion failed, no env, %s, %d, %s, %s (errno=%d)\n", file, line, fun, expr_as_string, caller_errno);
perror(msg);
fflush(stderr);
}
abort();
}
//my_bool tokudb_shared_data = FALSE;
static u_int32_t tokudb_init_flags =
DB_CREATE | DB_THREAD | DB_PRIVATE |
......
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