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, stat: switch to new struct for remove partition, flash back and remove DDLEvent #55973

Merged
merged 19 commits into from
Sep 11, 2024

Conversation

fzzf678
Copy link
Contributor

@fzzf678 fzzf678 commented Sep 10, 2024

What problem does this PR solve?

Issue Number: ref #55723

Problem Summary:

What changed and how does it work?

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. sig/planner SIG: Planner size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 10, 2024
Copy link

tiprow bot commented Sep 10, 2024

Hi @fzzf678. 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.

Copy link

codecov bot commented Sep 10, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 13 lines in your changes missing coverage. Please review.

Project coverage is 57.2276%. Comparing base (ea6dba8) to head (8b171a4).
Report is 11 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #55973         +/-   ##
=================================================
- Coverage   72.8567%   57.2276%   -15.6292%     
=================================================
  Files          1605       1755        +150     
  Lines        446200     634824     +188624     
=================================================
+ Hits         325087     363295      +38208     
- Misses       101079     246800     +145721     
- Partials      20034      24729       +4695     
Flag Coverage Δ
integration 39.7298% <72.1153%> (?)
unit 72.2126% <76.9230%> (+0.2341%) ⬆️

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

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

Copy link
Contributor

@lance6716 lance6716 left a comment

Choose a reason for hiding this comment

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

rest lgtm

pkg/ddl/util/schema_change_notifier.go Outdated Show resolved Hide resolved
pkg/ddl/util/schema_change_notifier.go Outdated Show resolved Hide resolved
pkg/statistics/handle/ddl/ddl.go Outdated Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Sep 10, 2024
Copy link
Member

@Rustin170506 Rustin170506 left a comment

Choose a reason for hiding this comment

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

Thansk!

result := e.String()

// Check the result
expected := "(Event Type: add column, Table ID: 1, Table Name: Table1, Old Table ID: 4, Old Table Name: Table2, Partition Name: , Partition ID: 2, Partition Name: , Partition ID: 3, Dropped Partition Name: , Dropped Partition ID: 5, Dropped Partition Name: , Dropped Partition ID: 6, Column ID: 7, Column Name: Column1, Column ID: 8, Column Name: Column2)"
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to print an empty string if the name is empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed, only print non-empty name, PTAL again

pkg/statistics/handle/ddl/ddl.go Show resolved Hide resolved
if isSysDB, err := t.IsMemOrSysDB(sctx.(sessionctx.Context)); err != nil {
return err
} else if isSysDB {
// EXCHANGE PARTITION EVENT NOTES:
Copy link
Member

Choose a reason for hiding this comment

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

Better to keep this comment somewhere. We allow users to exchange one normal table for a system table.

Copy link
Member

@Rustin170506 Rustin170506 left a comment

Choose a reason for hiding this comment

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

rest LGTM

/hold

Feel free to unhold after you address them.

pkg/ddl/util/schema_change_notifier.go Outdated Show resolved Hide resolved
pkg/statistics/handle/ddl/ddl.go Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 10, 2024
Copy link

ti-chi-bot bot commented Sep 10, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lance6716, Rustin170506

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 approved lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 10, 2024
Copy link

ti-chi-bot bot commented Sep 10, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-09-10 06:58:03.163088673 +0000 UTC m=+339552.903512605: ☑️ agreed by lance6716.
  • 2024-09-10 09:09:19.749232423 +0000 UTC m=+347429.489656365: ☑️ agreed by Rustin170506.

case model.ActionFlashbackCluster:
return h.statsWriter.UpdateStatsVersion()
default:
return errors.Trace(errors.Errorf("unhandled DDL type %v", s.GetType()))
Copy link
Member

Choose a reason for hiding this comment

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

I think just an error log would be enough.

Copy link
Contributor

Choose a reason for hiding this comment

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

maybe use intest to remind PR author when adding new event types.

@fzzf678
Copy link
Contributor Author

fzzf678 commented Sep 10, 2024

/unhold

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 10, 2024
@Rustin170506
Copy link
Member

/hold

#55973 (comment)

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 10, 2024
@@ -183,7 +186,8 @@ func (h *ddlHandlerImpl) HandleDDLEvent(s *ddlutil.SchemaChangeEvent) error {
case model.ActionFlashbackCluster:
return h.statsWriter.UpdateStatsVersion()
default:
return errors.Trace(errors.Errorf("unhandled DDL type %v", s.GetType()))
intest.Assert(false)
logutil.StatsLogger().Error("Unhandled schema change event", zap.Stringer("type", s.GetType()))
Copy link
Member

Choose a reason for hiding this comment

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

Do we need to print the whole event here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What’s the purpose of printing the whole event in log?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just thought that the purpose of this default branch is to remind developer there is an unhandled event, any other use? 🤔

Copy link
Member

Choose a reason for hiding this comment

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

I guess it would be easier to figure out what information is in it. But I am okay with it if you only want to print the type here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

PTAL again 8b171a4

@Rustin170506
Copy link
Member

/unhold

Thank you very much.

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 11, 2024
@ti-chi-bot ti-chi-bot bot merged commit 2ea3542 into pingcap:master Sep 11, 2024
23 checks passed
Benjamin2037 pushed a commit to Benjamin2037/tidb that referenced this pull request Sep 11, 2024
Benjamin2037 pushed a commit to Benjamin2037/tidb that referenced this pull request Sep 11, 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 Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner 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.

3 participants