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

meta: introduce metabuild.Context to build meta #56176

Merged
merged 12 commits into from
Sep 26, 2024

Conversation

lcwangchao
Copy link
Collaborator

What problem does this PR solve?

Issue Number: close #56175

What changed and how does it work?

A new package pkg/meta/metabuild is introduced. And metabuild.Context is proposed to build metas like meta.TableInfo , meta.ColumnInfo, meta.IndexInfo, etc ...

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 Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 20, 2024
Copy link

tiprow bot commented Sep 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.

@@ -182,15 +183,6 @@ func (d *SchemaTracker) CreateTable(ctx sessionctx.Context, s *ast.CreateTableSt
if schema == nil {
return infoschema.ErrDatabaseNotExists.GenWithStackByArgs(ident.Schema)
}
// suppress ErrTooLongKey
ctx.SetValue(ddl.SuppressErrorTooLongKeyKey, true)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

SuppressErrorTooLongKeyKey is not needed now. We can specify some extra options when constructing metabuild.Context

Copy link

codecov bot commented Sep 20, 2024

Codecov Report

Attention: Patch coverage is 93.27485% with 23 lines in your changes missing coverage. Please review.

Project coverage is 76.1978%. Comparing base (cabedbc) to head (fd89ed4).
Report is 1 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #56176        +/-   ##
================================================
+ Coverage   73.4321%   76.1978%   +2.7656%     
================================================
  Files          1605       1629        +24     
  Lines        445810     454140      +8330     
================================================
+ Hits         327368     346045     +18677     
+ Misses        98386      86639     -11747     
- Partials      20056      21456      +1400     
Flag Coverage Δ
integration 51.8490% <78.3625%> (?)
unit 72.6037% <88.8888%> (+0.0888%) ⬆️

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

Components Coverage Δ
dumpling 52.9478% <ø> (ø)
parser ∅ <ø> (∅)
br 63.0736% <ø> (+17.0694%) ⬆️

func checkTooBigFieldLengthAndTryAutoConvert(tp *types.FieldType, colName string, sessVars *variable.SessionVars) error {
if sessVars != nil && !sessVars.SQLMode.HasStrictMode() && tp.GetType() == mysql.TypeVarchar {
func checkTooBigFieldLengthAndTryAutoConvert(ctx *metabuild.Context, tp *types.FieldType, colName string) error {
if !ctx.GetSQLMode().HasStrictMode() && tp.GetType() == mysql.TypeVarchar {
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 ctx here is always not nil. So I removed sessVars != nil

@lcwangchao lcwangchao force-pushed the metabuildctx branch 4 times, most recently from 8474a0b to c734008 Compare September 20, 2024 04:13
@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Sep 20, 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.

Comment on lines -277 to +262
if ctx == nil || (ctx.GetSessionVars().SQLMode.HasStrictMode() && !suppressErrorTooLongKeyForSchemaTracker(ctx)) {
// return error in strict sql mode
if !suppressTooLongKeyErr {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@lcwangchao lcwangchao force-pushed the metabuildctx branch 2 times, most recently from 8181ee9 to bf1051f Compare September 20, 2024 06:12
Copy link
Contributor

@D3Hunter D3Hunter left a comment

Choose a reason for hiding this comment

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

23/28

pkg/meta/metabuild/context_test.go Outdated Show resolved Hide resolved
pkg/ddl/foreign_key.go Outdated Show resolved Hide resolved
@lcwangchao lcwangchao force-pushed the metabuildctx branch 2 times, most recently from 9d24559 to 80f39cc Compare September 23, 2024 07:09
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

@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Sep 23, 2024
Copy link

ti-chi-bot bot commented Sep 25, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: D3Hunter, XuHuaiyu, 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

@ti-chi-bot ti-chi-bot bot added the approved label Sep 25, 2024
@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Sep 25, 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.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Sep 25, 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.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Sep 25, 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.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Sep 25, 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.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Sep 25, 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.

@purelind
Copy link
Contributor

/retest

Copy link

tiprow bot commented Sep 25, 2024

@purelind: 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.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Sep 25, 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.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Sep 25, 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.

@ti-chi-bot ti-chi-bot bot merged commit 7b6209d into pingcap:master Sep 26, 2024
23 checks passed
@lcwangchao lcwangchao deleted the metabuildctx branch September 26, 2024 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

introduce standalone context to build metas
5 participants