Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions docs/Failover.md
Original file line number Diff line number Diff line change
Expand Up @@ -1103,9 +1103,14 @@ public sealed class ReadOnlyOnlyRetryPolicy : RetryPolicy
{
public override RetryResult CanRetry(in FaultContext fault)
{
// only ever retry pure reads, and only on the same server
// only ever retry read-only (or safer) commands, and only on the same server;
// the retry category is a small numeric field inside CommandFlags, not a set of
// independent bits, so mask the whole field (CommandRetryNever spans it) and
// compare, rather than testing a single category value with "& != 0"
var category = fault.Flags & CommandFlags.CommandRetryNever;
if (fault.ErrorKind == RedisErrorKind.Loading
&& (fault.Flags & CommandFlags.CommandRetryReadOnly) != 0)
&& category != 0 // uncategorised commands are never retried
&& category <= CommandFlags.CommandRetryReadOnly)
{
return RetryResult.SameServer;
}
Expand Down
Loading