diff --git a/deps/easy/src/io/easy_negotiation.c b/deps/easy/src/io/easy_negotiation.c index 479cb22eb..287aa6e82 100644 --- a/deps/easy/src/io/easy_negotiation.c +++ b/deps/easy/src/io/easy_negotiation.c @@ -67,9 +67,9 @@ static int easy_encode_uint16(char *buf, const uint64_t buf_len, int64_t *pos, u if (EASY_OK == ret) { *(buf + (*pos)++) = (char)((((val) >> 8)) & 0xff); - *(buf + (*pos)++) = (char)((val) & 0xff); - } - + *(buf + (*pos)++) = (char)((val) & 0xff); + } + return ret; } @@ -161,9 +161,9 @@ static int easy_decode_negotiation_msg(easy_negotiation_msg_t *ne_msg, char *rec ret = easy_decode_uint64(recv_buf, recv_buf_len, &pos, &(ne_msg->msg_body.eio_magic)); if (ret != EASY_OK) { - easy_info_log("decode eio magic failed!ret:%d.", ret); - return ret; - } + easy_info_log("decode eio magic failed!ret:%d.", ret); + return ret; + } pos++; //for io thread index *decode_len = pos; @@ -279,9 +279,9 @@ void net_consume_negotiation_msg(int fd, uint64_t magic) int easy_send_negotiate_message(easy_connection_t *c) { - int ret = EASY_OK; - easy_io_thread_t *ioth = c->ioth; - easy_io_t *eio = ioth->eio; + int ret = EASY_OK; + easy_io_thread_t *ioth = c->ioth; + easy_io_t *eio = ioth->eio; uint32_t conn_has_error = 0; if ((ret = net_send_negotiate_message(eio->negotiation_enable, c->fd, diff --git a/src/share/cache/ob_kvcache_inst_map.cpp b/src/share/cache/ob_kvcache_inst_map.cpp index 45ef1dbb8..004700416 100644 --- a/src/share/cache/ob_kvcache_inst_map.cpp +++ b/src/share/cache/ob_kvcache_inst_map.cpp @@ -389,9 +389,12 @@ int ObKVCacheInstMap::erase_tenant(const uint64_t tenant_id) ret = OB_INVALID_ARGUMENT; COMMON_LOG(WARN, "Invalid argument", K(ret), K(tenant_id)); } else { + ObSEArray erase_key_list; + ObSEArray erase_inst_list; DRWLock::WRLockGuard wr_guard(lock_); + ObKVCacheInst *inst = nullptr; for (KVCacheInstMap::iterator iter = inst_map_.begin() ; OB_SUCC(ret) && iter != inst_map_.end() ; ++iter) { - ObKVCacheInst *inst = iter->second; + inst = iter->second; if (tenant_id != iter->first.tenant_id_) { } else if (OB_ISNULL(inst)) { ret = OB_ERR_UNEXPECTED; @@ -400,11 +403,21 @@ int ObKVCacheInstMap::erase_tenant(const uint64_t tenant_id) ret = OB_ERR_UNEXPECTED; COMMON_LOG(WARN, "Still can not destroy cache inst", K(ret), KPC(inst), K(inst->status_.store_size_), K(inst->status_.kv_cnt_), K(inst->status_.lfu_mb_cnt_), K(inst->status_.lru_mb_cnt_)); - } else if (FALSE_IT(inst->reset())) { - } else if (OB_FAIL(inst_map_.erase_refactored(iter->first))) { + } else if (OB_FAIL(erase_key_list.push_back(iter->first))) { + COMMON_LOG(WARN, "Fail to push back erase inst key", K(ret)); + } else if (OB_FAIL(erase_inst_list.push_back(inst))) { + COMMON_LOG(WARN, "Fail to push back erase inst key", K(ret)); + } + } + for (int i = 0 ; OB_SUCC(ret) && i < erase_key_list.count() ; ++i) { + ObKVCacheInstKey tmp_key = erase_key_list.at(i); + inst = erase_inst_list.at(i); + if (OB_FAIL(inst_map_.erase_refactored(tmp_key))) { COMMON_LOG(WARN, "Fail to erase cache inst from inst map", K(ret)); + } else if (FALSE_IT(inst->reset())) { } else if (OB_FAIL(inst_pool_.push(inst))) { - COMMON_LOG(WARN, "Fail to push inst back to inst pool", K(ret)); + COMMON_LOG(ERROR, "Fail to push inst back to inst pool", K(ret)); + ob_abort(); } } }