[BUG] add row latch when log sync failed

This commit is contained in:
obdev
2023-01-28 17:00:18 +08:00
committed by ob-robot
parent da8c498599
commit 06b882fa75
7 changed files with 33 additions and 3 deletions

View File

@ -654,6 +654,20 @@ public:
tcp_keepintvl_ = tcp_keepintvl;
tcp_keepcnt_ = tcp_keepcnt;
}
void close_all_fd() {
if (lfd_ > 0) {
IGNORE_RETURN epoll_ctl(epfd_, EPOLL_CTL_DEL, lfd_, NULL);
close(lfd_);
lfd_ = -1;
}
ObDLink* head = all_list_.head();
ObLink* cur = head->next_;
while (cur != head) {
ObSqlSock* s = CONTAINER_OF(cur, ObSqlSock, all_list_link_);
cur = cur->next_;
s->do_close();
}
}
private:
void handle_epoll_event() {
const int maxevents = 512;
@ -937,6 +951,9 @@ void ObSqlNio::run(int64_t idx)
while(!has_set_stop()) {
impl_[idx].do_work();
}
if (has_set_stop()) {
impl_[idx].close_all_fd();
}
}
}

View File

@ -737,6 +737,7 @@ void MockTenantModuleEnv::destroy()
ObTsMgr::get_instance().wait();
ObTsMgr::get_instance().destroy();
net_frame_.sql_nio_stop();
net_frame_.stop();
net_frame_.wait();
net_frame_.destroy();

View File

@ -898,6 +898,10 @@ int ObServer::stop()
FLOG_INFO("mysql shutdown network stopped");
}
FLOG_INFO("begin to sql nio stop");
net_frame_.sql_nio_stop();
FLOG_INFO("sql nio stopped");
FLOG_INFO("begin to stop active session history task");
ObActiveSessHistTask::get_instance().stop();
FLOG_INFO("active session history task stopped");

View File

@ -453,9 +453,6 @@ int ObSrvNetworkFrame::stop()
if (OB_FAIL(net_.stop())) {
LOG_WARN("stop easy net fail", K(ret));
}
if (NULL != obmysql::global_sql_nio_server) {
obmysql::global_sql_nio_server->stop();
}
return ret;
}
@ -489,3 +486,10 @@ void ObSrvNetworkFrame::set_ratelimit_enable(int ratelimit_enabled)
rpc_transport_->set_ratelimit_enable(ratelimit_enabled);
batch_rpc_transport_->set_ratelimit_enable(ratelimit_enabled);
}
void ObSrvNetworkFrame::sql_nio_stop()
{
if (NULL != obmysql::global_sql_nio_server) {
obmysql::global_sql_nio_server->stop();
}
}

View File

@ -49,6 +49,7 @@ public:
int high_prio_rpc_shutdown();
int batch_rpc_shutdown();
int unix_rpc_shutdown();
void sql_nio_stop();
void wait();
int stop();

View File

@ -1204,6 +1204,8 @@ int ObMvccRowCallback::log_sync_fail()
{
int ret = OB_SUCCESS;
ObRowLatchGuard guard(value_.latch_);
if (OB_FAIL(dec_unsynced_cnt_())) {
TRANS_LOG(ERROR, "memtable dec unsynced cnt error", K(ret),
K(memtable_->get_unsynced_cnt()));

View File

@ -334,6 +334,7 @@ int MockObServer::stop()
if (!is_inited_) {
STORAGE_LOG(WARN, "ob server not inited");
ret = OB_NOT_INIT;
} else if (FALSE_IT(net_frame_.sql_nio_stop())) {
} else if (OB_SUCCESS != (ret = net_frame_.stop())) {
STORAGE_LOG(WARN, "net frame stop error", K(ret));
} else {