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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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 the release-note-none Denotes a PR that doesn't merit a release note. label Sep 20, 2024
Copy link

ti-chi-bot bot commented Sep 20, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign benjamin2037, zanmato1984 for approval, ensuring that each of them provides their approval before proceeding. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label 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.40974% with 23 lines in your changes missing coverage. Please review.

Project coverage is 57.0354%. Comparing base (68fdf55) to head (bf1051f).
Report is 11 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #56176         +/-   ##
=================================================
- Coverage   72.9122%   57.0354%   -15.8769%     
=================================================
  Files          1631       1760        +129     
  Lines        448528     635228     +186700     
=================================================
+ Hits         327032     362305      +35273     
- Misses       101356     248019     +146663     
- Partials      20140      24904       +4764     
Flag Coverage Δ
integration 39.4381% <80.8022%> (?)
unit 72.4882% <89.6848%> (+0.4301%) ⬆️

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

Components Coverage Δ
dumpling 52.9567% <ø> (ø)
parser ∅ <ø> (∅)
br 63.0659% <ø> (+17.2739%) ⬆️

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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
1 participant