[#185] Control timeout of tree service operations #290
No reviewers
Labels
No labels
P0
P1
P2
P3
good first issue
pool
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
5 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-sdk-go#290
Loading…
Reference in a new issue
No description provided.
Delete branch "nzinkevich/frostfs-sdk-go:tree_request_timeout"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implemented context timeout for all tree service operations except those that return a gRPC stream
Signed-off-by: Nikita Zinkevich n.zinkevich@yadro.com
ce086fc234
to16a4c016fe
@ -490,3 +498,3 @@
var resp *grpcService.AddResponse
err := p.requestWithRetry(ctx, func(client grpcService.TreeServiceClient) (inErr error) {
resp, inErr = client.Add(ctx, request)
reqCtx, cancel := getTimeoutContext(ctx, p.connTimeout)
Why don't invoke this function inside
p.requestWithRetry
?GetSubTree should be ignored, because it returns a stream to the client. If I create a timeout context for this operation, it will not only cancel the method call, but it will also close the stream, which is using the same context
I meant:
In that case all treeService methods which use requestWithRetry will have timeout, but getSubTree shouldn't have it.
Oh, I see. Ok
16a4c016fe
to00eb080f50
@ -66,6 +66,7 @@ type InitParameters struct {
logger *zap.Logger
nodeDialTimeout time.Duration
nodeStreamTimeout time.Duration
connTimeout time.Duration
We should add default value for this param in
fillDefaultInitParams
@ -66,6 +66,7 @@ type InitParameters struct {
logger *zap.Logger
nodeDialTimeout time.Duration
nodeStreamTimeout time.Duration
I am a bit out of loop: for unary RPC, isn't
nodeStreamTimeout
what we need?In that case this value cannot be made small enough compared to the rebalance interval, because this value also tunes streaming.
And I think it would be less surprising from the component configuration perspective to set separate parameters for that.
Stream timeout on the API level is in fact a timeout to send 1 RPC message (oneshot or inside a stream).
Then it's okay to use
nodeStreamTimeout
if it works this way00eb080f50
to55f5409203
LGTM,
But is it possible to add some tests?
Let's get a bit deeper in this PR.
streamTimeout
now controls timeout for unary gRPC operations. However there are stream operations too, e.g.GetSubTree
. Stream is a set of messages, and gRPC allows to set timeout for whole stream. We would like to control timeouts for every message in a stream.I want you to check api/rpc/client package. This package re-implements client methods by using RPC client from
api/rpc/client
package.This packages defines read/write wrappers, that control timeout for every single message transmission.
I suggest you to keep this commit and try to add tree service implementation in
api/rpc
package the same way other services are defined there.With @nzinkevich we've decided to approach stream timeouts later in separate issue, because it may be a big diff. Let's keep it separate.
api/rpc
#295