session,executor: scope finishStmt failpoint to current connection (#67655)#70016
session,executor: scope finishStmt failpoint to current connection (#67655)#70016ti-chi-bot wants to merge 1 commit into
Conversation
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
|
@zanmato1984 This PR has conflicts, I have hold it. |
|
@ti-chi-bot: ## If you want to know how to resolve it, please read the guide in TiDB Dev Guide. DetailsInstructions 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 ti-community-infra/tichi repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
📝 WalkthroughWalkthroughThe ChangesFinish statement failpoint scoping
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pkg/session/tidb.go`:
- Around line 247-272: Resolve the conflict in the finish-statement flow by
removing all Git conflict markers and retaining both behaviors: compute readOnly
once with sql.IsReadOnly(sessVars), run the existing connection-alive check when
applicable, and preserve the finishStmtError failpoint scoped to
sessVars.ConnectionID. Use the computed readOnly value for the subsequent
non-read-only branch.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 2b36be74-ad24-4520-8984-dbabb9dd82be
📒 Files selected for processing (2)
pkg/executor/staticrecordset/integration_test.gopkg/session/tidb.go
| <<<<<<< HEAD | ||
| readOnly := sql.IsReadOnly(sessVars) | ||
| if !readOnly && meetsErr == nil && shouldCheckConnectionAliveBeforeCommit(sessVars, sql) { | ||
| sessVars.SQLKiller.CheckConnectionAlive() | ||
| meetsErr = sessVars.SQLKiller.HandleSignal() | ||
| } | ||
| if !readOnly { | ||
| ======= | ||
| failpoint.Inject("finishStmtError", func(val failpoint.Value) { | ||
| failCurrentSession := true | ||
| switch v := val.(type) { | ||
| case int: | ||
| failCurrentSession = uint64(v) == sessVars.ConnectionID | ||
| case int64: | ||
| failCurrentSession = uint64(v) == sessVars.ConnectionID | ||
| case uint64: | ||
| failCurrentSession = v == sessVars.ConnectionID | ||
| case float64: | ||
| failCurrentSession = uint64(v) == sessVars.ConnectionID | ||
| } | ||
| if failCurrentSession { | ||
| failpoint.Return(errors.New("occur an error after finishStmt")) | ||
| } | ||
| }) | ||
| if !sql.IsReadOnly(sessVars) { | ||
| >>>>>>> 74a77b9dd8e (session,executor: scope finishStmt failpoint to current connection (#67655)) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Resolve the cherry-pick conflict before merging.
The Git conflict markers remain in the Go source, so pkg/session/tidb.go cannot compile. Resolve this hunk by retaining both the connection-alive check and the connection-scoped failpoint, computing readOnly once, and using it for the later branch; selecting either side wholesale drops part of the intended behavior.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@pkg/session/tidb.go` around lines 247 - 272, Resolve the conflict in the
finish-statement flow by removing all Git conflict markers and retaining both
behaviors: compute readOnly once with sql.IsReadOnly(sessVars), run the existing
connection-alive check when applicable, and preserve the finishStmtError
failpoint scoped to sessVars.ConnectionID. Use the computed readOnly value for
the subsequent non-read-only branch.
|
@ti-chi-bot: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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-sigs/prow repository. I understand the commands that are listed here. |
This is an automated cherry-pick of #67655
What problem does this PR solve?
Issue Number: close #66728
Problem Summary:
TestFinishStmtErrorenablesfinishStmtErroras a global failpoint, so unrelated sessions can also hit it while the test is running. That broad scope can destabilize this case and make flaky reports noisy.What changed and how does it work?
finishStmtErrorto the current connection when the failpoint value is a numeric connection IDTestFinishStmtErrorto enable the failpoint with its own session connection IDt.Cleanupfor disable and skip when the failpoint hook is inactive in the current test binaryCheck List
Tests
Side effects
Documentation
Release note
Summary by CodeRabbit
Tests
Bug Fixes