support glibc_maloc alloc succeed when tenant reach limit
This commit is contained in:
parent
4e0a02cc9a
commit
8e4046c707
12
deps/oblib/src/lib/alloc/alloc_struct.cpp
vendored
12
deps/oblib/src/lib/alloc/alloc_struct.cpp
vendored
@ -25,6 +25,18 @@ thread_local ObMemAttr ObMallocHookAttrGuard::tl_mem_attr(OB_SERVER_TENANT_ID,
|
||||
"glibc_malloc",
|
||||
ObCtxIds::GLIBC);
|
||||
|
||||
ObMallocHookAttrGuard::ObMallocHookAttrGuard(const ObMemAttr& attr)
|
||||
: old_attr_(tl_mem_attr)
|
||||
{
|
||||
tl_mem_attr = attr;
|
||||
tl_mem_attr.ctx_id_ = ObCtxIds::GLIBC;
|
||||
}
|
||||
|
||||
ObMallocHookAttrGuard::~ObMallocHookAttrGuard()
|
||||
{
|
||||
tl_mem_attr = old_attr_;
|
||||
}
|
||||
|
||||
bool ObLabel::operator==(const ObLabel &other) const
|
||||
{
|
||||
bool bret = false;
|
||||
|
11
deps/oblib/src/lib/alloc/alloc_struct.h
vendored
11
deps/oblib/src/lib/alloc/alloc_struct.h
vendored
@ -593,15 +593,8 @@ private:
|
||||
class ObMallocHookAttrGuard
|
||||
{
|
||||
public:
|
||||
ObMallocHookAttrGuard(const ObMemAttr& attr)
|
||||
: old_attr_(tl_mem_attr)
|
||||
{
|
||||
tl_mem_attr = attr;
|
||||
}
|
||||
~ObMallocHookAttrGuard()
|
||||
{
|
||||
tl_mem_attr = old_attr_;
|
||||
}
|
||||
ObMallocHookAttrGuard(const ObMemAttr& attr);
|
||||
~ObMallocHookAttrGuard();
|
||||
static ObMemAttr get_tl_mem_attr()
|
||||
{
|
||||
return tl_mem_attr;
|
||||
|
4
deps/oblib/src/lib/alloc/malloc_hook.cpp
vendored
4
deps/oblib/src/lib/alloc/malloc_hook.cpp
vendored
@ -62,6 +62,10 @@ void *ob_malloc_retry(size_t size)
|
||||
ObMemAttr attr = ObMallocHookAttrGuard::get_tl_mem_attr();
|
||||
SET_USE_500(attr);
|
||||
ptr = ob_malloc(size, attr);
|
||||
if (OB_ISNULL(ptr)) {
|
||||
attr.tenant_id_ = OB_SERVER_TENANT_ID;
|
||||
ptr = ob_malloc(size, attr);
|
||||
}
|
||||
if (OB_ISNULL(ptr)) {
|
||||
::usleep(10000); // 10ms
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user