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

*: fix wrong result when to concurrency merge global stats #48852

Merged
merged 10 commits into from
Nov 24, 2023

Conversation

hawkingrei
Copy link
Member

@hawkingrei hawkingrei commented Nov 23, 2023

What problem does this PR solve?

Issue Number: close #48713

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

Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue do-not-merge/needs-tests-checked release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 23, 2023
Copy link

codecov bot commented Nov 23, 2023

Codecov Report

Merging #48852 (82e612d) into master (522cd03) will increase coverage by 1.6155%.
Report is 1 commits behind head on master.
The diff coverage is 96.9697%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #48852        +/-   ##
================================================
+ Coverage   71.0271%   72.6426%   +1.6155%     
================================================
  Files          1367       1391        +24     
  Lines        404903     411535      +6632     
================================================
+ Hits         287591     298950     +11359     
+ Misses        97306      93662      -3644     
+ Partials      20006      18923      -1083     
Flag Coverage Δ
integration 43.6089% <12.1212%> (?)
unit 71.0031% <96.9697%> (-0.0240%) ⬇️

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

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

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 23, 2023
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 23, 2023
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 23, 2023
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 24, 2023
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 24, 2023
worker.respCh <- resp
return
}

partNum := len(allTopNs)
Copy link
Member Author

Choose a reason for hiding this comment

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

BUG 1:

It should check all tops. but here is to check the part. it will create a bug.

counter[encodedVal] += float64(val.Count)
worker.mu.Lock()
_, exists := worker.counter[encodedVal]
worker.counter[encodedVal] += float64(val.Count)
if exists {
Copy link
Member Author

@hawkingrei hawkingrei Nov 24, 2023

Choose a reason for hiding this comment

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

BUG 2

it should merge the global counter. but it merge the counter in echo worker.

Copy link
Member Author

Choose a reason for hiding this comment

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

BUG 3

and it will create wrong result from BinarySearchRemoveVal. it will remove it second.

@@ -1361,7 +1361,7 @@ const (
DefTiDBOptRangeMaxSize = 64 * int64(size.MB) // 64 MB
DefTiDBCostModelVer = 2
DefTiDBServerMemoryLimitSessMinSize = 128 << 20
DefTiDBMergePartitionStatsConcurrency = 1
DefTiDBMergePartitionStatsConcurrency = 2
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a todo comment to change it back 1 (This is a temp value just for test concurrency partition stats)

Copy link
Member Author

Choose a reason for hiding this comment

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

I have been reverted.

Copy link
Contributor

@elsa0520 elsa0520 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 Nov 24, 2023
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 24, 2023
Copy link

ti-chi-bot bot commented Nov 24, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-11-24 01:51:18.823869846 +0000 UTC m=+541907.489096040: ☑️ agreed by elsa0520.
  • 2023-11-24 02:23:38.946387218 +0000 UTC m=+543847.611613413: ☑️ agreed by AilinKid.

Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
Copy link

ti-chi-bot bot commented Nov 24, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AilinKid, elsa0520

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 Nov 24, 2023
@hawkingrei
Copy link
Member Author

/retest

@ti-chi-bot ti-chi-bot bot merged commit 26db590 into pingcap:master Nov 24, 2023
16 checks passed
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #48864.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Nov 24, 2023
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@hawkingrei hawkingrei deleted the fix_bug_for_cc branch November 28, 2023 10:03
hawkingrei added a commit that referenced this pull request Nov 28, 2023
@hawkingrei
Copy link
Member Author

/cherrypick release-7.1
/cherrypick release-6.5

@ti-chi-bot
Copy link
Member

@hawkingrei: new pull request created to branch release-6.5: #51146.

In response to this:

/cherrypick release-7.1
/cherrypick release-6.5

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 ti-community-infra/tichi repository.

ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Feb 19, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
ti-chi-bot pushed a commit to ti-chi-bot/tidb that referenced this pull request Feb 19, 2024
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot
Copy link
Member

@hawkingrei: new pull request created to branch release-7.1: #51147.

In response to this:

/cherrypick release-7.1
/cherrypick release-6.5

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 ti-community-infra/tichi repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. release-note-none Denotes a PR that doesn't merit a release note. 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.

raise illegal bucket order while to merge global stats
4 participants