URL table function does not heed input_format_max_block_wait_ms
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
Research direction
Start with ReadWriteBufferFromHTTP and ReadBuffer::poll(), then trace how IRowInputFormat::read() and FormatFactory::getInputImpl() handle input_format_max_block_wait_ms for URL reads. Reproduce the behavior with a bursty URL producer and verify that the setting affects waiting without introducing the reported configuration error.
Written by the indexing model from the issue text.
Description
Company or project name
eventus
Describe the unexpected behaviour
The input_format_max_block_wait_ms does not seem to work with the URL table function. I have tested in version 26.3. Here's what the AI has to say about my findings...
==================================================================================
streaming-inserts work (PR #94509 (https://github.com/ClickHouse/ClickHouse/pull/94509)). The mechanism lives in IRowInputFormat::read():
if (max_block_wait_ms != 0 && num_rows > 0)
{
UInt64 elapsed_ms = watch.elapsedMilliseconds();
if (elapsed_ms >= max_block_wait_ms)
break;
UInt64 remaining_us = (max_block_wait_ms - elapsed_ms) * 1000;
if (!getReadBuffer().poll(remaining_us)) // <-- the load-bearing call
break;
}
So the timeout cut depends on ReadBuffer::poll() reporting readiness. The base implementation is:
virtual bool poll(size_t /* timeout_microseconds */) { return true; }
Why url() misses out. ReadBufferFromPocoSocketBase — the server reading an INSERT off the client connection — overrides poll(). ReadWriteBufferFromHTTP, which is what url() reads through, does not; it overrides nextImpl, seek, readBigAt, setReadUntilPosition, etc., but no poll. So for url(), poll() returns true instantly, the parser goes straight into reading the next row, and that call blocks on the socket until bytes arrive. The timeout can never interrupt a wait — it can only trim a block between rows that are already arriving, which is exactly the case where you didn't need it.
Two more gates:
- FormatFactory::getInputImpl() throws BAD_ARGUMENTS if input_format_max_block_wait_ms > 0 without input_format_connection_handling. Setting it on a SELECT ... FROM url(...) alone is an error, not a silent ignore.
- connection_handling forces parallel_parsing = false. For a url() read that's a straight pessimization with no compensating benefit.
And it's IRowInputFormat only — url(..., Parquet), Native, ORC etc. never touch this code path regardless.
Sources:
- Format settings — input_format_max_block_wait_ms (https://clickhouse.com/docs/reference/settings/formats/input-format)
- ClickHouse 26.2 release blog — streaming inserts (https://clickhouse.com/blog/clickhouse-release-26-02)
- PR #94509 — Streaming inserts (https://github.com/ClickHouse/ClickHouse/pull/94509)
How to reproduce
Use the URL table function with a producer that is bursty.
Expected behavior
Have input_format_max_block_wait_ms affect the URL table function.
Error message and/or stacktrace
No response
Additional context
No response
- Dominant language
- C++
- Stars
- 50k
- Forks
- 9k
- Avg merge
- 18h 29m
- Merged PRs (30d)
- 511
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ClickHouse/ClickHouse
-
comp-datalake
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121222 ·
-
comp-sql-syntax minor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ClickHouse/ClickHouse#121170 ·
-
comp-sql-syntax
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/ClickHouse#121150 ·
-
comp-sql-syntax fuzz
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ClickHouse/ClickHouse#121027 · 2 comments ·
-
comp-sql-syntax fuzz
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
ClickHouse/ClickHouse#121025 · 2 comments ·
All issues in ClickHouse/ClickHouse
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Sensor initialization takes very long when `--initial-sim-time` is set to current UNIX timestamp Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
gazebosim/gz-sensors#662 · 1 comment ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
LadybirdBrowser/ladybird#12123 ·
-
[adam] AdamNet network read doesn't cap to MAX_ADAM_PACKET_LEN, overflows client receive buffers Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
FujiNetWIFI/fujinet-firmware#1649 · 2 comments ·