support _enable_fatal_error_hang
This commit is contained in:
parent
9c8cca0f43
commit
5baefa81ff
@ -10,6 +10,7 @@ project("OceanBase CE"
|
||||
LANGUAGES CXX C ASM)
|
||||
|
||||
ob_define(WITH_OSS OFF)
|
||||
ob_define(ENABLE_FATAL_ERROR_HANG OFF)
|
||||
|
||||
if(ENABLE_DEBUG_LOG)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_DEBUG_LOG")
|
||||
@ -26,6 +27,11 @@ if(OB_USE_ASAN)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOB_USE_ASAN")
|
||||
endif()
|
||||
|
||||
if (ENABLE_FATAL_ERROR_HANG)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DFATAL_ERROR_HANG")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DFATAL_ERROR_HANG")
|
||||
endif()
|
||||
|
||||
message(STATUS "This is BINARY dir " ${PROJECT_BINARY_DIR})
|
||||
message(STATUS "This is SOURCE dir " ${PROJECT_SOURCE_DIR})
|
||||
|
||||
|
4
deps/oblib/src/common/object/ob_obj_type.h
vendored
4
deps/oblib/src/common/object/ob_obj_type.h
vendored
@ -14,11 +14,13 @@
|
||||
#define OCEANBASE_COMMON_OB_OBJECT_TYPE_H_
|
||||
#include "lib/utility/ob_print_utils.h"
|
||||
#include "lib/charset/ob_charset.h"
|
||||
#include "lib/container/ob_iarray.h"
|
||||
|
||||
namespace oceanbase {
|
||||
namespace common {
|
||||
class ObObjMeta;
|
||||
class ObAccuracy;
|
||||
template <class T>
|
||||
class ObIArray;
|
||||
|
||||
// we can append new type only, do NOT delete nor change order,
|
||||
// modify ObObjTypeClass and ob_obj_type_class when append new object type.
|
||||
|
2
deps/oblib/src/lib/charset/ob_ctype.h
vendored
2
deps/oblib/src/lib/charset/ob_ctype.h
vendored
@ -100,6 +100,8 @@ extern "C" {
|
||||
#define ob_isgraph(s, c) ((s)->ctype != NULL ? ((s)->ctype + 1)[(uchar)(c)] & (_MY_PNT | _MY_U | _MY_L | _MY_NMR) : 0)
|
||||
#define ob_iscntrl(s, c) ((s)->ctype != NULL ? ((s)->ctype + 1)[(uchar)(c)] & _MY_CTR : 0)
|
||||
|
||||
extern void right_to_die_or_duty_to_live_c();
|
||||
|
||||
#define ob_charset_assert(condition) \
|
||||
if (!(condition)) { \
|
||||
right_to_die_or_duty_to_live_c(); \
|
||||
|
18
deps/oblib/src/lib/timezone/ob_time_convert.cpp
vendored
18
deps/oblib/src/lib/timezone/ob_time_convert.cpp
vendored
@ -411,6 +411,24 @@ int ObTime::set_tzd_abbr(const ObString& tzd_abbr)
|
||||
return ret;
|
||||
}
|
||||
|
||||
DEF_TO_STRING(ObTime)
|
||||
{
|
||||
int64_t pos = 0;
|
||||
J_OBJ_START();
|
||||
J_KV(K(mode_),
|
||||
"parts",
|
||||
ObArrayWrap<int32_t>(parts_, TOTAL_PART_CNT),
|
||||
"tz_name",
|
||||
ObString(OB_MAX_TZ_NAME_LEN, tz_name_),
|
||||
"tzd_abbr",
|
||||
ObString(OB_MAX_TZ_ABBR_LEN, tzd_abbr_),
|
||||
K_(time_zone_id),
|
||||
K_(transition_type_id),
|
||||
K_(is_tz_name_valid));
|
||||
J_OBJ_END();
|
||||
return pos;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
// int / double / string -> datetime / date / time / year.
|
||||
int ObTimeConverter::int_to_datetime(
|
||||
|
@ -17,7 +17,6 @@
|
||||
//#include "lib/timezone/ob_timezone_info.h"
|
||||
#include "lib/string/ob_string.h"
|
||||
#include "lib/ob_date_unit_type.h"
|
||||
#include "lib/container/ob_array_wrap.h"
|
||||
#include "common/object/ob_obj_type.h"
|
||||
#include "common/ob_accuracy.h"
|
||||
|
||||
@ -223,11 +222,9 @@ public:
|
||||
{
|
||||
return ObString(strlen(tzd_abbr_), tzd_abbr_);
|
||||
}
|
||||
int set_tz_name(const ObString& tz_name);
|
||||
int set_tzd_abbr(const ObString& tz_abbr);
|
||||
TO_STRING_KV(K(mode_), "parts", ObArrayWrap<int32_t>(parts_, TOTAL_PART_CNT), "tz_name",
|
||||
ObString(OB_MAX_TZ_NAME_LEN, tz_name_), "tzd_abbr", ObString(OB_MAX_TZ_ABBR_LEN, tzd_abbr_), K_(time_zone_id),
|
||||
K_(transition_type_id), K_(is_tz_name_valid));
|
||||
int set_tz_name(const ObString &tz_name);
|
||||
int set_tzd_abbr(const ObString &tz_abbr);
|
||||
DECLARE_TO_STRING;
|
||||
ObDTMode mode_;
|
||||
int32_t parts_[TOTAL_PART_CNT];
|
||||
// year: [1000, 9999].
|
||||
|
@ -14,21 +14,29 @@
|
||||
#include "lib/utility/ob_print_utils.h"
|
||||
#include "common/ob_common_utility.h"
|
||||
|
||||
extern "C" {
|
||||
void right_to_die_or_duty_to_live_c()
|
||||
{
|
||||
::oceanbase::common::right_to_die_or_duty_to_live();
|
||||
}
|
||||
}
|
||||
|
||||
namespace oceanbase {
|
||||
namespace common {
|
||||
|
||||
void right_to_die_or_duty_to_live_c()
|
||||
{
|
||||
right_to_die_or_duty_to_live();
|
||||
}
|
||||
|
||||
// To die or to live, it's a problem.
|
||||
void right_to_die_or_duty_to_live()
|
||||
{
|
||||
const ObFatalErrExtraInfoGuard* extra_info = ObFatalErrExtraInfoGuard::get_thd_local_val_ptr();
|
||||
const ObFatalErrExtraInfoGuard *extra_info = ObFatalErrExtraInfoGuard::get_thd_local_val_ptr();
|
||||
BACKTRACE(
|
||||
ERROR, true, "Trying so hard to die, extra_info=(%s)", (NULL == extra_info) ? NULL : to_cstring(*extra_info));
|
||||
#ifdef FATAL_ERROR_HANG
|
||||
while (true) {
|
||||
sleep(120);
|
||||
}
|
||||
#else
|
||||
throw OB_EXCEPTION<OB_ERR_UNEXPECTED>();
|
||||
_OB_LOG(ERROR, "Trying very hard to live");
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace common
|
||||
|
37
deps/oblib/src/lib/utility/ob_hang_fatal_error.h
vendored
37
deps/oblib/src/lib/utility/ob_hang_fatal_error.h
vendored
@ -14,37 +14,24 @@
|
||||
#define SRC_LIB_UTILITY_OB_HANG_FATAL_ERROR_H_
|
||||
|
||||
#include <exception>
|
||||
namespace oceanbase
|
||||
{
|
||||
namespace common
|
||||
{
|
||||
extern void right_to_die_or_duty_to_live();
|
||||
|
||||
namespace oceanbase {
|
||||
namespace common {
|
||||
|
||||
extern "C" {
|
||||
extern void right_to_die_or_duty_to_live_c();
|
||||
}
|
||||
|
||||
struct OB_BASE_EXCEPTION : public std::exception {
|
||||
virtual const char* what() const throw() override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
virtual int get_errno()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
struct OB_BASE_EXCEPTION : public std::exception
|
||||
{
|
||||
virtual const char *what() const throw() override { return nullptr; }
|
||||
virtual int get_errno() { return 0; }
|
||||
};
|
||||
|
||||
template <int ERRNO>
|
||||
struct OB_EXCEPTION : public OB_BASE_EXCEPTION {
|
||||
virtual int get_errno()
|
||||
{
|
||||
return ERRNO;
|
||||
}
|
||||
struct OB_EXCEPTION : public OB_BASE_EXCEPTION
|
||||
{
|
||||
virtual int get_errno() { return ERRNO; }
|
||||
};
|
||||
|
||||
// Hang th thread.
|
||||
// To die or to live, it's a problem.
|
||||
extern void right_to_die_or_duty_to_live();
|
||||
|
||||
} // namespace common
|
||||
} // namespace oceanbase
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user