alloc fix: glibc malloc Memory Splitting to Tenants

This commit is contained in:
obdev
2023-06-09 06:18:15 +00:00
committed by ob-robot
parent d336a8eee7
commit 789e3d8e21
5 changed files with 12 additions and 9 deletions

View File

@ -1042,17 +1042,18 @@ int ObMySQLUtil::urowid_cell_str(char *buf, const int64_t len, const ObURowIDDat
return ret;
}
int ObMySQLUtil::sql_utd_cell_str(char *buf, const int64_t len, const ObString &val, int64_t &pos)
int ObMySQLUtil::sql_utd_cell_str(uint64_t tenant_id, char *buf, const int64_t len, const ObString &val, int64_t &pos)
{
INIT_SUCC(ret);
ret = OB_NOT_SUPPORTED;
return ret;
}
int ObMySQLUtil::json_cell_str(char *buf, const int64_t len, const ObString &val, int64_t &pos)
int ObMySQLUtil::json_cell_str(uint64_t tenant_id, char *buf, const int64_t len, const ObString &val, int64_t &pos)
{
int ret = OB_SUCCESS;
ObArenaAllocator allocator;
lib::ObMemAttr mem_attr(tenant_id, "JsonAlloc");
ObArenaAllocator allocator(mem_attr);
ObJsonBin j_bin(val.ptr(), val.length(), &allocator);
ObIJsonBase *j_base = &j_bin;
ObJsonBuffer jbuf(&allocator);

View File

@ -429,8 +429,8 @@ public:
int64_t &pos);
static int lob_locator_cell_str(char *buf, const int64_t len,
const common::ObLobLocator &lob_locator, int64_t &pos);
static int json_cell_str(char *buf, const int64_t len, const ObString &val, int64_t &pos);
static int sql_utd_cell_str(char *buf, const int64_t len, const ObString &val, int64_t &pos);
static int json_cell_str(uint64_t tenant_id, char *buf, const int64_t len, const ObString &val, int64_t &pos);
static int sql_utd_cell_str(uint64_t tenant_id, char *buf, const int64_t len, const ObString &val, int64_t &pos);
static int geometry_cell_str(char *buf, const int64_t len, const ObString &val, int64_t &pos);
static inline int16_t float_length(const int16_t scale);
public:

View File

@ -191,7 +191,7 @@ int ObSMUtils::cell_str(
break;
}
case ObJsonTC:{
ret = ObMySQLUtil::json_cell_str(buf, len, obj.get_string(), pos);
ret = ObMySQLUtil::json_cell_str(MTL_ID(), buf, len, obj.get_string(), pos);
break;
}
case ObGeometryTC: {
@ -297,7 +297,7 @@ int ObSMUtils::cell_str(
break;
}
case ObUserDefinedSQLTC: {
ret = ObMySQLUtil::sql_utd_cell_str(buf, len, obj.get_string(), pos);
ret = ObMySQLUtil::sql_utd_cell_str(MTL_ID(), buf, len, obj.get_string(), pos);
break;
}
default:

View File

@ -592,6 +592,7 @@ void ObServer::destroy()
sql_engine_.destroy();
FLOG_INFO("sql engine destroyed");
FLOG_INFO("begin to destroy pl engine");
pl_engine_.destory();
FLOG_INFO("pl engine destroyed");
@ -2298,6 +2299,7 @@ int ObServer::init_sql()
}
}
if (OB_SUCC(ret)) {
LOG_INFO("init sql done");
} else {

View File

@ -6202,7 +6202,7 @@ int ObAggregateProcessor::get_json_arrayagg_result(const ObAggrInfo &aggr_info,
ObDatum &concat_result)
{
int ret = OB_SUCCESS;
common::ObArenaAllocator tmp_alloc;
common::ObArenaAllocator tmp_alloc(ObModIds::OB_SQL_AGGR_FUNC, OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID());
if (OB_ISNULL(extra) || OB_UNLIKELY(extra->empty())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unpexcted null", K(ret), K(extra));
@ -6324,7 +6324,7 @@ int ObAggregateProcessor::get_ora_json_arrayagg_result(const ObAggrInfo &aggr_in
ObDatum &concat_result)
{
int ret = OB_SUCCESS;
common::ObArenaAllocator tmp_alloc;
common::ObArenaAllocator tmp_alloc(ObModIds::OB_SQL_AGGR_FUNC, OB_MALLOC_NORMAL_BLOCK_SIZE, MTL_ID());
if (OB_ISNULL(extra) || OB_UNLIKELY(extra->empty())) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("get unpexcted null", K(ret), K(extra));