Skip to content

Commit

Permalink
region/client: send request timeout to HBase
Browse files Browse the repository at this point in the history
TODO:
- how to write a test for this?
- what exception is returned?
- are we guaranteed to get a reply if the request timeout?
- what if the requests is dropped from the queue?
  • Loading branch information
dethi committed Mar 21, 2023
1 parent 32035e9 commit 047c083
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions region/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,12 @@ func (c *client) send(rpc hrpc.Call) (uint32, error) {
RequestParam: proto.Bool(true),
}

deadline, ok := rpc.Context().Deadline()
if ok {
timeout := deadline.Sub(time.Now()).Abs()
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

0 comments on commit 047c083

Please sign in to comment.