IProfilingBlockInputStream: check limits before reading block

This makes one pointless check before the first block is read, but
is necessary to prevent reading blocks from storages like Kafka where
messages are read only once.
This commit is contained in:
Marek Vavruša 2017-12-22 16:30:26 -08:00 committed by alexey-milovidov
parent 90aa544573
commit ad59a1460e

View File

@ -38,6 +38,9 @@ Block IProfilingBlockInputStream::read()
if (is_cancelled.load(std::memory_order_seq_cst))
return res;
if (!checkLimits())
limit_exceeded_need_break = true;
if (!limit_exceeded_need_break)
res = readImpl();
@ -48,9 +51,6 @@ Block IProfilingBlockInputStream::read()
if (enabled_extremes)
updateExtremes(res);
if (!checkLimits())
limit_exceeded_need_break = true;
if (quota != nullptr)
checkQuota(res);
}