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

kv, storage: mandate presence of range/store ID in batch requests #25061

Merged
merged 2 commits into from
May 1, 2018

Conversation

benesch
Copy link
Contributor

@benesch benesch commented Apr 25, 2018

Even if this looks good I'll wait until next week to merge it. Stability period and all.

Also apologies if I'm sending this to the wrong folks. Still learning who owns what on core.


Some test code was relying on an ancient and obscure feature of the
Stores sender where batch requests without a range and/or store ID could
be routed by the request key. Normally, this routing is handled by
DistSender. Remove this feature so that requests in tests follow the
same path as requests in production. Fix the few tests that were relying
on it to manually route their requests to the correct range/store.

There are no mixed-version compatibility concerns here. Production code
paths, with one exception, have long since guaranteed that batch request
headers contain a range ID and store ID by the time they reach the
Stores sender. The one exception is during bootstrapping of a fresh
cluster, but there are no concerns about version compatibility because
the requests are directed to the local store before any other nodes have
joined the cluster. That code has been adjusted to use a wrapping sender
that installs an appropriate range and store ID.

Release note: None

@benesch benesch requested review from bdarnell, tbg, nvanbenschoten and a team April 25, 2018 02:51
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@tbg
Copy link
Member

tbg commented Apr 25, 2018

:lgtm:


Reviewed 5 of 5 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved, some commit checks failed.


Comments from Reviewable

@benesch benesch force-pushed the mandatory-addressing branch from 5c309e4 to 76a32d9 Compare April 25, 2018 14:27
@nvanbenschoten
Copy link
Member

:lgtm:


Reviewed 5 of 5 files at r1, 1 of 1 files at r2.
Review status: all files reviewed at latest revision, all discussions resolved.


pkg/storage/client_replica_test.go, line 552 at r2 (raw file):

	}

	sendRead := func(i int) *roachpb.Error {

nit: give this argument a better name. replicaIdx? Same below.


Comments from Reviewable

@bdarnell
Copy link
Contributor

:lgtm_strong:

That was a lot less painful than I was expecting. This closes #9014.


Reviewed 5 of 5 files at r1, 1 of 1 files at r2.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from Reviewable

@benesch benesch force-pushed the mandatory-addressing branch from 76a32d9 to 70cb938 Compare April 25, 2018 16:33
@benesch benesch requested a review from a team April 25, 2018 16:33
benesch added 2 commits April 25, 2018 12:33
Some test code was relying on an ancient and obscure feature of the
Stores sender where batch requests without a range and/or store ID could
be routed by the request key. Normally, this routing is handled by
DistSender. Remove this feature so that requests in tests follow the
same path as requests in production. Fix the few tests that were relying
on it to manually route their requests to the correct range/store.

There are no mixed-version compatibility concerns here. Production code
paths, with one exception, have long since guaranteed that batch request
headers contain a range ID and store ID by the time they reach the
Stores sender. The one exception is during bootstrapping of a fresh
cluster, but there are no concerns about version compatibility because
the requests are directed to the local store before any other nodes have
joined the cluster. That code has been adjusted to use a wrapping sender
that installs an appropriate range and store ID.

Release note: None
Thanks to the previous commit, Stores.LookupReplica is now unused save
for a few tests that can be trivially rewritten to call LookupReplica on
the one store within. Rewrite those tests and remove it.

We get to remove Stores.FirstRange, too, since its only caller was the
test for stores.LookupReplica.

Fix cockroachdb#9014.

Release note: None
@benesch benesch force-pushed the mandatory-addressing branch from 70cb938 to 2a6a43a Compare April 25, 2018 16:33
@benesch
Copy link
Contributor Author

benesch commented Apr 25, 2018

This closes #9014.

Ha! So it does. Thanks for spotting that. With a little more work I was able to nuke stores.{LookupReplica,FirstRange}. PTAL at the last commit.


Review status: 4 of 8 files reviewed at latest revision, 1 unresolved discussion.


pkg/storage/client_replica_test.go, line 552 at r2 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

nit: give this argument a better name. replicaIdx? Same below.

Done. (I thought storeIdx made more sense than replicaIdx.)


Comments from Reviewable

@bdarnell
Copy link
Contributor

LGTM


Reviewed 4 of 4 files at r4.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


Comments from Reviewable

@benesch
Copy link
Contributor Author

benesch commented May 1, 2018

bors r=nvanbenschoten,bdarnell,tschottdorf

@craig
Copy link
Contributor

craig bot commented May 1, 2018

Build failed (retrying...)

craig bot pushed a commit that referenced this pull request May 1, 2018
25061: kv, storage: mandate presence of range/store ID in batch requests r=nvanbenschoten,bdarnell,tschottdorf a=benesch

Even if this looks good I'll wait until next week to merge it. Stability period and all.

Also apologies if I'm sending this to the wrong folks. Still learning who owns what on core.

---

Some test code was relying on an ancient and obscure feature of the
Stores sender where batch requests without a range and/or store ID could
be routed by the request key. Normally, this routing is handled by
DistSender. Remove this feature so that requests in tests follow the
same path as requests in production. Fix the few tests that were relying
on it to manually route their requests to the correct range/store.

There are no mixed-version compatibility concerns here. Production code
paths, with one exception, have long since guaranteed that batch request
headers contain a range ID and store ID by the time they reach the
Stores sender. The one exception is during bootstrapping of a fresh
cluster, but there are no concerns about version compatibility because
the requests are directed to the local store before any other nodes have
joined the cluster. That code has been adjusted to use a wrapping sender
that installs an appropriate range and store ID.

Release note: None

Co-authored-by: Nikhil Benesch <[email protected]>
@craig
Copy link
Contributor

craig bot commented May 1, 2018

Build succeeded

@craig craig bot merged commit 2a6a43a into cockroachdb:master May 1, 2018
@benesch benesch deleted the mandatory-addressing branch May 2, 2018 20:26
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.

5 participants