Repository navigation
fix(miss-tracking): enable arbitrary-command miss tracking on cluster shard connections - #477
Merged
Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fdcf987. Configure here.
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
fcostaoliveira
force-pushed
the
fix/issue-476-cluster-misstracking
branch
from
June 17, 2026 01:20
fdcf987 to
9800297
Compare
… shard connections Arbitrary-command per-element miss tracking (set_track_elem_misses) was applied in setup_client() only to the connections that exist at setup time. In OSS cluster mode the per-shard connections are created later, during cluster-slots discovery (cluster_client::create_shard_connection), and the shard_connection ctor clones its protocol via clone(), which resets runtime flags to defaults. Those late-created connections therefore started with miss tracking cleared, so only requests routed to the seed connection's shard were accounted -- roughly 1/num_shards coverage -- and the rest were silently dropped from the per-key miss stats. (issue #476, follow-up to RED-200840.) Factor the tracking-flag decision into client::apply_arbitrary_tracking_flags() and a cached m_arbitrary_needs_elem_tracking flag, computed once in setup_client(). Apply it to each connection in setup_client() and, crucially, to every shard connection created in cluster_client::create_shard_connection(). Verified against a live 3-shard OSS cluster (HMGET, 4 fields): before, only ~38% of reply positions were accounted (the seed shard's share); after, 100% are accounted, with per-position hit/miss semantics unchanged. Standalone is unaffected (single connection always carried the flag). Adds test_arbitrary_hmget_full_coverage_cluster_and_standalone, which does not skipOnCluster and asserts full per-position coverage in both topologies; it fails on cluster before this fix and passes after. Co-Authored-By: Claude Opus 4.8 <[email protected]>
fcostaoliveira
force-pushed
the
fix/issue-476-cluster-misstracking
branch
from
June 17, 2026 01:41
9800297 to
320e07b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #476. Follow-up to the RED-200840 miss-tracking work (#469, #472).
Problem
Arbitrary-command per-element miss tracking (
set_track_elem_misses) was applied insetup_client()only to the connections that exist at setup time. In OSS cluster mode the per-shard connections are created later, during cluster-slots discovery (cluster_client::create_shard_connection), and theshard_connectionctor clones its protocol viaclone()— which resets runtime flags to defaults. Those late-created connections started with miss tracking cleared, so only requests routed to the seed connection's shard were accounted (~1/num_shards coverage); the rest were silently dropped from the per-key miss stats.Fix
Factor the tracking-flag decision into
client::apply_arbitrary_tracking_flags()plus a cachedm_arbitrary_needs_elem_trackingflag computed once insetup_client(). Apply it to each connection insetup_client()and, crucially, to every shard connection created incluster_client::create_shard_connection().Verification
Against a live 3-shard OSS cluster (
--cluster-mode, HMGET with 4 fields, 800 ops):Per-position hit/miss semantics unchanged (f0/f1/f2 present → hits; absent field → 100% miss in its bucket). Standalone is unaffected (its single connection always carried the flag).
Adds
test_arbitrary_hmget_full_coverage_cluster_and_standalone, which does notskipOnClusterand asserts full per-position coverage in both topologies — it fails on cluster before this fix and passes after.🤖 Generated with Claude Code
Co-Authored-By: Claude Opus 4.8 [email protected]
Note
Medium Risk
Changes cluster connection setup and protocol flags for miss accounting; behavior is localized and covered by a cluster+standalone regression test, but incorrect flag application would skew benchmark miss metrics.
Overview
Fixes issue #476: in OSS cluster mode, per-element arbitrary-command miss tracking (
set_track_elem_misses) was only applied to connections that existed duringsetup_client(). Shard connections created later viacluster_client::create_shard_connection()get a fresh protocol fromclone(), so the tracking flag stayed off and ~1/num_shards of HMGET/MGET-style traffic was missing from per-key miss stats.The PR caches whether any configured command needs ArrayPerElementNulls tracking in
m_arbitrary_needs_elem_tracking, centralizes application inapply_arbitrary_tracking_flags(), and calls it fromsetup_client()andcreate_shard_connection()so every shard connection gets the flag.Adds
test_arbitrary_hmget_full_coverage_cluster_and_standalone, which runs in cluster and standalone and asserts total hits+misses equals requests × clients × fields (fails on cluster before the fix).Reviewed by Cursor Bugbot for commit 320e07b. Bugbot is set up for automated code reviews on this repo. Configure here.