fix mysql_queue stop
This commit is contained in:
@ -42,6 +42,7 @@ ObReqQueue::ObReqQueue(int queue_capacity)
|
||||
|
||||
ObReqQueue::~ObReqQueue()
|
||||
{
|
||||
LOG_INFO("begin to destroy queue", K(queue_.size()));
|
||||
queue_.destroy();
|
||||
}
|
||||
|
||||
@ -163,16 +164,20 @@ void ObReqQueue::loop()
|
||||
|
||||
if (!wait_finish_) {
|
||||
LOG_INFO("exiting queue thread without wait finish", K(queue_.size()));
|
||||
} else if (0 < queue_.size()) {
|
||||
} else {
|
||||
LOG_INFO("exiting queue thread and wait remain finish", K(queue_.size()));
|
||||
// Process remains if we should wait until all task has been
|
||||
// processed before exiting this thread. Previous return code
|
||||
// isn't significant, we just ignore it to make progress. When
|
||||
// queue pop a normal task we process it until pop fails.
|
||||
ret = OB_SUCCESS;
|
||||
while (OB_SUCC(ret)) {
|
||||
while (queue_.size() > 0 && OB_SUCC(ret)) {
|
||||
if (OB_FAIL(queue_.pop(task, timeout))) {
|
||||
LOG_DEBUG("queue pop task fail", K(&queue_));
|
||||
if(OB_ENTRY_NOT_EXIST == ret) {
|
||||
// lightyqueue may return OB_ENTRY_NOT_EXIST when tasks existing
|
||||
ret = OB_SUCCESS;
|
||||
}
|
||||
} else if (NULL != task) {
|
||||
process_task(task); // ignore return code.
|
||||
} else {
|
||||
|
||||
@ -45,7 +45,7 @@ public:
|
||||
void set_host(const common::ObAddr &host);
|
||||
void loop();
|
||||
|
||||
size_t size() const
|
||||
int64_t size() const
|
||||
{
|
||||
return queue_.size();
|
||||
}
|
||||
|
||||
@ -117,8 +117,8 @@ int dispatch_req(ObRequest& req)
|
||||
ret = OB_TENANT_NOT_IN_SERVER;
|
||||
} else if (is_meta_tenant(tenant_id)) {
|
||||
// cannot login meta tenant
|
||||
ret = OB_TENANT_NOT_IN_SERVER;
|
||||
LOG_WARN("cannot login meta tenant", K(ret), K(tenant_id));
|
||||
ret = OB_TENANT_NOT_IN_SERVER;
|
||||
} else if (is_sys_tenant(tenant_id) || is_user_tenant(tenant_id)) {
|
||||
MTL_SWITCH(tenant_id) {
|
||||
QueueThread *mysql_queue = MTL(QueueThread *);
|
||||
@ -504,11 +504,11 @@ int ObSrvDeliver::deliver_mysql_request(ObRequest &req)
|
||||
// do nothing
|
||||
} else {
|
||||
if (OB_TENANT_NOT_IN_SERVER == ret) {
|
||||
LOG_WARN("cannot dispatch success", K(ret), K(req));
|
||||
LOG_WARN("fail to dispatch to tenant", K(ret), K(req));
|
||||
// set OB_SUCCESS to go normal procedure
|
||||
ret = OB_SUCCESS;
|
||||
}
|
||||
if (!mysql_queue_->queue_.push(&req, MAX_QUEUE_LEN)) {
|
||||
if (OB_SUCC(ret) && !mysql_queue_->queue_.push(&req, MAX_QUEUE_LEN)) {
|
||||
ret = OB_QUEUE_OVERFLOW;
|
||||
EVENT_INC(MYSQL_DELIVER_FAIL);
|
||||
LOG_ERROR("deliver request fail", K(req));
|
||||
|
||||
Reference in New Issue
Block a user