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

statistics: log the db name #49011

Merged
merged 3 commits into from
Nov 30, 2023
Merged

Conversation

hi-rustin
Copy link
Member

@hi-rustin hi-rustin commented Nov 29, 2023

What problem does this PR solve?

Issue Number: ref #48929 (comment)

Problem Summary:

What changed and how does it work?

Printed the DB name in the logs.

Because changing the interface would have a significant invasive impact, the ctx was attached to the DDL handler. Otherwise, not only all the tests but also the handle's flush operation would have to query the schema by themselves.

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

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note-none size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 29, 2023
@hi-rustin
Copy link
Member Author

Test locally:

[2023/11/29 17:15:08.949 +08:00] [WARN] [ddl.go:145] ["drop partition with pseudo stats, usually it won't happen because we always load stats when initializing the handle"] [category=stats] [schema=test] [table=pt] [partition=p0]

Copy link
Member Author

@hi-rustin hi-rustin left a comment

Choose a reason for hiding this comment

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

🔢 Self-check

@@ -125,9 +130,12 @@ func (h *ddlHandlerImpl) HandleDDLEvent(t *util.DDLEvent) error {
// Get the count and modify count of the partition.
stats := h.statsHandler.GetPartitionStats(globalTableInfo, def.ID)
if stats.Pseudo {
is := h.ctx.GetDomainInfoSchema().(infoschema.InfoSchema)
Copy link
Member Author

Choose a reason for hiding this comment

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

Usually, this won't happen, so putting the getting scheme operation inside the if statement is OK.

@hi-rustin hi-rustin changed the title statistics: print the db name statistics: log the db name Nov 29, 2023
Copy link

codecov bot commented Nov 29, 2023

Codecov Report

Merging #49011 (bd3d7ff) into master (845b20c) will increase coverage by 1.4870%.
Report is 9 commits behind head on master.
The diff coverage is 38.4615%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #49011        +/-   ##
================================================
+ Coverage   70.9775%   72.4646%   +1.4870%     
================================================
  Files          1368       1391        +23     
  Lines        404391     411693      +7302     
================================================
+ Hits         287027     298332     +11305     
+ Misses        97368      94539      -2829     
+ Partials      19996      18822      -1174     
Flag Coverage Δ
integration 43.9371% <38.4615%> (?)
unit 70.9775% <ø> (-0.0001%) ⬇️

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

Components Coverage Δ
dumpling 53.9663% <ø> (ø)
parser ∅ <ø> (∅)
br 48.3370% <ø> (-4.6887%) ⬇️

@hi-rustin
Copy link
Member Author

/retest

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
@hi-rustin
Copy link
Member Author

Tested again:

[2023/11/29 19:16:03.458 +08:00] [WARN] [ddl.go:153] ["drop partition with pseudo stats, usually it won't happen because we always load stats when initializing the handle"] [category=stats] [schema=test] [table=pt] [partition=p0]

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
Copy link
Member Author

@hi-rustin hi-rustin left a comment

Choose a reason for hiding this comment

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

🔢 Self-check

Copy link

ti-chi-bot bot commented Nov 29, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: qw4990, time-and-fate

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:
  • OWNERS [qw4990,time-and-fate]

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 Nov 29, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-11-29 11:20:47.075846247 +0000 UTC m=+1008075.741072430: ☑️ agreed by time-and-fate.
  • 2023-11-29 12:48:15.129619094 +0000 UTC m=+1013323.794845314: ☑️ agreed by qw4990.

@hi-rustin
Copy link
Member Author

/retest

@ti-chi-bot ti-chi-bot bot merged commit 333e8c3 into pingcap:master Nov 30, 2023
16 checks passed
@hi-rustin hi-rustin deleted the rustin-patch-db-name branch November 30, 2023 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved component/statistics lgtm release-note-none sig/planner SIG: Planner size/S Denotes a PR that changes 10-29 lines, ignoring generated files. skip-issue-check
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants