Skip to content

Fix Redis dictionary with an Int256 key silently returning the default value - #117735

Merged
PedroTadim merged 5 commits into
ClickHouse:masterfrom
protomn:fix-redis-dict-wide-int-key
Sep 5, 2026
Merged

PedroTadim merged 5 commits into
ClickHouse:masterfrom
protomn:fix-redis-dict-wide-int-key

Conversation

@protomn

@protomn protomn commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Closes: #117705
Related: #106501

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fix a dictionary with a Redis source and an Int256 key column silently returning the
default value from dictGet for keys that exist in Redis. Wide integer key columns are
now refused with a clear error instead of being admitted and never matching.

The key screens in the constructor are tightened from isInteger to isNativeInteger,
so all four wide integer types are refused consistently, with the same message for the
simple and hash_map paths. The wide-integer arm of serialize_key becomes
unreachable and is removed along with its include.


Workflow [PR]
Sync PR [sync-upstream/pr/117735]

Version info

  • Merged into: 26.9.1.736 (included in 26.9 and later)

@PedroTadim PedroTadim added the can be tested Allows running workflows for external contributors label Sep 2, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [758f86a]

Summary: ✅


AI Review

Summary

This PR narrows Redis dictionary key validation from generic integers to native integers plus String, which matches the only key encodings that RedisDictionarySource::loadKeys can actually serialize and prevents the previous silent misses for wide integer keys. The added Redis integration coverage now exercises both constructor branches (simple and hash_map), and I did not find an unresolved correctness gap in the current diff.

Missing context / blind spots
  • ⚠️ Praktika was still running while this review was written, so I did not have a completed integration-test result for the touched tests/integration/test_dictionaries_redis/test.py case. A green run of that test would close the remaining execution-evidence gap.
Final Verdict
  • Status: ✅ Approve

LLVM Coverage Report

Measured on commit 758f86a.

Metric Baseline Current Δ
Lines 88.70% 88.70% +0.00%
Functions 92.10% 92.10% +0.00%
Branches 81.10% 81.10% +0.00%

Changed lines: Changed C/C++ lines covered: 25/25 (100.00%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Sep 2, 2026
@protomn
protomn force-pushed the fix-redis-dict-wide-int-key branch from 9cd449b to cd0d038 Compare September 2, 2026 18:05
@clickhouse-gh

clickhouse-gh Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 758f86ade with master 776ca7009 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of e31d3cafb; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Slowest function optimization changes (ThinLTO)

Median per-function time ratio to the master baseline: programs/clickhouse ×0.79, programs/clickhouse-keeper ×2.12 (each binary is linked separately, on a different machine and with different build flags); deltas below are relative to it.

Binary Function Master PR Δ vs median
programs/clickhouse DB::registerFunctionConversion(DB::FunctionFactory&) 7.0 s 12.3 s +6.7 s (+121%)
Compile time of recompiled translation units

7 translation units recompiled, 11 s compile time in total, 7 of them have a recent master baseline.

Job report

@PedroTadim PedroTadim self-assigned this Sep 3, 2026
@PedroTadim

Copy link
Copy Markdown
Member

@protomn merge one more time with master.

@PedroTadim
PedroTadim enabled auto-merge September 3, 2026 13:47
@PedroTadim

Copy link
Copy Markdown
Member

@protomn you should have merged with master, we have been fixing flaky tests.

@clickhouse-gh clickhouse-gh Bot added the comp-foreign-db Connectivity to external databases (ODBC/JDBC, MySQL, PostgreSQL, etc.). label Sep 4, 2026
@PedroTadim
PedroTadim added this pull request to the merge queue Sep 4, 2026
Merged via the queue into ClickHouse:master with commit 9b2537d Sep 5, 2026
175 checks passed
@protomn
protomn deleted the fix-redis-dict-wide-int-key branch September 5, 2026 00:04
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 5, 2026
@clickgapai

Copy link
Copy Markdown
Contributor
Reproducer
-- Redis: HSET 123456 x v1
CREATE DICTIONARY hm_wide (k1 Int256, k2 String, value String)
PRIMARY KEY k1, k2
SOURCE(REDIS(HOST '127.0.0.1' PORT 6379 STORAGE_TYPE 'hash_map'))
LAYOUT(COMPLEX_KEY_DIRECT());

SELECT dictGet('hm_wide', 'value', tuple(toInt256(123456), 'x'));
-- 26.6/26.7/26.8: returns '' (default). Redis receives `HMGET '123456' x` - the
--   key is quoted by FieldVisitorToString, so it never matches.
-- 26.3: throws `Unsupported type Int256` (UNKNOWN_TYPE) - no silent default.
-- master (post-#117735): throws `supports only native integer or string key`.
-- Same defect on STORAGE_TYPE 'simple' with a single Int256 key on 26.6+.

Results:

  • Reproduces on: 26.8, 26.7, 26.6
  • Does not reproduce on: 26.3
  • Tested versions: master, 26.8, 26.7, 26.6, 26.3
  • Also tested (unsupported, context only): 26.2 clean
  • Fix merged on master (not re-verified: tested master build predates this PR's merge — a clean verdict is not attributable to the fix). The releases listed above still have the bug and need the backport.

Backport the fix to 26.8, 26.7, 26.6.

CC component owner: @alexey-milovidov @kssenii

Analysis metadata

comp-foreign-db · Severity P2 · Finding phase_d_pr117735

  • Verified against master build dab9efce85ab (aarch64)
  • Could not test: master
Introducing change: not identified
  • Secondary components: comp-testing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-foreign-db Connectivity to external databases (ODBC/JDBC, MySQL, PostgreSQL, etc.). pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Redis dictionary with an Int256 key silently returns the default for keys that exist (lookup key is sent with quote characters)

4 participants