mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Changed FastPath + better diagnostics
This commit is contained in:
parent
2cda8f1563
commit
54b4db36eb
@ -117,18 +117,27 @@ RWLockImpl::LockHolder RWLockImpl::getLock(RWLockImpl::Type type, const String &
|
|||||||
/// Check if the same query is acquiring previously acquired lock
|
/// Check if the same query is acquiring previously acquired lock
|
||||||
if (query_id != RWLockImpl::NO_QUERY)
|
if (query_id != RWLockImpl::NO_QUERY)
|
||||||
{
|
{
|
||||||
auto it_query = query_id_to_holder.find(query_id);
|
const auto it_query = query_id_to_holder.find(query_id);
|
||||||
if (it_query != query_id_to_holder.end())
|
if (it_query != query_id_to_holder.end())
|
||||||
|
{
|
||||||
res = it_query->second.lock();
|
res = it_query->second.lock();
|
||||||
}
|
if (res)
|
||||||
|
{
|
||||||
|
/// XXX: it means we can't upgrade lock from read to write - with proper waiting!
|
||||||
|
if (type == Write)
|
||||||
|
throw Exception(
|
||||||
|
"RWLockImpl::getLock(): Cannot acquire exclusive lock while RWLock is already locked",
|
||||||
|
ErrorCodes::LOGICAL_ERROR);
|
||||||
|
|
||||||
if (res)
|
if (res->it_group->type == Write)
|
||||||
{
|
throw Exception(
|
||||||
/// XXX: it means we can't upgrade lock from read to write - with proper waiting!
|
"RWLockImpl::getLock(): RWLock is already locked in exclusive mode",
|
||||||
if (type != Read || res->it_group->type != Read)
|
ErrorCodes::LOGICAL_ERROR);
|
||||||
throw Exception("Attempt to acquire exclusive lock recursively", ErrorCodes::LOGICAL_ERROR);
|
|
||||||
else
|
finalize_metrics();
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** If the query already has any active read lock and tries to acquire another read lock
|
/** If the query already has any active read lock and tries to acquire another read lock
|
||||||
|
Loading…
Reference in New Issue
Block a user