sysvar: copr_resolve_lock_lite#2
Open
ekexium wants to merge 4 commits into
Open
Conversation
Signed-off-by: ekexium <eke@fastmail.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces a new TiDB system variable to control whether coprocessor requests use “resolve lock lite”, and wires that setting from session vars through DistSQL request construction down to the coprocessor worker KV client helper.
Changes:
- Add new sysvar
tidb_copr_resolve_lock_lite(global + session) and correspondingSessionVarsfield. - Plumb the flag through
DistSQLContext→kv.Request→ coprocessor worker (txnsnapshot.NewClientHelper(..., CoprResolveLockLite)). - Update DistSQL context detach unit test to include the new field.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/store/copr/coprocessor.go | Pass request flag into txnsnapshot.NewClientHelper so copr lock resolution behavior can be toggled. |
| pkg/sessionctx/variable/sysvar.go | Register new sysvar and apply it to SessionVars. |
| pkg/sessionctx/variable/session.go | Add SessionVars.CoprResolveLockLite field. |
| pkg/sessionctx/vardef/tidb_vars.go | Define sysvar name and default value constant. |
| pkg/session/session.go | Include the session flag in DistSQLContext construction. |
| pkg/kv/kv.go | Add CoprResolveLockLite to kv.Request for downstream plumbing. |
| pkg/distsql/request_builder.go | Copy DistSQLContext.CoprResolveLockLite into kv.Request. |
| pkg/distsql/context/context.go | Add flag to DistSQLContext struct (inherits into Detach() via struct copy). |
| pkg/distsql/context/context_test.go | Extend detach test coverage for the new field. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }}, | ||
| {Scope: vardef.ScopeGlobal | vardef.ScopeSession, Name: vardef.TiDBCoprResolveLockLite, Value: BoolToOnOff(vardef.DefTiDBCoprResolveLockLite), Type: vardef.TypeBool, SetSession: func(s *SessionVars, val string) error { | ||
| s.CoprResolveLockLite = TiDBOptOn(val) | ||
| return nil |
Comment on lines
373
to
+376
| builder.Request.RunawayChecker = dctx.RunawayChecker | ||
| builder.Request.TiKVClientReadTimeout = dctx.TiKVClientReadTimeout | ||
| builder.Request.MaxExecutionTime = dctx.MaxExecutionTime | ||
| builder.Request.CoprResolveLockLite = dctx.CoprResolveLockLite |
f7665ab to
bc40d9d
Compare
Add a session variable to control whether coprocessor resolves locks synchronously. When ON (default), lock resolution blocks until complete before retrying. When OFF, locks are resolved asynchronously in goroutines. Works with the new SyncResolve option in client-go's ResolveLocksOptions, which forces synchronous resolution while preserving ForRead semantics (read-through for canIgnore/canAccess classification).
bc40d9d to
cfdaa05
Compare
…gcap#64501) close pingcap#60316 (cherry picked from commit 6bb7785)
Signed-off-by: ekexium <eke@fastmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number: close #xxx
Problem Summary:
What changed and how does it work?
SessionVars.CoprResolveLockLite
→ DistSQLContext.CoprResolveLockLite
→ kv.Request.CoprResolveLockLite
→ NewClientHelper(..., resolveLite)
→ ClientHelper.resolveLite
→ ResolveLocksWithOpts(opts.Lite = true)
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.