-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
kvserver/rangefeed: wrap muxer inside setRangeIDEventSink #126489
Conversation
This patch removes the unused field cancel from setRangeIDEventSink. Epic: none Release note: none
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @nvanbenschoten)
pkg/server/node.go
line 1841 at r2 (raw file):
Send(event *kvpb.MuxRangeFeedEvent) error SendIsThreadSafe() }
I added an interface to abstract the methods of rangefeed.StreamMuxer
. We could also just store the actual *rangefeed.StreamMuxer
here, but I thought using an interface here makes the purpose of stream muxer in this package clearer. In the future, we will start adding methods like StreamMuxer.DisconnectStreamWithError
to remove future package, but it should never need other methods like StreamMuxer.Run
. Do you think this makes sense?
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, 3 of 3 files at r2, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @wenyihu6)
pkg/server/node.go
line 1841 at r2 (raw file):
Previously, wenyihu6 (Wenyi Hu) wrote…
I added an interface to abstract the methods of
rangefeed.StreamMuxer
. We could also just store the actual*rangefeed.StreamMuxer
here, but I thought using an interface here makes the purpose of stream muxer in this package clearer. In the future, we will start adding methods likeStreamMuxer.DisconnectStreamWithError
to remove future package, but it should never need other methods likeStreamMuxer.Run
. Do you think this makes sense?
Will there be multiple implementations of this interface? If not, then I don't think the interface is buying us much beyond making the code a little harder to understand and breaking jump-to-definition.
pkg/server/node.go
line 1845 at r2 (raw file):
var _ muxer = &rangefeed.StreamMuxer{} // setRangeIDEventSink is an implementation of rangefeed.Stream which annotates
Unrelated to this change, but what do you think of this name? I keep thinking it's a function that "sets a range ID on an event sink". Any appetite to switching to something like rangeBoundEventSink
or perRangeEventSink
which makes it more clear how the type relates to the other streams?
Previously, each rangefeed stream setRangeIDEventSink wrapped the underlying muxstream to send to grpc stream. This patch changes the stream to wrap the stream muxer struct instead which itself wraps the underlying muxstream. Note that this patch doesn’t change any existing behavior but only to make future commits cleaner when we change muxer to send data to a buffered stream instead of directly to grpc. Part of: cockroachdb#126561 Release note: none
This patch renames `setRangeIDEventSink` to `perRangeEventSink` for clarity. Epic: none Release note: none
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.
Reviewable status: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @nvanbenschoten)
pkg/server/node.go
line 1841 at r2 (raw file):
Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Will there be multiple implementations of this interface? If not, then I don't think the interface is buying us much beyond making the code a little harder to understand and breaking jump-to-definition.
No, there will only be one implementation of this interface. Agree, I've removed the interface and only stored the actual struct.
pkg/server/node.go
line 1845 at r2 (raw file):
Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
Unrelated to this change, but what do you think of this name? I keep thinking it's a function that "sets a range ID on an event sink". Any appetite to switching to something like
rangeBoundEventSink
orperRangeEventSink
which makes it more clear how the type relates to the other streams?
I like perRangeEventSink
! I added another commit for this.
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 2 of 3 files at r4, 1 of 1 files at r5, all commit messages.
Reviewable status: complete! 1 of 0 LGTMs obtained (waiting on @wenyihu6)
TFTR! bors r=nvanbenschoten |
kvserver/rangefeed: remove unused cancel
This patch removes the unused field cancel from setRangeIDEventSink.
Epic: none
Release note: none
kvserver/rangefeed: wrap muxer inside setRangeIDEventSink
Previously, each rangefeed stream setRangeIDEventSink wrapped the underlying
muxstream to send to grpc stream. This patch changes the stream to wrap the
stream muxer struct instead which itself wraps the underlying muxstream.
Note that this patch doesn’t change any existing behavior but only to make
future commits cleaner when we change muxer to send data to a buffered stream
instead of directly to grpc.
Part of: #126561
Release note: none
kvserver/rangefeed: rename setRangeIDEventSink to perRangeEventSink
This patch renames
setRangeIDEventSink
toperRangeEventSink
for clarity.Epic: none
Release note: none