Repository navigation
Count arbitrary-command redirects in Totals MOVED/sec and ASK/sec - #594
Merged
Merged
Conversation
summarize() built the Totals redirect rates from the SET and GET counters only, while ops, bytes and latency in the same function also include m_ar_commands. In cluster mode with --command, Totals MOVED/sec and ASK/sec were therefore always 0.00 in the text table, the JSON Totals and the --run-count AVERAGE, while the per-command rows showed the redirects. Read the rates from m_total_cmd instead. Every redirect path already increments m_total_cmd next to the per-command counter, and it is what the Totals time series is built from. test_cluster_redirect_stats.py skipped the Totals rate check for arbitrary commands to work around this; check it for every command now. Fixes #589 Co-Authored-By: Claude Opus 5.5 <[email protected]>
The JSON ALL STATS check alone missed two regressions: dropping the m_moved_sec/m_ask_sec average in aggregate_average(), and printing the text Totals cell from the SET + GET rates again. Add a --run-count=2 case that checks the AGGREGATED AVERAGE Totals MOVED/sec and ASK/sec against the command row and the known redirects per request, and check in every case that the text Totals row matches the command row with a non-zero rate. A zero Ops/sec is now reported as a failure instead of raising, so the remaining cases still run. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira
force-pushed
the
fix/totals-redirects-arbitrary
branch
from
October 14, 2026 01:21
564a37f to
6585ca3
Compare
This was referenced Oct 14, 2026
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.
Problem
In
--cluster-modewith--command, theTotalsrow reportsMOVED/secandASK/secas 0.00 while the per-command rows show redirects. This affects the text table, the JSONTotalsobject and the--run-countAGGREGATED AVERAGE Totals.Root cause
run_stats::summarize()computed the Totals redirect rates fromm_set_cmd+m_get_cmdonly. Ops, bytes and latency in the same function also includem_ar_commands, but the redirect rates did not.aggregate_average()averages the per-runsummarize()results, so the AVERAGE Totals inherited the 0.Fix
Read the Totals rates from
m_total_cmd.m_moved/m_ask. Every redirect path (update_moved_{get,set,arbitrary}_op,update_ask_*) already incrementsm_total_cmdnext to the per-command counter, andm_total_cmdis also what the Totals time series is built from. For the default SET/GET workload the value is unchanged (WAIT never redirects).tests/test_cluster_redirect_stats.pyskipped the Totals rate check forarbitrary-*commands to work around this bug. The workaround is removed, so Totals is now checked for every command, redirect type and retry mode.Other outputs checked: the JSON
Time-Serieentries carry no MOVED/ASK fields, so they have no such gap. The--client-statsCSV has a per-second cluster section only for the default workload, so with--commandit has no redirect data at all. That is a separate missing feature and is not changed here.Test evidence
test_cluster_redirect_stats.pyuses a scripted RESP peer, so the results are deterministic. Totals is now checked in three places:ALL STATSTotals, for every command, redirect type and retry mode;Totalsrow, which must match the command row and be non-zero;--run-count=2case: theAGGREGATED AVERAGE RESULTS (2 runs)Totals MOVED/sec and ASK/sec must equal the command row, and redirects per op must equal the known count.A zero Ops/sec is reported as a failure instead of raising, so the remaining cases still run.
0.00vs the command row, JSON and text)m_totals.m_moved_sec /= all_stats.size()deletedtest_run_count_average_redirect_statsFAILS (AVERAGE Totals1052.60vs526.30, redirects per op 4.0 vs 2)m_set_cmd + m_get_cmd0.00vs37.65for--command; the ASK-only test passes, as expected)Manual run against the same peer (
--command="SET __key__ value", 24 MOVED replies):Fixes #589
Affected versions
2.0.0 through 2.5.2 (latest) and master. Introduced by 1c6735f (#117), first tag 2.0.0. Confirmed by running on 2.0.0, 2.4.0, 2.5.2 and master e4d14e8. 2.1.0–2.3.1, 2.4.1–2.4.4 and 2.5.0–2.5.1 are derived from history.
🤖 Generated with Claude Code