-
Notifications
You must be signed in to change notification settings - Fork 351
Add an option for determine read/write timeout for namenodes #245
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
base: master
Are you sure you want to change the base?
Conversation
Hi @kimtree, thanks for the suggestion. I think this may be the simplest way to solve the problem, but I've also been considering adding |
Hi @colinmarc, It's good to hear that you've been considering adding func open(ctx context.Context, client hdfs.Client, path string) (*FileReader, error) {
reader, err := client.Open(path)
if err != nil {
return nil, err
}
if deadline, ok := ctx.Deadline(); ok {
if err := reader.SetDeadline(deadline); err != nil {
return nil, fmt.Errorf("failed to set deadline: %w", err)
}
}
return reader, nil
} This way of using |
Exactly. I would change the signature of |
Yes, That's a good idea. So when do you plan to add this feature? |
Currently my thinking would be to add |
That said, this example illustrates where it would be tricky. The call to |
Yeah, that's true. The reason why I specified I'm not sure my approach is still acceptable in the meantime waiting for v3, Is it possible to accept this PR and release a minor version for v2? |
Hm, maybe |
My problem wasn't from the |
really excited about that. |
In most cases for the
datanodes
, the user can set read/write timeout by usingSetDeadline
to theReader
s. But fornamenodes
, we can only use a singleDialContext
when initializing the namenode connection.The issue that I faced was, I was able to connect to the namenode without any timeout issues, also works fine for
write
function. But, we had an issue that namenode can't respond to the request. At this point, the client hangs.ref: https://github.com/colinmarc/hdfs/blob/master/internal/rpc/namenode.go#L209
I thought It would be great if we add options for determining read/write timeout value for the namenodes to prevent hanging when the namenode isn't available for responding.
Please let me know if I misunderstood the concept :)