MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / getLimitsForStorage

Function getLimitsForStorage

src/Planner/Utils.cpp:288–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286{
287
288StreamLocalLimits getLimitsForStorage(const Settings & settings, const SelectQueryOptions & options)
289{
290 StreamLocalLimits limits;
291 limits.mode = LimitsMode::LIMITS_TOTAL;
292 limits.size_limits = SizeLimits(settings[Setting::max_rows_to_read], settings[Setting::max_bytes_to_read], settings[Setting::read_overflow_mode]);
293 limits.speed_limits.max_execution_time = settings[Setting::max_execution_time];
294 limits.timeout_overflow_mode = settings[Setting::timeout_overflow_mode];
295
296 /** Quota and minimal speed restrictions are checked on the initiating server of the request, and not on remote servers,
297 * because the initiating server has a summary of the execution of the request on all servers.
298 *
299 * But limits on data size to read and maximum execution time are reasonable to check both on initiator and
300 * additionally on each remote server, because these limits are checked per block of data processed,
301 * and remote servers may process way more blocks of data than are received by initiator.
302 *
303 * The limits to throttle maximum execution speed is also checked on all servers.
304 */
305 if (options.to_stage == QueryProcessingStage::Complete)
306 {
307 limits.speed_limits.min_execution_rps = settings[Setting::min_execution_speed];
308 limits.speed_limits.min_execution_bps = settings[Setting::min_execution_speed_bytes];
309 }
310
311 limits.speed_limits.max_execution_rps = settings[Setting::max_execution_speed];
312 limits.speed_limits.max_execution_bps = settings[Setting::max_execution_speed_bytes];
313 limits.speed_limits.timeout_before_checking_execution_speed = settings[Setting::timeout_before_checking_execution_speed];
314 limits.speed_limits.max_estimated_execution_time = settings[Setting::max_estimated_execution_time];
315
316 return limits;
317}
318
319}
320

Callers 1

buildStorageLimitsFunction · 0.70

Calls 1

SizeLimitsClass · 0.50

Tested by

no test coverage detected