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

fix: cursor leak when cur == nil and aux or conds is not empty #8706

Merged
merged 1 commit into from
Aug 16, 2017

Conversation

stuartcarnie
Copy link
Contributor

@stuartcarnie stuartcarnie commented Aug 15, 2017

  • symptom would be locked .tsm files resulting in an accumulation of .tsm.tmp files after a compaction

Scenarios

  • aggregate queries that included fields in the where condition, where the aggregate field does not exist for all shards. example select count(*) where some_field = 0 in which case conds cursors will leak
  • selectors that include additional fields and the field in the selector does not exist across all shards, like select first(foo), v0 from m0 limit 10, in which case aux cursors will leak
Required for all non-trivial PRs
  • Rebased/mergable
  • Tests pass
  • CHANGELOG.md updated

@@ -121,3 +121,9 @@ var (
nilStringLiteralValueCursor cursorAt = &literalValueCursor{value: (*string)(nil)}
nilBooleanLiteralValueCursor cursorAt = &literalValueCursor{value: (*bool)(nil)}
)

func closeAllCursorAt(cur []cursorAt) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you do something like:

type CursorsAt []cursorAt
func (a CursorsAt) Close() {
    for _, c := range a {
        c.close()
    }
}

And then CursorsAt(itr.aux).Close() or maybe change the type of aux and conds.curs to CursorsAt so you can just call itr.aux.Close()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should have gone with that first, as it did cross my mind. I'll update it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll keep it unexported, given cursorAt is also

@stuartcarnie stuartcarnie merged commit 59e137e into master Aug 16, 2017
@stuartcarnie stuartcarnie deleted the sgc-cursor-leak branch August 16, 2017 17:08
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