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

sstable: use fixed error in Close #1027

Merged
merged 1 commit into from
Dec 23, 2020
Merged

sstable: use fixed error in Close #1027

merged 1 commit into from
Dec 23, 2020

Conversation

dt
Copy link
Member

@dt dt commented Dec 19, 2020

Previously sstable.Reader.Close() would initialize a new error each time it was called.

In workloads that open and close many readers, this could actually have non-trivial
expense.

Instead, this change adds a pre-initialized error value and just assigns it in Close().

@dt dt requested a review from itsbilal December 19, 2020 13:52
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@itsbilal itsbilal left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @dt and @itsbilal)


sstable/reader.go, line 1638 at r1 (raw file):

}

var errReaderClosed = errors.New("pebble/table: reader is closed")

Nit: I'd move this to being right below errCorruptIndexEntry.

Previously sstable.Reader.Close() would initialize a new error each time it was called.

In workloads that open and close many readers, this could actually have non-trivial
expense.

Instead, this change adds a pre-initialized error value and just assigns it in Close().
@dt
Copy link
Member Author

dt commented Dec 23, 2020

TFTR!

@dt dt merged commit 9f77cf3 into cockroachdb:master Dec 23, 2020
@dt dt deleted the close-err branch December 23, 2020 01:10
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.

3 participants