Fix auto increment service repeat unlock
This commit is contained in:
@ -736,7 +736,8 @@ int ObAutoincrementService::get_table_node(const AutoincParam ¶m, TableNode
|
|||||||
lib::ObMutex &mutex = init_node_mutex_[table_id % INIT_NODE_MUTEX_NUM];
|
lib::ObMutex &mutex = init_node_mutex_[table_id % INIT_NODE_MUTEX_NUM];
|
||||||
if (OB_FAIL(mutex.lock())) {
|
if (OB_FAIL(mutex.lock())) {
|
||||||
LOG_WARN("failed to get lock", K(ret));
|
LOG_WARN("failed to get lock", K(ret));
|
||||||
} else if (OB_ENTRY_NOT_EXIST == (ret = node_map_.get(key, table_node))) {
|
} else {
|
||||||
|
if (OB_ENTRY_NOT_EXIST == (ret = node_map_.get(key, table_node))) {
|
||||||
LOG_INFO("alloc table node for auto increment key", K(key));
|
LOG_INFO("alloc table node for auto increment key", K(key));
|
||||||
if (OB_FAIL(node_map_.alloc_value(table_node))) {
|
if (OB_FAIL(node_map_.alloc_value(table_node))) {
|
||||||
LOG_ERROR("failed to alloc table node", K(param), K(ret));
|
LOG_ERROR("failed to alloc table node", K(param), K(ret));
|
||||||
@ -757,10 +758,12 @@ int ObAutoincrementService::get_table_node(const AutoincParam ¶m, TableNode
|
|||||||
}
|
}
|
||||||
mutex.unlock();
|
mutex.unlock();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (OB_FAIL(alloc_autoinc_try_lock(table_node->alloc_mutex_))) {
|
if (OB_FAIL(alloc_autoinc_try_lock(table_node->alloc_mutex_))) {
|
||||||
LOG_WARN("failed to get lock", K(ret));
|
LOG_WARN("failed to get lock", K(ret));
|
||||||
} else if (OB_UNLIKELY(param.autoinc_version_ != table_node->autoinc_version_)) {
|
} else {
|
||||||
|
if (OB_UNLIKELY(param.autoinc_version_ != table_node->autoinc_version_)) {
|
||||||
LOG_INFO("start reset table node", K(*table_node), K(param));
|
LOG_INFO("start reset table node", K(*table_node), K(param));
|
||||||
table_node->next_value_ = 0;
|
table_node->next_value_ = 0;
|
||||||
table_node->local_sync_ = 0;
|
table_node->local_sync_ = 0;
|
||||||
@ -772,6 +775,7 @@ int ObAutoincrementService::get_table_node(const AutoincParam ¶m, TableNode
|
|||||||
}
|
}
|
||||||
table_node->alloc_mutex_.unlock();
|
table_node->alloc_mutex_.unlock();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (OB_SUCC(ret)) {
|
if (OB_SUCC(ret)) {
|
||||||
LOG_DEBUG("succ to get table node", K(param), KPC(table_node), K(ret));
|
LOG_DEBUG("succ to get table node", K(param), KPC(table_node), K(ret));
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user