-
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
kvstreamer: fix the usage of the range iterator #94031
Conversation
9660edd
to
18bb9b6
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.
Is there a way we can enforce the error check?
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @michae2)
6240542
to
5fabb7c
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.
We could change RangeIterator
interface so that Seek
would explicitly return an error instead of invalidating the iterator. However, that would change pretty-nice looking interface where it can be used with the for
loop. I looked over how other callers do it, and the streamer is the only one that had an issue and was deviating from the iterator pattern around the for
loop, so I just pushed a minor update to bring it more in line with others. PTAL.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @michae2)
5fabb7c
to
90f6b0f
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.
Reviewed all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @michae2 and @yuzefovich)
pkg/kv/kvclient/kvstreamer/streamer.go
line 635 at r2 (raw file):
// This was the last range. Breaking here rather than Seek'ing the // iterator to RKeyMax (and, thus, invalidating it) allows us to // avoid adding a confusingly-looking message into the trace.
[nit] confusingly-looking
-> confusing
Previously, after `Seek`ing the range iterator to the next key in the batch of requests in the streamer we forgot to check the validity of the iterator. In particular, this could lead to a crash of the process if `Seek` encountered an error for whatever reason. In practice, I've only observed this when running TPCH with high concurrency when GOMEMLIMIT is set. The bug was introduced in an innocently-looking refactor in 041b104. Epic: None Release note (bug fix): CockroachDB could previously crash in rare circumstances when evaluating lookup and index joins. The bug is present since 22.2.0 release. Temporary workaround without upgrading to the release with this fix is changing the value of undocumented cluster setting `sql.distsql.use_streamer.enabled` to `false`.
90f6b0f
to
3125bc7
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.
TFTR!
bors r+
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @DrewKimball and @michae2)
pkg/kv/kvclient/kvstreamer/streamer.go
line 635 at r2 (raw file):
Previously, DrewKimball (Drew Kimball) wrote…
[nit]
confusingly-looking
->confusing
Done.
Build succeeded: |
Previously, after
Seek
ing the range iterator to the next key in the batch of requests in the streamer we forgot to check the validity of the iterator. In particular, this could lead to a crash of the process ifSeek
encountered an error for whatever reason. In practice, I've only observed this when running TPCH with high concurrency when GOMEMLIMIT is set.The bug was introduced in an innocently-looking refactor in 041b104.
Epic: None
Release note (bug fix): CockroachDB could previously crash in rare circumstances when evaluating lookup and index joins. The bug is present since 22.2.0 release. Temporary workaround without upgrading to the release with this fix is changing the value of undocumented cluster setting
sql.distsql.use_streamer.enabled
tofalse
.