support glibc_maloc alloc succeed when tenant reach limit
This commit is contained in:
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",
|
"glibc_malloc",
|
||||||
ObCtxIds::GLIBC);
|
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 ObLabel::operator==(const ObLabel &other) const
|
||||||
{
|
{
|
||||||
bool bret = false;
|
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
|
class ObMallocHookAttrGuard
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ObMallocHookAttrGuard(const ObMemAttr& attr)
|
ObMallocHookAttrGuard(const ObMemAttr& attr);
|
||||||
: old_attr_(tl_mem_attr)
|
~ObMallocHookAttrGuard();
|
||||||
{
|
|
||||||
tl_mem_attr = attr;
|
|
||||||
}
|
|
||||||
~ObMallocHookAttrGuard()
|
|
||||||
{
|
|
||||||
tl_mem_attr = old_attr_;
|
|
||||||
}
|
|
||||||
static ObMemAttr get_tl_mem_attr()
|
static ObMemAttr get_tl_mem_attr()
|
||||||
{
|
{
|
||||||
return 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();
|
ObMemAttr attr = ObMallocHookAttrGuard::get_tl_mem_attr();
|
||||||
SET_USE_500(attr);
|
SET_USE_500(attr);
|
||||||
ptr = ob_malloc(size, 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)) {
|
if (OB_ISNULL(ptr)) {
|
||||||
::usleep(10000); // 10ms
|
::usleep(10000); // 10ms
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user