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

client: move everything to rpcSender #2351

Merged
merged 7 commits into from
Sep 4, 2015
Merged

client: move everything to rpcSender #2351

merged 7 commits into from
Sep 4, 2015

Conversation

tamird
Copy link
Contributor

@tamird tamird commented Sep 3, 2015

I was possibly heavy handed with this. Nits welcome.

Fixes #2271.

@@ -77,12 +79,20 @@ func (ctx *Context) InitDefaults() {
ctx.User = defaultUser
}

// RequestScheme returns "http" or "https" based on the value of Insecure.
func (ctx *Context) RequestScheme() string {
// RPCRequestScheme returns "http" or "https" based on the value of Insecure.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, this is wrong.

@BramGruneir
Copy link
Member

What's the motivation for this change? Is there an issue or was it just making the codebase cleaner?

@tamird
Copy link
Contributor Author

tamird commented Sep 3, 2015

Performance and cleanup.
On Sep 3, 2015 6:28 PM, "Bram Gruneir" notifications@github.com wrote:

What's the motivation for this change? Is there an issue or was it just
making the codebase cleaner?


Reply to this email directly or view it on GitHub
#2351 (comment)
.

}
func (s *rpcSender) Send(_ context.Context, call proto.Call) {
// Wait for it.
<-s.client.Healthy()
Copy link
Collaborator

Choose a reason for hiding this comment

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

No retry-loop anymore? Perhaps this is explained elsewhere in the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to remove this because the assumption that all RPCs are retryable made it impossible to test certain failures. I'll put it back and remove the offending tests if this gets @mberhault's approval.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the retry loop back

@petermattis
Copy link
Collaborator

LGTM modulo the removal of the retry-loop in rpc sending. And @mberhault should definitely weigh-in as he has more familiarity with this code.

client := roachrpc.NewClient(addr, ctx)
return &Sender{

ctx := rpc.NewContext(context, hlc.NewClock(hlc.UnixNano), stop.NewStopper())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is probably wrong in that it's getting a new stopper, but i'm not sure what else to do. suggestions?

Copy link
Contributor

Choose a reason for hiding this comment

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

Why does it need a stopper now when it didn't before? When is this stopper stopped? The most obvious solution would be to pass a stopper in (modifying NewSenderFunc and on up the stack); is there any reason that wouldn't work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It wasn't being used before. When is the stopper stopped is a good question; whenever the client is no longer needed?

We could plumb it through, I'm just not sure what would be at the top. Probably tests and cli commands.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this necessary because tests previously used the http sender and are now using the rpc sender? If yes, passing the stopper to NewSenderFunc sounds correct.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes and yes.

@bdarnell
Copy link
Contributor

bdarnell commented Sep 4, 2015

LGTM. Which tests fail with the retry loop?

@tamird
Copy link
Contributor Author

tamird commented Sep 4, 2015

@bdarnell it was TestKVDBInternalMethods but I fixed it by limiting the number of retries.

@@ -140,8 +138,8 @@ func TestClientRetryNonTxn(t *testing.T) {
// intent to be pushed and once with priorities which will not.
for i, test := range testCases {
key := proto.Key(fmt.Sprintf("key-%d", i))
txnPri := 1
clientPri := 1
var txnPri int32 = 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

I prefer the syntax txnPri := int32(1) if you need an explicit type for txnPri. Doesn't particularly matter, though.

@mberhault
Copy link
Contributor

LGTM.
FYI: this fixes #2271

@tamird
Copy link
Contributor Author

tamird commented Sep 4, 2015

OK I plumbed the stopper through. Can I get a final review? I'll squash the last commit into the main one and merge after an LGTM.

tamird and others added 7 commits September 4, 2015 15:23
The client code wants to know which request failed, but with the
`(response, error)` pattern no reply is returned on error, so no reply
header can be used to find out the location of the error.

This needs further fixing, see #1891.
@tamird
Copy link
Contributor Author

tamird commented Sep 4, 2015

@tschottdorf I had to steal your client fix.

tamird added a commit that referenced this pull request Sep 4, 2015
client: move everything to rpcSender
@tamird tamird merged commit e82584b into cockroachdb:master Sep 4, 2015
@tamird tamird deleted the http-sender-sql branch September 4, 2015 20:26
@tbg
Copy link
Member

tbg commented Sep 4, 2015

Sure. What made it necessary?

@tamird
Copy link
Contributor Author

tamird commented Sep 5, 2015

@tschottdorf see #2370

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants