[CP] sql_nio memory_pool allocate memory form tenant after get tenant_id
This commit is contained in:
parent
34e9cfafa4
commit
1edcb5e540
@ -30,6 +30,7 @@ public:
|
||||
ObSqlSessionMemPool(): pool_() {}
|
||||
virtual ~ObSqlSessionMemPool() {}
|
||||
void* alloc(int64_t sz) { return pool_.alloc(sz); }
|
||||
void set_tenant_id(int64_t tenant_id) { pool_.set_tenant_id(tenant_id); }
|
||||
void reset() { pool_.destroy(); }
|
||||
void reuse() { pool_.reuse(); }
|
||||
private:
|
||||
|
1
deps/oblib/src/rpc/obrpc/ob_rpc_mem_pool.h
vendored
1
deps/oblib/src/rpc/obrpc/ob_rpc_mem_pool.h
vendored
@ -28,6 +28,7 @@ public:
|
||||
~ObRpcMemPool() { destroy(); }
|
||||
static ObRpcMemPool* create(int64_t tenant_id, const char* label, int64_t req_sz);
|
||||
void* alloc(int64_t sz);
|
||||
void set_tenant_id(int64_t tenant_id) { tenant_id_ = tenant_id; }
|
||||
void reuse();
|
||||
void destroy();
|
||||
private:
|
||||
|
@ -237,6 +237,13 @@ int get_user_tenant(ObRequest &req, char *user_name_buf, char *tenant_name_buf)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void set_sql_sock_mem_pool_tenant_id(ObRequest &req, int64_t tenant_id)
|
||||
{
|
||||
if (req.get_nio_protocol() == ObRequest::TRANSPORT_PROTO_POC) {
|
||||
obmysql::ObSqlSockSession* sess = (obmysql::ObSqlSockSession*)req.get_server_handle_context();
|
||||
sess->pool_.set_tenant_id(tenant_id);
|
||||
}
|
||||
}
|
||||
int dispatch_req(const uint64_t tenant_id, ObRequest &req, QueueThread *global_mysql_queue)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
@ -259,6 +266,7 @@ int dispatch_req(const uint64_t tenant_id, ObRequest &req, QueueThread *global_m
|
||||
} else if (OB_ISNULL(mysql_queue)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("mysql_queue is NULL", K(ret), K(tenant_id));
|
||||
} else if (FALSE_IT(set_sql_sock_mem_pool_tenant_id(req, tenant_id))) {
|
||||
} else if (!mysql_queue->queue_.push(&req, MAX_QUEUE_LEN)) { // MAX_QUEUE_LEN = 10000;
|
||||
ret = OB_QUEUE_OVERFLOW;
|
||||
EVENT_INC(MYSQL_DELIVER_FAIL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user