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

remove in-place magic from truncate() #3295

Merged
merged 1 commit into from
Dec 3, 2015
Merged

Conversation

tbg
Copy link
Member

@tbg tbg commented Dec 2, 2015

shelled out from wip on #2716.

Review on Reviewable

truncateOne := func(args roachpb.Request) (bool, []func(), error) {
// requests after truncation is returned.
func truncate(ba roachpb.BatchRequest, rs roachpb.RSpan) (roachpb.BatchRequest, int, error) {
truncateOne := func(args roachpb.Request) (bool /* omit? */, roachpb.Span, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd reverse the bool and make it ok instead of omit. It's weird to see return false, emptySpan, util.Errorf(...) when false normally means that we are returning a real value.

Copy link
Member Author

Choose a reason for hiding this comment

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

I like omit->ok, but I'm still going to return false on errors because that's the zero value.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that's what I mean. When there's an error, ok should clearly be false, both because it's the zero value and semantically correct. If it's omit, true is arguably more correct but it's unusual to return a non-zero value with an error.

@bdarnell
Copy link
Contributor

bdarnell commented Dec 2, 2015

LGTM

tbg added a commit that referenced this pull request Dec 3, 2015
remove in-place magic from truncate()
@tbg tbg merged commit ccad04b into cockroachdb:master Dec 3, 2015
@tbg tbg deleted the truncate branch December 3, 2015 03:57
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.

2 participants