mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Fix the fix
This commit is contained in:
parent
72fae1057d
commit
6ce1ae36d3
@ -113,15 +113,15 @@ public:
|
||||
if (size > 0)
|
||||
{
|
||||
/// When sleeping, the query cannot be cancelled. For ability to cancel query, we limit sleep time.
|
||||
UInt64 microseconds = static_cast<UInt64>(seconds) * 1000000ull;
|
||||
if (max_microseconds && seconds * 1e6 > max_microseconds)
|
||||
UInt64 microseconds = static_cast<UInt64>(seconds * 1e6);
|
||||
if (max_microseconds && microseconds > max_microseconds)
|
||||
throw Exception(ErrorCodes::TOO_SLOW, "The maximum sleep time is {} microseconds. Requested: {} microseconds",
|
||||
max_microseconds, microseconds);
|
||||
|
||||
if (!dry_run)
|
||||
{
|
||||
UInt64 count = (variant == FunctionSleepVariant::PerBlock ? 1 : size);
|
||||
microseconds = static_cast<UInt64>(seconds) * count * 1000000ull;
|
||||
microseconds *= count;
|
||||
|
||||
if (max_microseconds && microseconds > max_microseconds)
|
||||
throw Exception(ErrorCodes::TOO_SLOW,
|
||||
|
@ -2,3 +2,6 @@ SELECT sleep(3.40282e+44); -- { serverError BAD_ARGUMENTS }
|
||||
SELECT sleep((pow(2, 64) / 1000000) - 1); -- { serverError BAD_ARGUMENTS }
|
||||
SELECT sleepEachRow(184467440737095516) from numbers(10000); -- { serverError BAD_ARGUMENTS }
|
||||
SELECT sleepEachRow(pow(2, 31)) from numbers(9007199254740992) settings function_sleep_max_microseconds_per_block = 8589934592000000000; -- { serverError TOO_SLOW }
|
||||
|
||||
-- Another corner case, but it requires lots of memory to run (huge block size)
|
||||
-- SELECT sleepEachRow(pow(2, 31)) from numbers(17179869184) settings max_block_size = 17179869184, function_sleep_max_microseconds_per_block = 8589934592000000000; -- { serverError TOO_SLOW }
|
||||
|
Loading…
Reference in New Issue
Block a user