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

executor: range task channel in XSelectIndexExec.Close. #2775

Merged
merged 4 commits into from
Mar 6, 2017

Conversation

coocood
Copy link
Member

@coocood coocood commented Mar 3, 2017

Fixes goroutine leak.

@coocood
Copy link
Member Author

coocood commented Mar 3, 2017

@shenli @tiancaiamao PTAL

@@ -505,11 +517,6 @@ func (e *XSelectIndexExec) nextForDoubleRead() (*Row, error) {
}
row, err := e.taskCurr.getRow()
if err != nil {
// Consume the task channel in case channel is full.
Copy link
Member

Choose a reason for hiding this comment

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

Why not clean the chan?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is moved to Close method.

// leak. For testing distsql with multiple regions, we need to manually split a mock TiKV.
func (s *testSuite) TestIndexDoubleReadClose(c *C) {
if _, ok := s.store.GetClient().(*tikv.CopClient); !ok {
// Make sure the store is tikv store.
Copy link
Member

Choose a reason for hiding this comment

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

Should we assert ok is True here? Or the test case may be ignored.

Copy link
Member Author

Choose a reason for hiding this comment

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

The test can be configured to run with localstore, then the client is not *tikv.CopClient.

@shenli
Copy link
Member

shenli commented Mar 6, 2017

LGTM

@shenli
Copy link
Member

shenli commented Mar 6, 2017

@tiancaiamao @zimulala PTAL

@zimulala
Copy link
Contributor

zimulala commented Mar 6, 2017

LGTM

@tiancaiamao
Copy link
Contributor

LGTM

@shenli shenli merged commit e6ad664 into master Mar 6, 2017
@shenli shenli deleted the coocood/fix-goroutine-leak branch March 6, 2017 05:35
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