Repository navigation
Close redirect stats and transaction re-pin test gaps from #582 and #583 - #598
Merged
Merged
Conversation
fcostaoliveira
force-pushed
the
test/redirect-and-txn-pin-gaps
branch
2 times, most recently
from
October 14, 2026 03:00
dee525c to
8a5102a
Compare
Mutation testing during the review of #582 and #583 found faults that the merged tests did not catch. This change only touches tests. test_cluster_redirect_stats.py (#582, #579): - Check the Totals Time-Serie Count, Bytes RX and Bytes TX as well as the per-command series. Dropping m_total_cmd.update_op() in update_moved_set_op() used to pass. - Delay every terminal reply from the scripted peer by 20 ms, and check Min/Average/p50 latency and each per-second Min Latency against that delay in every mode. A zero latency on a completed redirect (for example an ASK reply with retries disabled) used to pass the default-backoff cases. - Run the success mode with a 50 ms backoff too, and require each sample to cover both backoffs. Timing the reply from the last send instead of the first (m_sent_time in client::handle_response) used to pass. - Check the final errors/retries/retried_ops progress counters on the success, refused and transaction paths. The stderr progress line is the only output that carries them. cluster_transaction_test.cpp (#583, #580): - Add a two-shard test with a populated slot map. After txn_release_pin(), the next send must re-pin to the owner of the retained lookahead key. Generating the key after it used to pass. - After releasing a pin whose round key was already consumed, check that the round key and the pin are both cleared. The existing "pin and old round key released" check runs before any round key is set, so it cannot fail. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fcostaoliveira
force-pushed
the
test/redirect-and-txn-pin-gaps
branch
from
October 14, 2026 03:02
8a5102a to
b1214ba
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.
Summary
These are follow-ups to the adversarial reviews of #582 (MOVED/ASK accounting, #579) and #583 (keeping the transaction lookahead key after a pin release, #580). Mutation testing found mutants that the merged tests did not catch. This PR only changes tests. No product code changes, and no new bug was found.
Gaps closed
Time-Seriechecks only covered the per-command entryCount,Bytes RXandBytes TXare now checked forTotals→Time-Serietoom_cur_stats.m_total_cmd.update_op(...)inupdate_moved_set_oplatency = 0on the completed path ofupdate_ask_get_optest_retried_success_latency_includes_backoff: success mode with--retry-backoff-ms=50, with a floor of 0.9 × 2 × backoffref_sent = request->m_sent_timeinstead ofm_first_sent_timeinclient::handle_response(client.cpp:830)errors / retries / retried_opsprogress counters are checked on the success, refused and transaction paths. The JSON has no such counters, so the test reads them from the stderr progress line, and a comment marks the regex as tied to that format. In transaction mode a redirected transaction is not retried, so the expected values are errors = requests, retries = 0, retried_ops = 0m_stats.inc_error()in the cluster redirect-failure pathcheck_repin_routes_to_staged_owner: two shard connections, a populated slot map, and only the staged key's slot owned by shard 1. Aftertxn_release_pin()and the next send,pin()must equal the owner of the staged key. The test also checks that the owner then consumes that keygenerate_key(staged_key_index + 1)check(!client.round_key_valid() && client.pin() == -1, ...)after the release-after-consumption stepm_txn_round_key_valid = false;intxn_release_pin()The
Ops/seczero guard, and the removal of the oldarbitrary-exclusion from the Totals redirect-rate check, come from #594 and are already on master. This PR builds on them and does not change them.In the unit test, the second shard connection dials a local listening socket. The event loop never runs, so that connection stays
conn_in_progress, which means "not disconnected". The test computes slots with an in-test CRC16 and checks it againstCLUSTER KEYSLOT foo= 12182. It also checks that the neighbouring key hashes to a different slot, so M3 really does change the routing.Evidence
Each mutant was injected into the source, rebuilt, and run against this PR's tests and against the tests on master. The mutant was reverted afterwards.
update_opdropped0 == 12Count,0 == 312Bytes RX,0 == 804Bytes TX[MOVED disabled/refused set Totals Time-Serie]latency = 0inupdate_ask_get_op0.008 >= 18.0Min,0.0 >= 18.0series Min[ASK disabled get],[ASK refused get]test_ask_redirect_statspasses (survives). Note: master'stest_exhausted_redirect_latency_includes_backoffalready catches it, but only onASK refused getwith a 50 ms backoff. The no-retry (disabled) completed path was not covered.m_sent_timeat client.cpp:83020.224 >= 90.0 [MOVED success set]generate_key(staged_key_index + 1)re-pin routes to the owner of the staged key (#580)m_txn_round_key_valid = falserelease after consumption drops pin and round keyinc_error()0 == 12 [MOVED refused set/get/arbitrary-set/arbitrary-get errors]M1–M5 were measured on master e4d14e8, before the rebases. M7 was measured on f548ae7.
On master f548ae7 (includes #594 and #601):
test_cluster_redirect_stats.pypasses 6/6 tests in each of 3 runs, about 100 s per run. The new success-backoff test adds about 20 s to Count arbitrary-command redirects in Totals MOVED/sec and ASK/sec #594's roughly 80 s for 5 tests.cluster_transaction_testpasses. Before the rebases it also passed 100/100 runs and was clean under ASan and UBSan.make format-check-stagedpasses.Against a binary built at a388a86 (before #594): the merged test file fails 5/5 tests. All 152 failure lines come from
arbitrary-*cases, and there are none forsetorget. So it catches #589 directly, for example0.0 almost equels 12 (delta 0.05) [MOVED disabled arbitrary-set]from the JSON Totals ratio check.Rebase notes
re,select) kept. On a7b9fc9 the whole file passes 9/9 tests (Send CLUSTER SLOTS after MOVED even when the pipeline is full (#590) #591's 8 plus the new success-backoff test), in about 110 s.transaction_clientincluster_transaction_test.cpp. Keepsend_from, the routing helpers (route_slot_to_second_shard,pool_empty) andskip().Refs #582, #583, #579, #580, #589, #594.
🤖 Generated with Claude Code
Note
Low Risk
Only test files change; behavior under test is unchanged and risk is limited to CI/runtime of the expanded integration suite.
Overview
Test-only follow-up to #582/#583 mutation-testing gaps. No production code changes.
test_cluster_redirect_stats.pymakes MOVED/ASK accounting stricter: the scripted peer adds a fixed 20 ms delay on every terminal reply so Min/Average/p50 (and per-second Min in Time-Serie) can be bounded for success, refused, and completed paths—not only exhausted-backoff cases. It parses the final stderr errors / retries / retried_ops line (regex-tied to progress format) for success, refused, and transaction modes. Time-SerieCount, Bytes RX/TX, and latency checks now run for Totals as well as per-command stats. Newtest_retried_success_latency_includes_backoffasserts success-after-two-redirects latency includes both backoffs (50 ms).cluster_transaction_test.cpprefactors transaction setup helpers and extendstransaction_clientwithsend_from, two-shardroute_slot_to_second_shard, and an in-test CRC16 slot helper.check_repin_routes_to_staged_ownerverifies re-pin aftertxn_release_pin()routes to the staged key’s shard owner (#580).check_pin_releaseadds an assertion that release-after-consumption clears pin and round key.Reviewed by Cursor Bugbot for commit b1214ba. Bugbot is set up for automated code reviews on this repo. Configure here.