-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
storage,kv: don't return errors with the WriteTooOld flag set #45102
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r1, 5 of 5 files at r2.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @andreimatei)
pkg/kv/txn_interceptor_span_refresher.go, line 387 at r2 (raw file):
} func (sr *txnSpanRefresher) sendHelper(
What is the point of this?
PR cockroachdb#44507 has left an unnecessary check in place. The check tolerates requests with the WriteTooOld flag set for leaf txn, even though the same commit makes sure that leaves reset that flag. Release note: None
The span refresher interceptor is supposed to terminate the txn.WriteTooOld flag. For that, it asserts that the request doesn't not have that flag set on it; only responses should have it. There was, however, a case where terminating the flag was not happening as intended: when a non-retriable error was coming back with the WriteTooOld flag set, the flag made its way into the client's txn, slipping past the interceptor. This was causing further requests to fail the aforementioned assertion. (Since errors are at play here, the only further request should be a Rollback). This patch fixes this by having servers never return errors with this flag set. Setting this flag on an error does not make sense anyway. Touches cockroachdb#40786 Release note: None
Release note: None
5c8b219
to
189151d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors r+
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @nvanbenschoten)
pkg/kv/txn_interceptor_span_refresher.go, line 387 at r2 (raw file):
Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
What is the point of this?
apparently none. Removed in the next commit.
45102: storage,kv: don't return errors with the WriteTooOld flag set r=andreimatei a=andreimatei The span refresher interceptor is supposed to terminate the txn.WriteTooOld flag. For that, it asserts that the request doesn't not have that flag set on it; only responses should have it. There was, however, a case where terminating the flag was not happening as intended: when a non-retriable error was coming back with the WriteTooOld flag set, the flag made its way into the client's txn, slipping past the interceptor. This was causing further requests to fail the aforementioned assertion. (Since errors are at play here, the only further request should be a Rollback). This patch fixes this by having servers never return errors with this flag set. Setting this flag on an error does not make sense anyway. Touches #40786 Release note: None Co-authored-by: Andrei Matei <andrei@cockroachlabs.com>
Build succeeded |
The span refresher interceptor is supposed to terminate the
txn.WriteTooOld flag. For that, it asserts that the request doesn't not
have that flag set on it; only responses should have it. There was,
however, a case where terminating the flag was not happening as
intended: when a non-retriable error was coming back with the
WriteTooOld flag set, the flag made its way into the client's txn,
slipping past the interceptor. This was causing further requests to fail
the aforementioned assertion. (Since errors are at play here, the only
further request should be a Rollback).
This patch fixes this by having servers never return errors with this
flag set. Setting this flag on an error does not make sense anyway.
Touches #40786
Release note: None