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: update some vars for internal sessions correctly (#53977) #53986

Merged

Conversation

ti-chi-bot
Copy link
Member

@ti-chi-bot ti-chi-bot commented Jun 13, 2024

This is an automated cherry-pick of #53977

What problem does this PR solve?

Issue Number: close #53972

Problem Summary:

What changed and how does it work?

We need to always update these vars for internal sessions. Otherwise, it won't work. And we will use the wrong default value.

See more at the issue.

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.

修复 tidb_analyze_partition_concurrency 在自动分析无法生效的问题
Fix tidb_analyze_partition_concurrency not working in auto-analysis

@ti-chi-bot ti-chi-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/planner SIG: Planner size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 13, 2024
@ti-chi-bot ti-chi-bot added the type/cherry-pick-for-release-7.1 This PR is cherry-picked to release-7.1 from a source PR. label Jun 13, 2024
@ti-chi-bot ti-chi-bot bot added do-not-merge/cherry-pick-not-approved size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 13, 2024
@fixdb
Copy link
Contributor

fixdb commented Jun 13, 2024

@hi-rustin Do we really need it for 7.1?

@ti-chi-bot ti-chi-bot added the cherry-pick-approved Cherry pick PR approved by release team. label Jun 18, 2024
@Rustin170506
Copy link
Member

Rustin170506 commented Nov 11, 2024

Tesed locally:
Before change:

[2024/11/11 17:15:45.239 +08:00] [INFO] [analyze.go:288] ["analyze partition concurrency"] [concurrency=0]

After change:

[2024/11/11 17:26:16.875 +08:00] [INFO] [analyze.go:295] ["analyze partition concurrency"] [concurrency=1]

Test step:

  1. Start the cluster: tiup playground v7.1.0 --db.binpath /Users/rustin/code/tidb/bin/tidb-server
  2. Print the var
	logutil.BgLogger().Info("analyze partition concurrency", zap.Int("concurrency", partitionStatsConcurrency))
  1. Insert data and set the var:
SET @@global.tidb_analyze_partition_concurrency = 4;
CREATE TABLE test.my_table (
    id INT PRIMARY KEY,
    name VARCHAR(255),
    value INT,
    big_number BIGINT,
    INDEX idx_big_number (big_number)
);

INSERT INTO test.my_table (id, name, value, big_number)
WITH RECURSIVE numbers AS (
    SELECT 1 as n
    UNION ALL
    SELECT n + 1 FROM numbers WHERE n < 1000
)
SELECT
    n as id,
    CONCAT('Name_', n) as name,
    FLOOR(RAND() * 1000) as value,
    n * 1000000000 + FLOOR(RAND() * 1000000000) as big_number
FROM numbers;
SELECT @@global.tidb_analyze_partition_concurrency;
  1. Check the log
[2024/11/11 17:51:57.280 +08:00] [INFO] [analyze.go:298] ["analyze partition concurrency"] [concurrency=4]

Signed-off-by: Rustin170506 <[email protected]>
@Rustin170506 Rustin170506 force-pushed the cherry-pick-53977-to-release-7.1 branch from c30c010 to c44850d Compare November 11, 2024 09:35
@ti-chi-bot ti-chi-bot bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Nov 11, 2024
@Rustin170506
Copy link
Member

7.1 doesn't have tidb_enable_async_merge_global_stats.

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Nov 11, 2024
@Rustin170506
Copy link
Member

/retest

@ti-chi-bot ti-chi-bot bot added the lgtm label Nov 11, 2024
Copy link

ti-chi-bot bot commented Nov 11, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AilinKid, 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:
  • OWNERS [AilinKid,Rustin170506]

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 removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Nov 11, 2024
Copy link

ti-chi-bot bot commented Nov 11, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-11 09:46:10.34308131 +0000 UTC m=+263132.533950305: ☑️ agreed by Rustin170506.
  • 2024-11-11 09:51:43.415152836 +0000 UTC m=+263465.606021831: ☑️ agreed by AilinKid.

@Rustin170506
Copy link
Member

/retest

Copy link

codecov bot commented Nov 11, 2024

Codecov Report

Attention: Patch coverage is 45.45455% with 6 lines in your changes missing coverage. Please review.

Please upload report for BASE (release-7.1@8003f50). Learn more about missing BASE report.

Additional details and impacted files
@@               Coverage Diff                @@
##             release-7.1     #53986   +/-   ##
================================================
  Coverage               ?   73.4932%           
================================================
  Files                  ?       1212           
  Lines                  ?     381439           
  Branches               ?          0           
================================================
  Hits                   ?     280332           
  Misses                 ?      83200           
  Partials               ?      17907           

@ti-chi-bot ti-chi-bot bot merged commit 6336e2f into pingcap:release-7.1 Nov 11, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved cherry-pick-approved Cherry pick PR approved by release team. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/planner SIG: Planner size/S Denotes a PR that changes 10-29 lines, ignoring generated files. type/cherry-pick-for-release-7.1 This PR is cherry-picked to release-7.1 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants