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

telemetry: sync the concurrent map access of built-in func usage #32618

Closed
wants to merge 3 commits into from

Conversation

tangenta
Copy link
Contributor

@tangenta tangenta commented Feb 24, 2022

What problem does this PR solve?

Issue Number: close #32459, related to #26234

Problem Summary:

The panic is caused by the concurrent map access(click the details below to see):

runtime.throw (panic.go:1188) runtime
runtime.mapassign_faststr (map_faststr.go:294) runtime
telemetry.BuiltinFunctionsUsage.Inc (data_window.go:130) github.com/pingcap/tidb/telemetry
core.(*expressionRewriter).newFunction (expression_rewriter.go:1228) github.com/pingcap/tidb/planner/core
core.(*expressionRewriter).constructBinaryOpFunction (expression_rewriter.go:274) github.com/pingcap/tidb/planner/core
core.(*expressionRewriter).binaryOpToExpression (expression_rewriter.go:1354) github.com/pingcap/tidb/planner/core
core.(*expressionRewriter).Leave (expression_rewriter.go:1103) github.com/pingcap/tidb/planner/core
ast.(*BinaryOperationExpr).Accept (expressions.go:223) github.com/pingcap/tidb/parser/ast
ast.(*BinaryOperationExpr).Accept (expressions.go:211) github.com/pingcap/tidb/parser/ast
ast.(*BinaryOperationExpr).Accept (expressions.go:211) github.com/pingcap/tidb/parser/ast
ast.(*ParenthesesExpr).Accept (expressions.go:995) github.com/pingcap/tidb/parser/ast
core.(*PlanBuilder).rewriteExprNode (expression_rewriter.go:200) github.com/pingcap/tidb/planner/core
core.(*PlanBuilder).rewriteWithPreprocess (expression_rewriter.go:146) github.com/pingcap/tidb/planner/core
core.(*PlanBuilder).rewrite (expression_rewriter.go:114) github.com/pingcap/tidb/planner/core
core.(*PlanBuilder).buildJoin (logical_plan_builder.go:790) github.com/pingcap/tidb/planner/core
core.(*PlanBuilder).buildResultSetNode (logical_plan_builder.go:327) github.com/pingcap/tidb/planner/core
core.(*PlanBuilder).buildTableRefs (logical_plan_builder.go:321) github.com/pingcap/tidb/planner/core
core.(*PlanBuilder).buildSelect (logical_plan_builder.go:3553) github.com/pingcap/tidb/planner/core
core.(*PlanBuilder).Build (planbuilder.go:716) github.com/pingcap/tidb/planner/core
core.(*PlanBuilder).BuildDataSourceFromView (logical_plan_builder.go:4379) github.com/pingcap/tidb/planner/core
executor.tryFillViewColumnType (show.go:1839) github.com/pingcap/tidb/executor
executor.(*hugeMemTableRetriever).dataForColumnsInTable (infoschema_reader.go:675) github.com/pingcap/tidb/executor
executor.(*hugeMemTableRetriever).setDataForColumns (infoschema_reader.go:664) github.com/pingcap/tidb/executor
executor.(*hugeMemTableRetriever).retrieve (infoschema_reader.go:2520) github.com/pingcap/tidb/executor
executor.(*MemTableReaderExec).Next (memtable_reader.go:118) github.com/pingcap/tidb/executor
executor.Next (executor.go:302) github.com/pingcap/tidb/executor
executor.(*HashJoinExec).fetchProbeSideChunks (join.go:214) github.com/pingcap/tidb/executor
executor.(*HashJoinExec).fetchAndProbeHashTable.func1 (join.go:338) github.com/pingcap/tidb/executor
util.WithRecovery (misc.go:100) github.com/pingcap/tidb/util
runtime.goexit (asm_arm64.s:1133) runtime
 - Async Stack Trace
executor.(*HashJoinExec).fetchAndProbeHashTable (join.go:336) github.com/pingcap/tidb/executor

What is changed and how it works?

This PR synchronize the map access.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Fix the panic issue caused by joining views of system tables.

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

The full list of commands accepted by this bot can be found here.

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/needs-triage-completed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 24, 2022
@ti-chi-bot ti-chi-bot added needs-cherry-pick-release-5.2 needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. and removed do-not-merge/needs-triage-completed labels Feb 24, 2022
@sre-bot
Copy link
Contributor

sre-bot commented Feb 24, 2022

@tangenta
Copy link
Contributor Author

tangenta commented Mar 4, 2022

/hold

Since the telemetry module is not the only one who assumes "there is no concurrent modifications", there should be a better way to solve this issue(For example, use a different context for build side and probe side when joining view system tables).

@ti-chi-bot ti-chi-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 4, 2022
@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 16, 2022
@ti-chi-bot
Copy link
Member

@tangenta: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tangenta
Copy link
Contributor Author

Fixed by #33946.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-cherry-pick-release-5.2 needs-cherry-pick-release-5.3 Type: Need cherry pick to release-5.3 needs-cherry-pick-release-5.4 Should cherry pick this PR to release-5.4 branch. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Joining views of information_schema.columns panic
3 participants