Repository navigation
Enable throttling of lookups for YTsaurus dictionaries - #100044
Conversation
|
Workflow [PR], commit [b9d1c6c] Summary: ✅
AI ReviewSummaryThis PR adds dictionary-only YTsaurus lookup controls ( Final Verdict
LLVM Coverage ReportMeasured on commit b9d1c6c.
Changed lines: Changed C/C++ lines covered: 45/250 (18.00%) · Uncovered code |
|
@MikhailBurdukov, Looks all green. Please address the review comments or answer to them. |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes9 object files changed (+72.51 KiB total), 0 added.
719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units13 translation units recompiled, 40 s compile time in total, 13 of them have a recent master baseline. Symbol sizes
|
Criss-cross merge (two merge bases) produced ~300 spurious conflicts. Resolved by taking `master` verbatim for every file the PR does not touch and re-merging `YTsaurusSource.cpp` and the YTsaurus dictionary source doc against the real base. The doc page is now autogenerated, so the two new setting rows moved into the `Documentation` block of `registerDictionarySourceYTsaurus` instead of the `.mdx`.
The two-merge-base merge silently removed the `contrib/NuRaft`, `contrib/aws-c-http`, `contrib/chdig` and `contrib/llvm-project` gitlinks without reporting a conflict. Restored them to the `master` revisions. Also change the default of `lookup_max_rows_per_query` to `0`.
\`lookup_max_rows_per_query\` defaulted to \`1024\`, which silently changed the behaviour of every existing dynamic cache dictionary: \`CacheDictionary\` forwards the whole unique-miss set to \`loadIds\` / \`loadKeys\`, so a single cache update turned into \`ceil(N / 1024)\` YTsaurus lookup requests on the hot miss path without any opt-in. The default is now \`0\` (unlimited): a selective load is sent as one request, exactly as before this pull request, and chunking is opt-in. Added \`test_yt_lookups_default_chunk_size_is_unlimited\`, which pins the default by asserting that a four-key miss under a one-request-per-second throttler never blocks - a chunked load would. (The previous commit message mentions this change; it only restored the submodule gitlinks.)
|
🕵 Continued this PR: resolved the criss-cross merge conflict with Resolved the
Addressed the AI Review Verified locally (aarch64, CI re-runs on the new head. No other unresolved review threads. |
…proxy failover retries `lookup_throttler_max_requests_per_second` is documented as a cap on `lookup_rows` requests sent to YTsaurus, but the token was consumed once in `YTsaurusClient::lookupRows`, before `executeQuery` iterated over `http_proxy_urls`. When the first proxy failed, the fallback attempts against the other proxies were sent without paying for them, so one logical selective load could exceed the configured rate and `YTsaurusLookupThrottled` was undercounted exactly in the degraded-proxy case. `executeQuery` now takes an optional throttler and consumes a token right before each real HTTP attempt inside the retry loop; `lookupRows` passes the lookup throttler down. Other query kinds keep passing no throttler. Adds `test_yt_lookups_throttler_proxy_failover` (dead proxy listed first, 1 request per second, one row per request) asserting that the load still succeeds and that `YTsaurusLookupThrottled` grows.
|
🕵 Continued this PR: resolved the Merged Addressed the AI Review finding ( Verified locally: all YTsaurus translation units and the gtest translation unit compile (RelWithDebInfo). The previous head |
…uffer` The declaration of `YTsaurusClient::createQueryRWBuffer` has a double space after the first comma. It is pre-existing, but the `whitespace_check` style check only reports such a line when neither neighbouring line looks like column alignment at that position, and the `request_throttler` comment added by this pull request removed that accidental exemption, so the check started failing. Also write the reference parameters as `const URI & uri` / `const ReadWriteBufferFromHTTP::OutStreamCallback & out_callback`, matching the surrounding code.
|
🕵 Fixed the only CI failure and refreshed the branch — new head
The double space after the first comma is pre-existing (it is on Also merged current The remaining review thread on |
…he pre-fix code Both tests were flagged by the AI review as passing on the behaviour they claim to catch. `test_yt_lookups_throttler_proxy_failover` used `lookup_max_rows_per_query = 1`, so three misses already made three logical lookups and `YTsaurusLookupThrottled` grew with the old per-logical-lookup throttling too. A permanently dead first proxy cannot exercise the per-attempt path at all: the node type `get` issued by `createPipe` before every selective load already fails over and moves `recently_used_url_index` to the healthy proxy. The test now points the first proxy at the ClickHouse HTTP port, configured by the new `fake_yt_proxy_http_handlers.xml` to answer `/api/v3/get` with dynamic-table attributes and to reject `/api/v3/lookup_rows` with a non-retriable `404`. With `lookup_max_rows_per_query = 0`, `use_lock = 0` and `check_table_schema = 0` the whole miss set is one logical lookup whose first attempt fails instantly and is retried against the real proxy. The test asserts exactly two `lookup_rows` attempts in `system.text_log` and exactly one blocked request, which only the retry attempt can have paid for. `test_yt_lookups_default_chunk_size_is_unlimited` used four keys, which also fit into one request under the earlier `1024` default. It now looks up 1100 keys and asserts exactly one `lookup_rows` attempt in `system.text_log` and no blocked request; under a `1024` default the load would take two requests and the second would block. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
🕵 Addressed both open AI Review findings and refreshed the branch. New head `e8509baa3da7`.
The fake proxy handler config was verified on a local server (`get` returns the JSON with 200, `lookup_rows` returns 404, regular queries unaffected). The integration test module itself is amd64-only and could not be run on this aarch64 machine, so CI is the first real run of the rewritten tests. |
… in `SETTINGS` `YTsaurusSettings::loadFromQuery` rejected `lookup_throttler_max_requests_per_second` and `lookup_max_rows_per_query` only when `isChanged` was true, i.e. when the final value differed from the default. Setting them to their default values on the `YTsaurus` table engine or the `ytsaurus` table function was still silently accepted. Check the names in `settings_def.changes` instead, and extend the test with default-valued forms. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e fake proxy `lookup_rows` is a heavy query, and `enable_heavy_proxy_redirection` is on by default, so before the `lookup_rows` attempt the client requests `/hosts` from the fake proxy. The fake proxy answered it with `404`, so the client failed over before logging the `lookup_rows` attempt, and the test saw one attempt instead of two. The fake proxy now names itself in `/hosts`. The leftover `//tmp/table` of the failed test also broke the next tests (`test_yt_lookups_default_chunk_size_is_unlimited`, `test_yt_lookups_unlimited_chunk_size`). Also split a line with two statements in `YTsaurusSourceFactory::createPipe`. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=100044&sha=18b03fb805c127fef2ad880c1de281054cb604b6&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20targeted%29 ClickHouse#100044 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 Merged
Verified locally: the build passes and the stateless test passes with |
Two options were added(lookup_throttler_max_requests_per_second and lookup_max_rows_per_query) in order to control the number of lookups queries to fetch data from ytsaurus
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Enable throttling of lookups for YTsaurus dictionaries.
Documentation entry for user-facing changes
Workflow [PR]
Sync PR [sync-upstream/pr/100044]
Version info
26.10.1.2170-master(included in26.10and later)