Add log for system time and abort function
This commit is contained in:
4
deps/oblib/src/lib/ob_abort.cpp
vendored
4
deps/oblib/src/lib/ob_abort.cpp
vendored
@ -11,8 +11,12 @@
|
||||
*/
|
||||
|
||||
#include <lib/ob_abort.h>
|
||||
#include <stdio.h>
|
||||
#include "lib/ob_define.h"
|
||||
#include "lib/utility/ob_backtrace.h"
|
||||
|
||||
void ob_abort (void) __THROW
|
||||
{
|
||||
fprintf(stderr, "OB_ABORT, tid: %ld, lbt: %s\n", GETTID(), oceanbase::common::lbt());
|
||||
abort();
|
||||
}
|
||||
|
||||
2
deps/oblib/src/lib/oblog/ob_log.cpp
vendored
2
deps/oblib/src/lib/oblog/ob_log.cpp
vendored
@ -337,7 +337,7 @@ int64_t ObLogger::FileName::to_string(char * buff, const int64_t len) const
|
||||
|
||||
void __attribute__ ((noinline)) on_probe_abort()
|
||||
{
|
||||
abort();
|
||||
ob_abort();
|
||||
}
|
||||
|
||||
ProbeAction probe_str2action(const char *str)
|
||||
|
||||
19
deps/oblib/src/lib/time/ob_time_utility.cpp
vendored
19
deps/oblib/src/lib/time/ob_time_utility.cpp
vendored
@ -22,12 +22,15 @@ using namespace oceanbase::common;
|
||||
|
||||
OB_SERIALIZE_MEMBER(ObMonotonicTs, mts_);
|
||||
|
||||
static __thread bool systime_error = false;
|
||||
|
||||
int64_t ObTimeUtility::current_time()
|
||||
{
|
||||
int err_ret = 0;
|
||||
struct timeval t;
|
||||
if (OB_UNLIKELY((err_ret = gettimeofday(&t, nullptr)) < 0)) {
|
||||
LIB_LOG_RET(ERROR, err_ret, "gettimeofday error", K(err_ret), K(errno));
|
||||
systime_error = true;
|
||||
ob_abort();
|
||||
}
|
||||
return (static_cast<int64_t>(t.tv_sec) * 1000000L +
|
||||
@ -40,10 +43,11 @@ int64_t ObTimeUtility::current_time_ns()
|
||||
struct timespec ts;
|
||||
if (OB_UNLIKELY((err_ret = clock_gettime(CLOCK_REALTIME, &ts)) != 0)) {
|
||||
LIB_LOG_RET(WARN, err_ret, "current system not support CLOCK_REALTIME", K(err_ret), K(errno));
|
||||
ob_abort();
|
||||
}
|
||||
return static_cast<int64_t>(ts.tv_sec) * 1000000000L +
|
||||
static_cast<int64_t>(ts.tv_nsec);
|
||||
systime_error = true;
|
||||
ob_abort();
|
||||
}
|
||||
return static_cast<int64_t>(ts.tv_sec) * 1000000000L +
|
||||
static_cast<int64_t>(ts.tv_nsec);
|
||||
}
|
||||
|
||||
int64_t ObTimeUtility::current_monotonic_raw_time()
|
||||
@ -73,13 +77,16 @@ int64_t ObTimeUtility::current_monotonic_raw_time()
|
||||
int64_t ObTimeUtility::current_time_coarse()
|
||||
{
|
||||
struct timespec t;
|
||||
if (OB_UNLIKELY(clock_gettime(
|
||||
int err_ret = 0;
|
||||
if (OB_UNLIKELY((err_ret = clock_gettime(
|
||||
#ifdef HAVE_REALTIME_COARSE
|
||||
CLOCK_REALTIME_COARSE,
|
||||
#else
|
||||
CLOCK_REALTIME,
|
||||
#endif
|
||||
&t))) {
|
||||
&t)) != 0)) {
|
||||
LIB_LOG_RET(ERROR, err_ret, "clock_gettime error", K(err_ret), K(errno));
|
||||
systime_error = true;
|
||||
ob_abort();
|
||||
}
|
||||
return (static_cast<int64_t>(t.tv_sec) * 1000000L +
|
||||
|
||||
Reference in New Issue
Block a user