-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Remote shard mapping over TCP #3376
Conversation
@@ -26,13 +26,13 @@ func (a mapperValues) Len() int { return len(a) } | |||
func (a mapperValues) Less(i, j int) bool { return a[i].Time < a[j].Time } | |||
func (a mapperValues) Swap(i, j int) { a[i], a[j] = a[j], a[i] } | |||
|
|||
type mapperOutput struct { | |||
type MapperOutput struct { |
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.
Simply exporting this type, no other changes.
813ad49
to
ab53bdc
Compare
err := s.processMapShardRequest(conn, buf) | ||
if err != nil { | ||
s.Logger.Printf("process map shard error: %s", err) | ||
_ = writeMapShardResponseMessage(conn, NewMapShardResponse(1, err.Error())) |
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.
Error ignored. Should at least log it.
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.
Makes sense.
A few small things but 👍 after they're fixed. |
Thanks for the feedback @jwilder |
With this change remote mapping no longer uses HTTP, as the HTTP ports exposed by nodes on the cluster are not known cluster wide. The TCP ports exposed by the cluster service are, so this change uses that functionality. Each RemoteMapper has its own dedicated connection pool for each node, and remote mapping TCP connections are in no way coupled with query TCP connections.
This is useful primarily for testing.
b28f268
to
10eecb4
Compare
OK, I believe I addressed all comments, merging now |
@jwilder - I just realised I merged the protobuf changes that you pointed out. I did not mean to do that. I meant to handle that in a separate PR, as you requested. |
With this change remote mapping no longer uses HTTP, as the HTTP ports exposed by nodes on the cluster are not known cluster wide. The TCP ports exposed by the cluster service are, so this change uses that functionality. Each RemoteMapper has its own dedicated connection pool for each node, and remote mapping TCP connections are in no way coupled with query TCP connections.
It is not clear to me if this will be part of 0.9.2, so I have left the CHANGELOG untouched for now.
I tested this code by forcing all mapping to take place over the network, spun up a single node, and performed some queries. This meant shard mapping actually took place over localhost. The returned data looked good.
The structure is as follows.
ShardMapper
for 1 or more shards. This takes place on the Co-ordinator node.ShardMapper
returns an object implementing theMapper
interface.RemoteMapper
.RemoteMapper
connects to the target node, sending the shard ID and query to the remote node.RemoteMapper
decode results and presents them to the query engine.