dbms: fixed error [#METR-18011].

This commit is contained in:
Alexey Milovidov 2015-09-17 23:00:19 +03:00
parent 662471de29
commit 43ee70e1fe
2 changed files with 8 additions and 1 deletions

View File

@ -70,6 +70,9 @@ private:
/// Внутренняя версия функции receivePacket без блокировки.
Connection::Packet receivePacketUnlocked();
/// Внутренняя версия функции dumpAddresses без блокировки.
std::string dumpAddressesUnlocked() const;
/// Получить реплику, на которой можно прочитать данные.
ReplicaMap::iterator getReplicaForReading();

View File

@ -177,7 +177,11 @@ Connection::Packet ParallelReplicas::drain()
std::string ParallelReplicas::dumpAddresses() const
{
Poco::ScopedLock<Poco::FastMutex> lock(cancel_mutex);
dumpAddressesUnlocked();
}
std::string ParallelReplicas::dumpAddressesUnlocked() const
{
bool is_first = true;
std::ostringstream os;
for (auto & e : replica_map)
@ -289,7 +293,7 @@ ParallelReplicas::ReplicaMap::iterator ParallelReplicas::waitForReadEvent()
int n = Poco::Net::Socket::select(read_list, write_list, except_list, settings->receive_timeout);
if (n == 0)
throw Exception("Timeout exceeded while reading from " + dumpAddresses(), ErrorCodes::TIMEOUT_EXCEEDED);
throw Exception("Timeout exceeded while reading from " + dumpAddressesUnlocked(), ErrorCodes::TIMEOUT_EXCEEDED);
}
auto & socket = read_list[rand() % read_list.size()];