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

region/client: send request timeout to HBase #215

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions region/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,15 @@ func (c *client) send(rpc hrpc.Call) (uint32, error) {
RequestParam: proto.Bool(true),
}

deadline, ok := rpc.Context().Deadline()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't going to work for requests sent in multi's, ie. all mutate requests, since a multi's Context() method just returns context.Background().

Maybe you don't care about that case. Just wanted to raise it in case you weren't aware. If you did want it to work for multi's you'd probably have to find the latest Deadline among the requests and use that as your timeout.

if ok {
// Timeout shouldn't be negative, as we just tested the .Done() channel before entering this
// function. But if this happen, it's okay, the cast to uint32 will give us a big timeout
// value.
timeout := time.Until(deadline)
header.Timeout = proto.Uint32(uint32(timeout.Milliseconds()))
}

if s, ok := rpc.(canSerializeCellBlocks); ok && s.CellBlocksEnabled() {
// request can be serialized to cellblocks
request, cellblocks, cellblocksLen = s.SerializeCellBlocks()
Expand Down