-
Notifications
You must be signed in to change notification settings - Fork 4k
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
THRIFT-4914: Make TClient.Call to return the response meta #2315
Conversation
// | ||
// If the last response was not sent over THeader protocol, | ||
// a nil map will be returned. | ||
func GetResponseHeadersFromClient(c TClient) THeaderMap { |
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.
This function was in a tagged release. Maybe mark it as deprecated instead of removing?
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.
It was added after 0.13.0 so I don't believe it's in any tagged release :)
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.
At least it's not here: https://pkg.go.dev/github.com/apache/[email protected]/lib/go/thrift :)
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.
Ah, I was confused because the commit date was earlier than the 0.13 tag :)
6d91313
to
7f41583
Compare
out << indent() << indent() << "return thrift.TExceptionTypeCompiled" << endl; | ||
indent_up(); | ||
out << indent() << "return thrift.TExceptionTypeCompiled" << endl; | ||
indent_down(); |
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.
These are cosmetic fix of a wrongly did indent from my previous PR :$ not really related to this PR.
7f41583
to
b4096fc
Compare
@dcelasun On second thought, I changed it from |
b4096fc
to
36e399e
Compare
Client: go Make a breaking change so that TClient.Call returns the response meta, currently only contains headers but could be expanded in the future, and make a compiler change to compiler generated clients to take advantage of that and provide access to response metadata to users.
36e399e
to
9b28a26
Compare
f_types_ << indent() << "if err = p.Client_().Call(ctx, \"" | ||
<< method << "\", &" << argsName << ", &" << resultName << "); err != nil {" << endl; | ||
f_types_ << indent() << "var meta thrift.ResponseMeta" << endl; | ||
f_types_ << indent() << "meta, err = p.Client_().Call(ctx, \"" | ||
<< method << "\", &" << argsName << ", &" << resultName << ")" << endl; | ||
f_types_ << indent() << "p.SetLastResponseMeta_(meta)" << endl; | ||
f_types_ << indent() << "if err != nil {" << endl; |
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.
should we use tmp("_meta")
or something? I'm seeing meta
redeclaration errors when meta
is already defined in args, for example:
https://github.com/apache/storm/blob/v2.2.0/storm-client/src/storm.thrift#L752
produces the snippet below which throws meta
redeclared error
// Parameters:
// - Key
// - Meta
func (p *NimbusClient) BeginCreateBlob(ctx context.Context, key string, meta *SettableBlobMeta) (r string, err error) {
var _args293 NimbusBeginCreateBlobArgs
_args293.Key = key
_args293.Meta = meta
var _result294 NimbusBeginCreateBlobResult
var meta thrift.ResponseMeta
meta, err = p.Client_().Call(ctx, "beginCreateBlob", &_args293, &_result294)
p.SetLastResponseMeta_(meta)
if err != nil {
return
}
switch {
case _result294.Aze!= nil:
return r, _result294.Aze
case _result294.Kae!= nil:
return r, _result294.Kae
}
return _result294.GetSuccess(), nil
}
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.
Yes. Thanks for reporting. Preparing a PR to fix 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.
Client: go This fixes the bug reported in apache#2315 (comment).
Client: go This fixes the bug reported in apache#2315 (comment).
Client: go This fixes the bug reported in apache#2315 (comment).
Client: go This fixes the bug reported in apache#2315 (comment).
Client: go This fixes the bug reported in apache#2315 (comment).
Client: go This fixes the bug reported in apache#2315 (comment).
Client: go This fixes the bug reported in #2315 (comment).
Client: go This fixes the bug reported in apache#2315 (comment).
Client: go This fixes the bug reported in #2315 (comment).
hello, in the latest version of thrift golang library, when I compile gen-go code with go build, I got error like this
It seems that when I install the library with command |
@litao3rd you are not using latest thrift go library, please check your go.mod file to make sure you are using the correct version of the library. |
@fishy thanks for your reply. I'm sure I was using the latest thrift go library. I tested under a pure new environment built by these steps.
the generated go.mod file showed as below module demo
go 1.16
require github.com/apache/thrift/lib/go/thrift v0.0.0-20210120171102-e27e82c46ba4 // indirect
the generated go.sum file showed as below github.com/apache/thrift/lib/go/thrift v0.0.0-20210120171102-e27e82c46ba4 h1:orNYqmQGnSjgOauLWjHEp9/qIDT98xv/0Aa4Zet3/Y8=
github.com/apache/thrift/lib/go/thrift v0.0.0-20210120171102-e27e82c46ba4/go.mod h1:V/LzksIyqd3KZuQ2SunvReTG/UkArhII1dAWY5U1sCE= It's weird that when I install the thrift library it prompts I'm installing v0.14.2 which is the latest version. But in go.mod file there is no version information just v0.0.0.
|
That is the wrong version. On step 4, do this instead: That will give you |
Hi, thanks. I did as follow commands. 1, remove the directory $HOME/go/pkg/mod as I did not set $GOROOT and $GOPATH explicitly.
2, run the command `go clean -cache`
3, go get github.com/apache/thrift
4, go mod init demo2
5, go build On step3, I do get the right version v0.14.2 as I get the message
and the directory
But on step4, I get the prompt
If I do as it requires to run the command
Yep, I still get the wrong version of the library. If I do NOT run the command
That meas I must run the command go get before
I still get the wrong version. I do not know does it any relation with my go executable version as I use the latest version of go 1.16.6 Thanks very much. |
That's because you also swapped the steps. Don't do that. You need to do Can you go back to the exact steps of #2315 (comment), and only change Step 4 into |
You are right. The problem is solved as your instructions. Thanks very much. |
By the way, I installed the go thrift library as the instruction introduced in README file. Maybe it should correct or not ? As I am not good at go. |
Thanks, I'll update the readme file.
…On Sat, Jul 24, 2021, 09:48 litao3rd ***@***.***> wrote:
By the way, I installed the go thrift library as the instruction
introduced in README
<https://github.com/apache/thrift/blob/master/lib/go/README.md> file.
Maybe it should correct ?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2315 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAATCZ6WKCLVHVKPMHHFWHTTZLVF3ANCNFSM4WOZ7FIA>
.
|
Client: go
Make a breaking change so that TClient.Call returns the response
meta, currently only contains headers but could be expanded in the
future, and make a compiler change to compiler generated clients to take
advantage of that and provide access to response metadata to users.