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

infoschema, util: refresh statement summary table periodically (#13680) #14161

Merged
merged 1 commit into from
Dec 20, 2019

Conversation

djshow832
Copy link
Contributor

conflicting files:
global_vars_cache.go
set.go
statement_summary_test.go
sysvar.go
tidb_vars.go
varsutil.go
varsutil_test.go

What problem does this PR solve?

Refresh the table events_statements_summary_by_digest periodically.

What is changed and how it works?

If the current summary exists for over tidb_stmt_summary_refresh_interval seconds, then replace it with a new one.

Check List

Tests

  • Unit test
  • Manual test (add detailed scripts or steps below)
mysql> select * from events_statements_summary_by_digest limit 1\G
*************************** 1. row ***************************
       SUMMARY_BEGIN_TIME: 2019-11-22 13:00:00
                STMT_TYPE: select
              SCHEMA_NAME: performance_schema
                   DIGEST: 688edff0859079e96540c6161b08dde9ab5f8654bd2755a0dbca27de5e06f93e
              DIGEST_TEXT: select * from events_statements_summary_by_digest
              TABLE_NAMES: performance_schema.events_statements_summary_by_digest
              INDEX_NAMES: NULL
              SAMPLE_USER: [email protected]
               EXEC_COUNT: 1
              SUM_LATENCY: 749473
              MAX_LATENCY: 749473
              MIN_LATENCY: 749473
              AVG_LATENCY: 749473
        AVG_PARSE_LATENCY: 56405
        MAX_PARSE_LATENCY: 56405
      AVG_COMPILE_LATENCY: 444081
      MAX_COMPILE_LATENCY: 444081
             COP_TASK_NUM: 0
     AVG_COP_PROCESS_TIME: 0
     MAX_COP_PROCESS_TIME: 0
  MAX_COP_PROCESS_ADDRESS: NULL
        AVG_COP_WAIT_TIME: 0
        MAX_COP_WAIT_TIME: 0
     MAX_COP_WAIT_ADDRESS: NULL
         AVG_PROCESS_TIME: 0
         MAX_PROCESS_TIME: 0
            AVG_WAIT_TIME: 0
            MAX_WAIT_TIME: 0
         AVG_BACKOFF_TIME: 0
         MAX_BACKOFF_TIME: 0
           AVG_TOTAL_KEYS: 0
           MAX_TOTAL_KEYS: 0
       AVG_PROCESSED_KEYS: 0
       MAX_PROCESSED_KEYS: 0
        AVG_PREWRITE_TIME: 0
        MAX_PREWRITE_TIME: 0
          AVG_COMMIT_TIME: 0
          MAX_COMMIT_TIME: 0
   AVG_GET_COMMIT_TS_TIME: 0
   MAX_GET_COMMIT_TS_TIME: 0
  AVG_COMMIT_BACKOFF_TIME: 0
  MAX_COMMIT_BACKOFF_TIME: 0
    AVG_RESOLVE_LOCK_TIME: 0
    MAX_RESOLVE_LOCK_TIME: 0
AVG_LOCAL_LATCH_WAIT_TIME: 0
MAX_LOCAL_LATCH_WAIT_TIME: 0
           AVG_WRITE_KEYS: 0
           MAX_WRITE_KEYS: 0
           AVG_WRITE_SIZE: 0
           MAX_WRITE_SIZE: 0
     AVG_PREWRITE_REGIONS: 0
     MAX_PREWRITE_REGIONS: 0
            AVG_TXN_RETRY: 0
            MAX_TXN_RETRY: 0
            BACKOFF_TYPES: NULL
                  AVG_MEM: 0
                  MAX_MEM: 0
        AVG_AFFECTED_ROWS: 0
               FIRST_SEEN: 2019-11-22 13:22:53
                LAST_SEEN: 2019-11-22 13:22:53
        QUERY_SAMPLE_TEXT: select * from events_statements_summary_by_digest

Code changes

  • Has exported function/method change

Side effects

  • Possible performance regression
  • Increased code complexity

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release note

  • Refresh the system table events_statements_summary_by_digest periodically.

@djshow832
Copy link
Contributor Author

/run-all-tests

@djshow832
Copy link
Contributor Author

/run-unit-test

@djshow832
Copy link
Contributor Author

/run-all-tests

@zimulala zimulala added the priority/release-blocker This issue blocks a release. Please solve it ASAP. label Dec 20, 2019
Copy link
Contributor

@AilinKid AilinKid left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@bb7133 bb7133 left a comment

Choose a reason for hiding this comment

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

LGTM

@bb7133 bb7133 merged commit c6c5fbf into pingcap:release-3.0 Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority/release-blocker This issue blocks a release. Please solve it ASAP. type/usability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants