Repository navigation
docs: fix retry-category test in the custom RetryPolicy sample - #3265
Merged
Merged
Conversation
The ReadOnlyOnlyRetryPolicy sample in Failover.md tested the category with (fault.Flags & CommandFlags.CommandRetryReadOnly) != 0. The retry category is a 5-bit numeric field (CommandRetryNever spans it), not independent bits, so that test is also true for CommandRetryWriteChecked, CommandRetryServerAdmin and CommandRetryNever. Mask the whole field and compare instead.
mgravell
added a commit
that referenced
this pull request
Oct 8, 2026
…ER010 (#3248), RetryPolicy doc fix (#3265) Conflicts, resolved in v4 terms: - Directory.Build.props: main retired SER010 from NoWarn; v4 had retired SER013 and still suppresses SER012 and SER014. NoWarn is v4's list without SER010, and the comment names all eight retired IDs (SER011 stays deliberately unsuppressed). - src/RESPite/Shared/Experiments.cs: both retirements recorded - main's SER010 line (MaintenanceNotifications) and v4's SER013 note, whose renumbering explanation now says SER010 has since retired too. The MaintenanceNotifications constant goes, as on main; nothing in v4's own code used it. - src/StackExchange.Redis/PublicAPI/PublicAPI.Unshipped.txt: union of both sides (main's three provider overrides return to Unshipped), then eng/public-api.py sorted it - and RESPite's Unshipped file, which was already out of order on v4. Everything else merged cleanly. Build clean with analyzers on every TFM; RESPite tests pass; main suite net10.0 and net8.0 pass apart from known flakes, plus one unreproduced QueuedResultTests failure noted in the ledger's watch list.
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.
The
ReadOnlyOnlyRetryPolicysample under "Custom Retry Policies" indocs/Failover.mdtests the command's retry category with:The retry category is a 5-bit numeric field inside
CommandFlags(CommandRetryNever = 31 << 13spans it), not a set of independent bits.CommandRetryReadOnlyis8 << 13, and that bit is also set inCommandRetryWriteChecked(12),CommandRetryServerAdmin(24) andCommandRetryNever(31). Read literally, the sample would retry checked writes, server admin commands and commands explicitly marked never-retry, while correctly excluding last-wins and accumulating writes.This PR changes the sample to mask the whole field and compare, matching what the library does internally:
Docs only, no code change.
Possible follow-up (not in this PR):
FaultContextexposesFlagsbut no category accessor, so every custom policy has to know the masking trick. A public helper (e.g.FaultContext.RetryCategory, or an extension onCommandFlags) would remove the footgun;Message.GetRetryCategoryalready exists internally.