Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
clmforever
oceanbase
提交
158dedcc
O
oceanbase
项目概览
clmforever
/
oceanbase
与 Fork 源项目一致
Fork自
oceanbase / oceanbase
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
oceanbase
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
158dedcc
编写于
3月 03, 2023
作者:
N
nroskill
提交者:
ob-robot
3月 03, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix coredump at tenant hook
上级
4d673a8b
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
28 addition
and
54 deletion
+28
-54
deps/easy/src/io/easy_client.c
deps/easy/src/io/easy_client.c
+3
-1
deps/oblib/src/common/ob_queue_thread.cpp
deps/oblib/src/common/ob_queue_thread.cpp
+2
-2
deps/oblib/src/lib/CMakeLists.txt
deps/oblib/src/lib/CMakeLists.txt
+1
-0
deps/oblib/src/lib/hash/ob_hashutils.h
deps/oblib/src/lib/hash/ob_hashutils.h
+1
-1
deps/oblib/src/lib/lock/cond.h
deps/oblib/src/lib/lock/cond.h
+2
-2
deps/oblib/src/lib/lock/ob_thread_cond.cpp
deps/oblib/src/lib/lock/ob_thread_cond.cpp
+2
-2
deps/oblib/src/lib/ob_define.h
deps/oblib/src/lib/ob_define.h
+9
-0
deps/oblib/src/lib/thread/ob_tenant_hook.cpp
deps/oblib/src/lib/thread/ob_tenant_hook.cpp
+7
-44
src/observer/CMakeLists.txt
src/observer/CMakeLists.txt
+0
-1
src/share/schema/ob_multi_version_schema_service.cpp
src/share/schema/ob_multi_version_schema_service.cpp
+1
-1
未找到文件。
deps/easy/src/io/easy_client.c
浏览文件 @
158dedcc
...
...
@@ -19,6 +19,8 @@
static
int
easy_client_uthread_wakeup_conn
(
easy_connection_t
*
c
);
static
int
easy_client_uthread_wakeup_session
(
easy_request_t
*
r
);
int
ob_pthread_cond_wait
(
pthread_cond_t
*
__restrict
__cond
,
pthread_mutex_t
*
__restrict
__mutex
);
/**
* 把session发送到addr上
*/
...
...
@@ -148,7 +150,7 @@ void easy_client_wait(easy_client_wait_t *w, int count)
pthread_mutex_lock
(
&
w
->
mutex
);
while
(
w
->
done_count
<
count
)
{
pthread_cond_wait
(
&
w
->
cond
,
&
w
->
mutex
);
ob_
pthread_cond_wait
(
&
w
->
cond
,
&
w
->
mutex
);
}
pthread_mutex_unlock
(
&
w
->
mutex
);
...
...
deps/oblib/src/common/ob_queue_thread.cpp
浏览文件 @
158dedcc
...
...
@@ -62,7 +62,7 @@ int ObCond::wait()
if
(
need_wait
)
{
pthread_mutex_lock
(
&
mutex_
);
while
(
OB_SUCC
(
ret
)
&&
false
==
ATOMIC_CAS
(
&
bcond_
,
true
,
false
))
{
int
tmp_ret
=
pthread_cond_wait
(
&
cond_
,
&
mutex_
);
int
tmp_ret
=
ob_
pthread_cond_wait
(
&
cond_
,
&
mutex_
);
if
(
ETIMEDOUT
==
tmp_ret
)
{
ret
=
OB_TIMEOUT
;
break
;
...
...
@@ -95,7 +95,7 @@ int ObCond::timedwait(const int64_t time_us)
ts
.
tv_nsec
=
(
abs_time
%
1000000
)
*
1000
;
pthread_mutex_lock
(
&
mutex_
);
while
(
OB_SUCC
(
ret
)
&&
false
==
ATOMIC_CAS
(
&
bcond_
,
true
,
false
))
{
int
tmp_ret
=
pthread_cond_timedwait
(
&
cond_
,
&
mutex_
,
&
ts
);
int
tmp_ret
=
ob_
pthread_cond_timedwait
(
&
cond_
,
&
mutex_
,
&
ts
);
if
(
ETIMEDOUT
==
tmp_ret
)
{
ret
=
OB_TIMEOUT
;
break
;
...
...
deps/oblib/src/lib/CMakeLists.txt
浏览文件 @
158dedcc
...
...
@@ -214,6 +214,7 @@ ob_set_subtarget(oblib_lib thread
thread/protected_stack_allocator.cpp
thread/thread.cpp
thread/threads.cpp
thread/ob_tenant_hook.cpp
)
ob_set_subtarget
(
oblib_lib utility
...
...
deps/oblib/src/lib/hash/ob_hashutils.h
浏览文件 @
158dedcc
...
...
@@ -156,7 +156,7 @@ public:
~
MutexWaiter
()
{}
int
operator
()(
pthread_cond_t
&
cond
,
pthread_mutex_t
&
lock
,
struct
timespec
&
ts
)
{
return
pthread_cond_timedwait
(
&
cond
,
&
lock
,
&
ts
);
return
ob_
pthread_cond_timedwait
(
&
cond
,
&
lock
,
&
ts
);
}
};
...
...
deps/oblib/src/lib/lock/cond.h
浏览文件 @
158dedcc
...
...
@@ -81,7 +81,7 @@ Cond::wait_impl(const M& mutex) const
LockState
state
;
mutex
.
unlock
(
state
);
const
int
rc
=
pthread_cond_wait
(
&
_cond
,
state
.
mutex
);
const
int
rc
=
ob_
pthread_cond_wait
(
&
_cond
,
state
.
mutex
);
mutex
.
lock
(
state
);
if
(
0
!=
rc
)
{
...
...
@@ -112,7 +112,7 @@ Cond::timed_wait_impl(const M& mutex, const ObSysTime& timeout) const
timespec ts;
ts.tv_sec = tv.tv_sec + timeout/1000;
ts.tv_nsec = tv.tv_usec * 1000 + ( timeout % 1000 ) * 1000000;*/
const
int
rc
=
pthread_cond_timedwait
(
&
_cond
,
state
.
mutex
,
&
ts
);
const
int
rc
=
ob_
pthread_cond_timedwait
(
&
_cond
,
state
.
mutex
,
&
ts
);
mutex
.
lock
(
state
);
if
(
rc
!=
0
)
{
...
...
deps/oblib/src/lib/lock/ob_thread_cond.cpp
浏览文件 @
158dedcc
...
...
@@ -81,7 +81,7 @@ int ObThreadCond::wait_us(const uint64_t time_us)
}
else
{
ObWaitEventGuard
guard
(
event_no_
,
time_us
/
1000
,
reinterpret_cast
<
int64_t
>
(
this
));
if
(
0
==
time_us
)
{
if
(
OB_UNLIKELY
(
0
!=
(
tmp_ret
=
pthread_cond_wait
(
&
cond_
,
&
mutex_
))))
{
if
(
OB_UNLIKELY
(
0
!=
(
tmp_ret
=
ob_
pthread_cond_wait
(
&
cond_
,
&
mutex_
))))
{
ret
=
OB_ERR_SYS
;
COMMON_LOG
(
WARN
,
"Fail to cond wait, "
,
K
(
tmp_ret
),
K
(
ret
));
}
...
...
@@ -103,7 +103,7 @@ int ObThreadCond::wait_us(const uint64_t time_us)
abstime
.
tv_sec
=
static_cast
<
decltype
(
abstime
.
tv_sec
)
>
(
std
::
min
(
static_cast
<
uint64_t
>
(
std
::
numeric_limits
<
decltype
(
abstime
.
tv_sec
)
>::
max
()),
static_cast
<
uint64_t
>
(
us
/
1000000
)));
abstime
.
tv_nsec
=
static_cast
<
decltype
(
abstime
.
tv_nsec
)
>
(
us
%
static_cast
<
uint64_t
>
(
1000000
))
*
1000
;
if
(
OB_UNLIKELY
(
0
!=
(
tmp_ret
=
pthread_cond_timedwait
(
&
cond_
,
&
mutex_
,
&
abstime
))))
{
if
(
OB_UNLIKELY
(
0
!=
(
tmp_ret
=
ob_
pthread_cond_timedwait
(
&
cond_
,
&
mutex_
,
&
abstime
))))
{
if
(
ETIMEDOUT
!=
tmp_ret
)
{
ret
=
OB_ERR_SYS
;
COMMON_LOG
(
WARN
,
"Fail to timed cond wait, "
,
K
(
time_us
),
K
(
tmp_ret
),
K
(
ret
));
...
...
deps/oblib/src/lib/ob_define.h
浏览文件 @
158dedcc
...
...
@@ -2404,4 +2404,13 @@ inline bool is_x86() {
#define DISABLE_WARNING_GCC_POP _Pragma("GCC diagnostic pop")
#define DISABLE_WARNING_GCC_ATTRIBUTES DISABLE_WARNING_GCC("-Wattributes")
extern
"C"
{
extern
int
ob_pthread_cond_wait
(
pthread_cond_t
*
__restrict
__cond
,
pthread_mutex_t
*
__restrict
__mutex
);
extern
int
ob_pthread_cond_timedwait
(
pthread_cond_t
*
__restrict
__cond
,
pthread_mutex_t
*
__restrict
__mutex
,
const
struct
timespec
*
__restrict
__abstime
);
}
#endif // OCEANBASE_COMMON_DEFINE_H_
src/observer/omt
/ob_tenant_hook.cpp
→
deps/oblib/src/lib/thread
/ob_tenant_hook.cpp
浏览文件 @
158dedcc
...
...
@@ -3,17 +3,12 @@
#ifndef PERF_MODE
#define _GNU_SOURCE 1
#include "ob_tenant.h"
#include "observer/ob_server_struct.h"
#include "observer/omt/ob_multi_tenant.h"
#include "lib/worker.h"
#include "share/ob_define.h"
#include <dlfcn.h>
#define SYS_HOOK(func_name, ...) \
({ \
int ret = 0; \
oceanbase::omt::ObTenant *tenant = NULL; \
if (!in_sys_hook++ && OB_NOT_NULL(oceanbase::lib::Worker::self_)) { \
oceanbase::lib::Worker::self_->set_is_blocking(true); \
ret = real_##func_name(__VA_ARGS__); \
...
...
@@ -36,16 +31,6 @@ using namespace omt;
extern
"C"
{
ObTenant
*
sys_hook_get_tenant
()
{
ObTenant
*
tenant
=
NULL
;
uint64_t
tenant_id
=
0
;
if
((
tenant_id
=
GET_TENANT_ID
())
!=
0
&&
OB_NOT_NULL
(
GCTX
.
omt_
))
{
GCTX
.
omt_
->
get_tenant
(
tenant_id
,
tenant
);
}
return
tenant
;
}
int
pthread_mutex_lock
(
pthread_mutex_t
*
__mutex
)
{
static
int
(
*
real_pthread_mutex_lock
)(
pthread_mutex_t
*
__mutex
)
=
...
...
@@ -119,45 +104,23 @@ int pthread_rwlock_timedwrlock(pthread_rwlock_t *__restrict __rwlock,
}
#endif
// objdump -t /lib64/libpthread.so.0 | grep pthread_cond_wait
#if defined(__x86_64__)
#define __PTHREAD_COND_WAIT_GLIBC_VERSION "GLIBC_2.3.2"
#elif defined(__aarch64__)
#define __PTHREAD_COND_WAIT_GLIBC_VERSION "GLIBC_2.17"
#else
#error arch unsupported
#endif
int
pthread_cond_wait
(
pthread_cond_t
*
__restrict
__cond
,
pthread_mutex_t
*
__restrict
__mutex
)
int
ob_pthread_cond_wait
(
pthread_cond_t
*
__restrict
__cond
,
pthread_mutex_t
*
__restrict
__mutex
)
{
static
int
(
*
real_pthread_cond_wait
)(
pthread_cond_t
*
__restrict
__cond
,
pthread_mutex_t
*
__restrict
__mutex
)
=
(
typeof
(
real_pthread_cond_wait
))
dlvsym
(
RTLD_NEXT
,
"pthread_cond_wait"
,
__PTHREAD_COND_WAIT_GLIBC_VERSION
);
pthread_mutex_t
*
__restrict
__mutex
)
=
pthread_cond_wait
;
int
ret
=
0
;
ret
=
SYS_HOOK
(
pthread_cond_wait
,
__cond
,
__mutex
);
return
ret
;
}
// objdump -t /lib64/libpthread.so.0 | grep pthread_cond_timedwait
#if defined(__x86_64__)
#define __PTHREAD_COND_TIMEDWAIT_GLIBC_VERSION "GLIBC_2.3.2"
#elif defined(__aarch64__)
#define __PTHREAD_COND_TIMEDWAIT_GLIBC_VERSION "GLIBC_2.17"
#else
#error arch unsupported
#endif
int
pthread_cond_timedwait
(
pthread_cond_t
*
__restrict
__cond
,
pthread_mutex_t
*
__restrict
__mutex
,
const
struct
timespec
*
__restrict
__abstime
)
int
ob_pthread_cond_timedwait
(
pthread_cond_t
*
__restrict
__cond
,
pthread_mutex_t
*
__restrict
__mutex
,
const
struct
timespec
*
__restrict
__abstime
)
{
static
int
(
*
real_pthread_cond_timedwait
)(
pthread_cond_t
*
__restrict
__cond
,
pthread_mutex_t
*
__restrict
__mutex
,
const
struct
timespec
*
__restrict
__abstime
)
=
(
typeof
(
real_pthread_cond_timedwait
))
dlvsym
(
RTLD_NEXT
,
"pthread_cond_timedwait"
,
__PTHREAD_COND_TIMEDWAIT_GLIBC_VERSION
);
const
struct
timespec
*
__restrict
__abstime
)
=
pthread_cond_timedwait
;
int
ret
=
0
;
ret
=
SYS_HOOK
(
pthread_cond_timedwait
,
__cond
,
__mutex
,
__abstime
);
return
ret
;
...
...
src/observer/CMakeLists.txt
浏览文件 @
158dedcc
...
...
@@ -112,7 +112,6 @@ ob_set_subtarget(ob_server omt
omt/ob_th_worker.cpp
omt/ob_worker_processor.cpp
omt/ob_multi_tenant_operator.cpp
omt/ob_tenant_hook.cpp
omt/ob_tenant_srs_mgr.cpp
omt/ob_tenant_srs.cpp
)
...
...
src/share/schema/ob_multi_version_schema_service.cpp
浏览文件 @
158dedcc
...
...
@@ -153,7 +153,7 @@ void ObSchemaConstructTask::wait(const int64_t version)
}
int
rc
=
0
;
do
{
rc
=
pthread_cond_timedwait
(
&
schema_cond_
,
&
schema_mutex_
,
&
ts
);
rc
=
ob_
pthread_cond_timedwait
(
&
schema_cond_
,
&
schema_mutex_
,
&
ts
);
}
while
(
0
);
(
void
)
rc
;
// make compiler happy
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录