mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
Print log in case of exception in PollingQueue
This commit is contained in:
parent
24503267d5
commit
3b95ee8e60
@ -9,6 +9,7 @@
|
||||
|
||||
#include <IO/WriteBufferFromString.h>
|
||||
#include <IO/Operators.h>
|
||||
#include <common/getThreadId.h>
|
||||
|
||||
namespace DB
|
||||
{
|
||||
@ -60,7 +61,7 @@ void PollingQueue::addTask(size_t thread_number, void * data, int fd)
|
||||
if (-1 == epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fd, &socket_event))
|
||||
throwFromErrno("Cannot add socket descriptor to epoll", ErrorCodes::CANNOT_OPEN_FILE);
|
||||
|
||||
log.emplace_back(Log{.add = true, .key = key, .ptr = data});
|
||||
log.emplace_back(Log{.add = true, .key = key, .ptr = data, .thread_id = getThreadId()});
|
||||
}
|
||||
|
||||
static std::string dumpTasks(const std::unordered_map<std::uintptr_t, PollingQueue::TaskData> & tasks)
|
||||
@ -86,7 +87,7 @@ static std::string dumpLog(const std::vector<PollingQueue::Log> & log)
|
||||
{
|
||||
res << (item.add ? '+' : '-') << ' ' << item.key << ' ';
|
||||
writePointerHex(item.ptr, res);
|
||||
res << '\n';
|
||||
res << " [" << item.thread_id << "]\n";
|
||||
}
|
||||
|
||||
return res.str();
|
||||
@ -130,7 +131,7 @@ PollingQueue::TaskData PollingQueue::wait(std::unique_lock<std::mutex> & lock)
|
||||
if (-1 == epoll_ctl(epoll_fd, EPOLL_CTL_DEL, res.fd, &event))
|
||||
throwFromErrno("Cannot remove socket descriptor to epoll", ErrorCodes::CANNOT_OPEN_FILE);
|
||||
|
||||
log.emplace_back(Log{.add = false, .key = key, .ptr = ptr});
|
||||
log.emplace_back(Log{.add = false, .key = key, .ptr = ptr, .thread_id = getThreadId()});
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ public:
|
||||
bool add;
|
||||
std::uintptr_t key;
|
||||
const void * ptr;
|
||||
uint64_t thread_id;
|
||||
};
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user