mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-29 05:00:47 +00:00
Fix obvious deadlock
This commit is contained in:
parent
045935151f
commit
10cec45e53
@ -46,7 +46,7 @@ void NuKeeperServer::startup()
|
||||
params.election_timeout_upper_bound_ = 400;
|
||||
params.reserved_log_items_ = 5000;
|
||||
params.snapshot_distance_ = 5000;
|
||||
params.client_req_timeout_ = 3000;
|
||||
params.client_req_timeout_ = 10000;
|
||||
params.return_method_ = nuraft::raft_params::blocking;
|
||||
|
||||
raft_instance = launcher.init(
|
||||
@ -145,10 +145,23 @@ TestKeeperStorage::ResponsesForSessions NuKeeperServer::putRequests(const TestKe
|
||||
|
||||
auto result = raft_instance->append_entries(entries);
|
||||
if (!result->get_accepted())
|
||||
throw Exception(ErrorCodes::RAFT_ERROR, "Cannot send requests to RAFT, mostly because we are not leader");
|
||||
throw Exception(ErrorCodes::RAFT_ERROR, "Cannot send requests to RAFT, mostly because we are not leader, code {}, message: '{}'", result->get_result_code(), result->get_result_str());
|
||||
|
||||
if (result->get_result_code() != nuraft::cmd_result_code::OK)
|
||||
throw Exception(ErrorCodes::RAFT_ERROR, "Requests failed");
|
||||
if (result->get_result_code() == nuraft::cmd_result_code::TIMEOUT)
|
||||
{
|
||||
TestKeeperStorage::ResponsesForSessions responses;
|
||||
for (const auto & [session_id, request] : requests)
|
||||
{
|
||||
auto response = request->makeResponse();
|
||||
response->xid = request->xid;
|
||||
response->zxid = 0; /// FIXME what we can do with it?
|
||||
response->error = Coordination::Error::ZOPERATIONTIMEOUT;
|
||||
responses.push_back(DB::TestKeeperStorage::ResponseForSession{session_id, response});
|
||||
}
|
||||
return responses;
|
||||
}
|
||||
else if (result->get_result_code() != nuraft::cmd_result_code::OK)
|
||||
throw Exception(ErrorCodes::RAFT_ERROR, "Requests result failed with code {} and message: '{}'", result->get_result_code(), result->get_result_str());
|
||||
|
||||
return readZooKeeperResponses(result->get());
|
||||
}
|
||||
|
@ -14,8 +14,6 @@ namespace ErrorCodes
|
||||
void TestKeeperStorageDispatcher::processingThread()
|
||||
{
|
||||
setThreadName("TestKeeperSProc");
|
||||
try
|
||||
{
|
||||
while (!shutdown)
|
||||
{
|
||||
TestKeeperStorage::RequestForSession request;
|
||||
@ -26,17 +24,17 @@ void TestKeeperStorageDispatcher::processingThread()
|
||||
{
|
||||
if (shutdown)
|
||||
break;
|
||||
|
||||
try
|
||||
{
|
||||
auto responses = server->putRequests({request});
|
||||
for (const auto & response_for_session : responses)
|
||||
setResponse(response_for_session.session_id, response_for_session.response);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
tryLogCurrentException(__PRETTY_FUNCTION__);
|
||||
finalize();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user