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: correctly handle panic for hashjoin build phase #14056

Merged
merged 4 commits into from
Feb 5, 2020

Conversation

fzhedu
Copy link
Contributor

@fzhedu fzhedu commented Dec 13, 2019

What problem does this PR solve?

Fix #14027

What is changed and how it works?

handle the panic when OOM during build a hash table

Check List

Tests

  • No code

Code changes

  • N/A

Side effects

  • N/A

Related changes

  • Need to cherry-pick to the release branch
    3.0.5

Release note

  • correctly output OOM errors when building a hash table

@fzhedu fzhedu added type/bugfix This PR fixes a bug. sig/execution SIG execution labels Dec 13, 2019
@codecov
Copy link

codecov bot commented Dec 13, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@e28fb9e). Click here to learn what that means.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master     #14056   +/-   ##
===========================================
  Coverage          ?   80.1669%           
===========================================
  Files             ?        483           
  Lines             ?     121126           
  Branches          ?          0           
===========================================
  Hits              ?      97103           
  Misses            ?      16288           
  Partials          ?       7735

executor/join.go Outdated Show resolved Hide resolved
@fzhedu fzhedu requested a review from SunRunAway December 16, 2019 09:06
Copy link
Contributor

@SunRunAway SunRunAway left a comment

Choose a reason for hiding this comment

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

Please add unit tests.

executor/join.go Outdated
@@ -16,6 +16,7 @@ package executor
import (
"context"
"fmt"
"github.com/pingcap/failpoint"
Copy link
Member

Choose a reason for hiding this comment

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

please reorg the import packages.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@@ -16,6 +16,7 @@ package executor_test
import (
"context"
"fmt"
"github.com/pingcap/failpoint"
Copy link
Member

Choose a reason for hiding this comment

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

Please move it to the 3rd party libs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

executor/join.go Outdated
@@ -244,6 +246,11 @@ func (e *HashJoinExec) fetchBuildSideRows(ctx context.Context, chkCh chan<- *chu
e.buildFinished <- errors.Trace(err)
return
}
failpoint.Inject("errorFetchBuildSideRowsMockOOMPanic", func(val failpoint.Value) {
Copy link
Contributor

Choose a reason for hiding this comment

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

failpoint.Inject("errorFetchBuildSideRowsMockOOMPanic", nil) and c.Assert(failpoint.Enable("github.com/pingcap/tidb/executor/errorFetchBuildSideRowsMockOOMPanic", panic), IsNil)

Comment on lines 83 to 87
c.Assert(failpoint.Enable("github.com/pingcap/tidb/executor/errorFetchBuildSideRowsMockOOMPanic", `return(true)`), IsNil)
defer func() {
c.Assert(failpoint.Disable("github.com/pingcap/tidb/executor/errorFetchBuildSideRowsMockOOMPanic"), IsNil)
}()
Copy link
Contributor

Choose a reason for hiding this comment

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

Prefer to:

fpName := "github.com/pingcap/tidb/executor/errorFetchBuildSideRowsMockOOMPanic"
c.Assert(failpoint.Enable(fpName, `panic`), IsNil)
	defer func() {
		c.Assert(failpoint.Disable(fpName), IsNil)
	}()

executor/join.go Outdated
@@ -232,6 +233,7 @@ var buildSideResultLabel fmt.Stringer = stringutil.StringerStr("hashJoin.buildSi
// fetchBuildSideRows fetches all rows from build side executor, and append them
// to e.buildSideResult.
func (e *HashJoinExec) fetchBuildSideRows(ctx context.Context, chkCh chan<- *chunk.Chunk, doneCh <-chan struct{}) {

Copy link
Member

Choose a reason for hiding this comment

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

please remove the empty line.

@SunRunAway SunRunAway removed their request for review December 30, 2019 05:41
@sre-bot
Copy link
Contributor

sre-bot commented Jan 4, 2020

@fzhedu, please update your pull request.

1 similar comment
@sre-bot
Copy link
Contributor

sre-bot commented Jan 11, 2020

@fzhedu, please update your pull request.

@sre-bot
Copy link
Contributor

sre-bot commented Jan 27, 2020

@fzhedu PR closed due to no update for a long time. Feel free to reopen it anytime.

@sre-bot sre-bot closed this Jan 27, 2020
@XuHuaiyu XuHuaiyu reopened this Feb 3, 2020
@XuHuaiyu XuHuaiyu force-pushed the panic branch 4 times, most recently from e0cd2e8 to ed1d120 Compare February 4, 2020 06:17
@fzhedu fzhedu requested a review from a team as a code owner February 4, 2020 06:17
@XuHuaiyu
Copy link
Contributor

XuHuaiyu commented Feb 4, 2020

/run-unit-test

@XuHuaiyu XuHuaiyu changed the title executor: correctly handle error when OOM executor: correctly handle panic for hashjoin build phase Feb 4, 2020
@XuHuaiyu
Copy link
Contributor

XuHuaiyu commented Feb 4, 2020

/rebuild

1 similar comment
@XuHuaiyu
Copy link
Contributor

XuHuaiyu commented Feb 4, 2020

/rebuild

@XuHuaiyu
Copy link
Contributor

XuHuaiyu commented Feb 4, 2020

/build

Copy link
Contributor

@SunRunAway SunRunAway left a comment

Choose a reason for hiding this comment

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

LGTM

@SunRunAway SunRunAway added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 4, 2020
@XuHuaiyu
Copy link
Contributor

XuHuaiyu commented Feb 4, 2020

/run-all-tests

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason zz-jason added status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Feb 5, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Feb 5, 2020

Your auto merge job has been accepted, waiting for 14637

@sre-bot
Copy link
Contributor

sre-bot commented Feb 5, 2020

/run-all-tests

@sre-bot sre-bot merged commit 72b1f0e into pingcap:master Feb 5, 2020
@sre-bot
Copy link
Contributor

sre-bot commented Feb 5, 2020

cherry pick to release-3.0 failed

@sre-bot
Copy link
Contributor

sre-bot commented Feb 5, 2020

cherry pick to release-2.1 failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cross join get runtime error: index out of range
8 participants