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

ddl: introduce newReorgExprCtx to replace mock.Context usage #53389

Merged
merged 1 commit into from
May 21, 2024

Conversation

lcwangchao
Copy link
Collaborator

What problem does this PR solve?

Issue Number: ref #53388

Problem Summary:

see issue

What changed and how does it work?

introduce newReorgExprCtx to return an ExprContext for DDL reorg phase. newReorgExprCtx will replace newReorgSessCtx when only expr context is required.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

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

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 20, 2024
Copy link

tiprow bot commented May 20, 2024

Hi @lcwangchao. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

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-sigs/prow repository.

row := chk.GetRow(0)
if tblInfo.IsCommonHandle {
maxHandle, err = buildCommonHandleFromChunkRow(sessCtx.GetSessionVars().StmtCtx, tblInfo, pkIdx, handleCols, row)
maxHandle, err = buildCommonHandleFromChunkRow(time.UTC, tblInfo, pkIdx, handleCols, row)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

newReorgSessCtx always returns a location time.UTC. This replace is equivalent with the old implement

@@ -620,8 +634,7 @@ func buildCommonHandleFromChunkRow(sctx *stmtctx.StatementContext, tblInfo *mode
tablecodec.TruncateIndexValues(tblInfo, idxInfo, datumRow)

var handleBytes []byte
handleBytes, err := codec.EncodeKey(sctx.TimeZone(), nil, datumRow...)
err = sctx.HandleError(err)
handleBytes, err := codec.EncodeKey(loc, nil, datumRow...)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Seems the HandleError takes no effect here because ErrGroupTruncate is set to LevelError in sctx.ErrCtx(). Do we not need HandleError here

@@ -527,12 +527,12 @@ func loadDDLReorgVars(ctx context.Context, sessPool *sess.Pool) error {
return ddlutil.LoadDDLReorgVars(ctx, sCtx)
}

func makeupDecodeColMap(sessCtx sessionctx.Context, dbName model.CIStr, t table.Table) (map[int64]decoder.Column, error) {
func makeupDecodeColMap(dbName model.CIStr, t table.Table) (map[int64]decoder.Column, error) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Call of makeupDecodeColMap is writePhysicalTableRecord -> newBackfillScheduler -> newTxnBackfillScheduler -> makeupDecodeColMap. This is the only call chain. So we can just move the expr ctx construct into makeupDecodeColMap

Copy link

codecov bot commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.6156%. Comparing base (044f113) to head (a6d009c).
Report is 7 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #53389        +/-   ##
================================================
+ Coverage   74.4881%   74.6156%   +0.1275%     
================================================
  Files          1505       1505                
  Lines        356677     430246     +73569     
================================================
+ Hits         265682     321031     +55349     
- Misses        71649      89296     +17647     
- Partials      19346      19919       +573     
Flag Coverage Δ
integration 49.2177% <93.9393%> (?)
unit 71.3431% <96.9697%> (-1.9179%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 53.9957% <ø> (-2.3014%) ⬇️
parser ∅ <ø> (∅)
br 50.4028% <ø> (+7.3212%) ⬆️

@wuhuizuo
Copy link
Contributor

/test build

Copy link

tiprow bot commented May 20, 2024

@wuhuizuo: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/test build

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-sigs/prow repository.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented May 21, 2024

@lcwangchao: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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-sigs/prow repository.

Copy link
Member

@YangKeao YangKeao left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented May 21, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tangenta, YangKeao

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

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

ti-chi-bot bot commented May 21, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-05-21 04:32:18.197361994 +0000 UTC m=+2146091.954497566: ☑️ agreed by YangKeao.
  • 2024-05-21 05:44:03.00601386 +0000 UTC m=+2150396.763149432: ☑️ agreed by tangenta.

@ti-chi-bot ti-chi-bot bot merged commit 07508df into pingcap:master May 21, 2024
23 checks passed
@lcwangchao lcwangchao deleted the new_reorg_expr_ctx branch May 21, 2024 07:34
RidRisR pushed a commit to RidRisR/tidb that referenced this pull request May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none 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.

None yet

4 participants