mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-27 01:51:59 +00:00
Set DB:Exception on unscheduled requests
This commit is contained in:
parent
54cc193d01
commit
b49f50bf47
@ -28,6 +28,11 @@ namespace CurrentMetrics
|
|||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
|
namespace ErrorCodes
|
||||||
|
{
|
||||||
|
extern const int QUERY_WAS_CANCELLED;
|
||||||
|
}
|
||||||
|
|
||||||
/// Allows to "deduplicate" getStatus() requests for the same table: if a request for a table is already in progress
|
/// Allows to "deduplicate" getStatus() requests for the same table: if a request for a table is already in progress
|
||||||
/// then the new request will return the same future as the previous one.
|
/// then the new request will return the same future as the previous one.
|
||||||
class StatusRequestsPool
|
class StatusRequestsPool
|
||||||
@ -61,6 +66,10 @@ public:
|
|||||||
~StatusRequestsPool()
|
~StatusRequestsPool()
|
||||||
{
|
{
|
||||||
thread_pool.wait();
|
thread_pool.wait();
|
||||||
|
/// Cancel unscheduled requests
|
||||||
|
for (auto & request : requests_to_schedule)
|
||||||
|
std::get<2>(request)->set_exception(std::make_exception_ptr(
|
||||||
|
DB::Exception(ErrorCodes::QUERY_WAS_CANCELLED, "StatusRequestsPool is destroyed")));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Make a new request or "attach" to an existing one.
|
/// Make a new request or "attach" to an existing one.
|
||||||
|
Loading…
Reference in New Issue
Block a user