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

batcheval,storage: move EndTransaction to batcheval #26917

Merged
merged 1 commit into from
Jun 29, 2018

Conversation

benesch
Copy link
Contributor

@benesch benesch commented Jun 22, 2018

Move the last remaining command, EndTransaction, to the batcheval
package, where it logically belongs. In doing so, resolve a longstanding
TODO.

The one-phase commit logic still lives in storage and, unfortunately,
ends up tightly coupled with the EndTransaction machinery in batcheval,
but this is a step in the right direction. By contrast, the extraction
of writeInitial[Replica]State into the stateloader package goes quite
smoothly.

This patch is strictly code movement. Everything was copy/pasted verbatim with the exception of adding/removing package qualifiers as necessary.

Release note: None

@benesch benesch requested review from tbg and a team June 22, 2018 02:19
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@nvanbenschoten
Copy link
Member

🎊 🎊 🎊


Reviewed 15 of 15 files at r1.
Review status: :shipit: complete! 0 of 0 LGTMs obtained


pkg/storage/replica_state.go, line 30 at r1 (raw file):

)

// ClusterSettings returns the node's ClusterSettings.

This is a strange file. I wonder if it needs to exist at all anymore.


pkg/storage/storagebase/base.go, line 142 at r1 (raw file):

// belonging to or outside of the descriptor's key range, and passing an intent
// which begins range-local but ends non-local results in a panic.
// TODO(tschottdorf): move to proto, make more gen-purpose - kv.truncate does

You'll probably run into issues making this (or the two above) methods in roachpb because of the dependency on keys, but arguably it could at least live in keys instead of here.


pkg/storage/storagebase/errors.go, line 21 at r1 (raw file):

// NewReplicaCorruptionError creates a new error indicating a corrupt replica,
// with the supplied list of errors given as history.
func NewReplicaCorruptionError(err error) *roachpb.ReplicaCorruptionError {

I think this should actually go in roachpb/errors.go


Comments from Reviewable

@benesch
Copy link
Contributor Author

benesch commented Jun 22, 2018

Good ideas! Now that I'm not hurtling through the air at 600mph in a little tin can I'll take another stab at decomposing this.

@benesch
Copy link
Contributor Author

benesch commented Jun 22, 2018

Review status: :shipit: complete! 0 of 0 LGTMs obtained


pkg/storage/replica_state.go, line 30 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

This is a strange file. I wonder if it needs to exist at all anymore.

Yeah, super weird. I smushed into what seems like a logical place in replica.go.


pkg/storage/storagebase/base.go, line 142 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

You'll probably run into issues making this (or the two above) methods in roachpb because of the dependency on keys, but arguably it could at least live in keys instead of here.

Yeah, agreed it doesn't belong here. It looks like nothing else in keys touches roachpb.RangeDescriptors, though, so if it's alright with you I'd prefer to leave it here for now and do a more targeted refactor later. It seems like there's some general grossness with how the ContainsKey method is different from roachpb.RangeDescriptor.ContainsKey and it could all use some cleanup.


pkg/storage/storagebase/errors.go, line 21 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

I think this should actually go in roachpb/errors.go

Wow, yeah. There's a very obvious place for it. Thanks for the pointer.


Comments from Reviewable

1 similar comment
@benesch
Copy link
Contributor Author

benesch commented Jun 22, 2018

Review status: :shipit: complete! 0 of 0 LGTMs obtained


pkg/storage/replica_state.go, line 30 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

This is a strange file. I wonder if it needs to exist at all anymore.

Yeah, super weird. I smushed into what seems like a logical place in replica.go.


pkg/storage/storagebase/base.go, line 142 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

You'll probably run into issues making this (or the two above) methods in roachpb because of the dependency on keys, but arguably it could at least live in keys instead of here.

Yeah, agreed it doesn't belong here. It looks like nothing else in keys touches roachpb.RangeDescriptors, though, so if it's alright with you I'd prefer to leave it here for now and do a more targeted refactor later. It seems like there's some general grossness with how the ContainsKey method is different from roachpb.RangeDescriptor.ContainsKey and it could all use some cleanup.


pkg/storage/storagebase/errors.go, line 21 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

I think this should actually go in roachpb/errors.go

Wow, yeah. There's a very obvious place for it. Thanks for the pointer.


Comments from Reviewable

@nvanbenschoten
Copy link
Member

:lgtm:


Reviewed 9 of 9 files at r2.
Review status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale)


pkg/roachpb/errors.go, line 574 at r2 (raw file):

// NewReplicaCorruptionError creates a new error indicating a corrupt replica,
// with the supplied list of errors given as history.

list?


pkg/storage/storagebase/base.go, line 142 at r1 (raw file):

Previously, benesch (Nikhil Benesch) wrote…

Yeah, agreed it doesn't belong here. It looks like nothing else in keys touches roachpb.RangeDescriptors, though, so if it's alright with you I'd prefer to leave it here for now and do a more targeted refactor later. It seems like there's some general grossness with how the ContainsKey method is different from roachpb.RangeDescriptor.ContainsKey and it could all use some cleanup.

SGTM


Comments from Reviewable

@benesch
Copy link
Contributor Author

benesch commented Jun 22, 2018

Review status: :shipit: complete! 1 of 0 LGTMs obtained


pkg/roachpb/errors.go, line 574 at r2 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

list?

Heh, looks like NewReplicaCorruptionError predates errors.Wrap. When it was updated for an errors.Wrap world the comment wasn't updated: 98db634.

I've updated it now.


pkg/storage/storagebase/base.go, line 142 at r1 (raw file):

Previously, nvanbenschoten (Nathan VanBenschoten) wrote…

SGTM

Ack. (Reviewable seems to think there's more to be done on this comment stream.)


Comments from Reviewable

@tbg
Copy link
Member

tbg commented Jun 23, 2018

Could you hold this for a minute? I have a relatively urgent mitigation for #26830 that needs to be backported, and it'll make my life a lot easier if I don't have to rewrite the patch on 2.0.

@tbg
Copy link
Member

tbg commented Jun 23, 2018

(but generally thanks for cleaning this up! This has bothered me a few times myself)

@benesch
Copy link
Contributor Author

benesch commented Jun 23, 2018 via email

@tbg
Copy link
Member

tbg commented Jun 25, 2018 via email

@bdarnell
Copy link
Contributor

:lgtm:


Reviewed 8 of 15 files at r1, 9 of 9 files at r2.
Review status: :shipit: complete! 1 of 0 LGTMs obtained (and 1 stale)


Comments from Reviewable

Move the last remaining command, EndTransaction, to the batcheval
package, where it logically belongs. In doing so, resolve a longstanding
TODO.

The one-phase commit logic still lives in storage and, unfortunately,
ends up tightly coupled with the EndTransaction machinery in batcheval,
but this is a step in the right direction. By contrast, the extraction
of writeInitial[Replica]State into the stateloader package goes quite
smoothly.

Release note: None
@benesch
Copy link
Contributor Author

benesch commented Jun 29, 2018

TFTRs!

bors r=bdarnell,tschottdorf,nvanbenschoten

@craig
Copy link
Contributor

craig bot commented Jun 29, 2018

Timed out (retrying...)

@benesch
Copy link
Contributor Author

benesch commented Jun 29, 2018

bors r=bdarnell,tschottdorf,nvanbenschoten

@craig
Copy link
Contributor

craig bot commented Jun 29, 2018

Not awaiting review

@craig
Copy link
Contributor

craig bot commented Jun 29, 2018

Build failed (retrying...)

@craig
Copy link
Contributor

craig bot commented Jun 29, 2018

Build failed (retrying...)

craig bot pushed a commit that referenced this pull request Jun 29, 2018
26917: batcheval,storage: move EndTransaction to batcheval r=bdarnell,tschottdorf,nvanbenschoten a=benesch

Move the last remaining command, EndTransaction, to the batcheval
package, where it logically belongs. In doing so, resolve a longstanding
TODO.

The one-phase commit logic still lives in storage and, unfortunately,
ends up tightly coupled with the EndTransaction machinery in batcheval,
but this is a step in the right direction. By contrast, the extraction
of writeInitial[Replica]State into the stateloader package goes quite
smoothly.

This patch is strictly code movement. Everything was copy/pasted verbatim with the exception of adding/removing package qualifiers as necessary.

Release note: None

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

craig bot commented Jun 29, 2018

Build succeeded

@craig craig bot merged commit b8982e8 into cockroachdb:master Jun 29, 2018
@benesch benesch deleted the batcheval-et branch July 3, 2018 15:38
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