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

Expose session iterator pools #631

Merged
merged 3 commits into from
May 14, 2018
Merged

Conversation

arnikola
Copy link
Collaborator

No description provided.

MutableSeriesIterators() encoding.MutableSeriesIteratorsPool
MultiReaderIteratorArray() encoding.MultiReaderIteratorArrayPool
ID() ident.Pool
CheckedBytesWrapper() xpool.CheckedBytesWrapperPool
TagDecoder() serialize.TagDecoderPool
}

// IteratorPools exposes a small subset of iterator pools that are sufficient for clients
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: move this to session_pools.go

Copy link
Collaborator

Choose a reason for hiding this comment

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

or better yet, maybe just to encoding/types.go?

Copy link
Collaborator

@prateek prateek left a comment

Choose a reason for hiding this comment

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

LGTM w/ a nit

@@ -1521,6 +1521,10 @@ func (s *session) readConsistencyResult(
return nil
}

func (s *session) IteratorPools() (IteratorPools, error) {
return s.pools, nil
Copy link
Collaborator

@robskillington robskillington May 14, 2018

Choose a reason for hiding this comment

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

Might want to check that s.pools != nil? Also are the pools always guaranteed to be available (I can't remember when they get alloc'd). If not we probably have to nil check the specific pools in question too and return an error if nil perhaps?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

s.pools is a sessionPools struct, and isn't itself nilable.

For the pools themselves, I believe they get alloced in session.Open(), so I think it should be safe unless you get the session in some weird way. Adding a sanity check would make sense, though.

Copy link
Collaborator

Choose a reason for hiding this comment

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

maybe ensure the session is open then?

	s.state.RLock()
        defer s.state.RULock()
	if s.state.status != statusOpen {
		return nil, errSessionStatusNotOpen
	}
        return s.pools

@@ -1521,6 +1521,10 @@ func (s *session) readConsistencyResult(
return nil
}

func (s *session) IteratorPools() (encoding.IteratorPools, error) {
return s.pools, nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might want to check that s.pools != nil? Also are the pools always guaranteed to be available (I can't remember when they get alloc'd). If not we probably have to nil check the specific pools in question too and return an error if nil perhaps?

@codecov
Copy link

codecov bot commented May 14, 2018

Codecov Report

Merging #631 into master will decrease coverage by 0.07%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #631      +/-   ##
==========================================
- Coverage   81.42%   81.34%   -0.08%     
==========================================
  Files         274      274              
  Lines       24376    24384       +8     
==========================================
- Hits        19848    19836      -12     
- Misses       3351     3365      +14     
- Partials     1177     1183       +6
Flag Coverage Δ
#coordinator 67.17% <100%> (+0.08%) ⬆️
#db 82.31% <100%> (-0.09%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 704b854...c2e2a84. Read the comment docs.

@arnikola arnikola merged commit 6168810 into master May 14, 2018
@arnikola arnikola deleted the arnikola/expose_iterator_pools branch May 14, 2018 20:06
prateek pushed a commit that referenced this pull request May 15, 2018
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