Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kv: refresh less and retry more #44661

Merged
merged 1 commit into from
Feb 10, 2020

Commits on Feb 10, 2020

  1. kv: refresh less and retry more

    Before this patch, when the DistSender would split a batch into multiple
    sub-batches and one of the sub-batches fails, it would collect responses
    for the successful ones and return them together with the error. This
    used to be pretty important before we had write idempotency, because it
    allowed the span refresher to only retry an EndTxn without also retring
    other writes in that batch (which would have failed).
    
    Since we've gotten idempotency in the meantime, we can retry those other
    writes. In fact, it's arguably better to do it: there's a tradeoff
    between refreshing and retrying. Currently the span refresher needs to
    refresh the read spans of the successful sub-batches, which refresh is
    at risk of failing under contention.
    
    This patch makes the span refresher retry the whole batch without
    considering partial successes. With this patch, refreshing the partial
    successes is no longer needed because we'll retry those requests. In
    other words, we'll refresh less and retry more.
    
    The existing policy of refreshing more and retrying less will start to be
    applied inconsistenly with cockroachdb#44654, where we start refreshing when the
    client sees a WriteTooOld flag - but we're forced to refresh the whole
    batch.
    
    Besides the rationalizations above, this patch allows us to simplify
    code by not having to deal with both responses and errors. We can thus
    get rid of the enthralling comment on the client.Sender.Send() stating:
    "
    // The contract about whether both a response and an error can be
    // returned varies between layers.
    "
    
    Release note: None
    andreimatei committed Feb 10, 2020
    Configuration menu
    Copy the full SHA
    dc3e0b3 View commit details
    Browse the repository at this point in the history