[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
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

parser: add traffic capture/replay statements in the parser #57808

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

djshow832
Copy link
Contributor
@djshow832 djshow832 commented Nov 28, 2024

What problem does this PR solve?

Issue Number: close #57807

Problem Summary:
Support SQL to capture and replay traffic using TiProxy. This is a parser PR.

TRAFFIC CAPTURE TO "/tmp/traffic" DURATION="1h" ENCRYPTION_METHOD="aes256-ctr" COMPRESS=false
TRAFFIC REPLAY FROM "/tmp/traffic" USER="u1" PASSWORD="123456" SPEED=1.0
CANCEL TRAFFIC JOBS
SHOW TRAFFIC JOBS

Refer to similar statements:

PLAN REPLAYER DUMP EXPLAIN select * from t;
PLAN REPLAYER LOAD 'file_name';
PLAN REPLAYER CAPTURE 'sql_digest' '*';
SELECT * FROM mysql.plan_replayer_task;    # query plan replayer tasks

BACKUP DATABASE `test` TO 's3://backup/' COMPRESSION_LEVEL=3 ENCRYPTION_METHOD='aes256';
SHOW BACKUPS;
RESTORE DATABASE * FROM 's3://backup/'  CONCURRENCY = 64 CHECKSUM = FALSE;
SHOW RESTORES;
KILL 5857102839209263511;   # kill backup/restore job
SHOW BR JOB 1;
CANCEL BR JOB 1;

IMPORT INTO t FROM '/path/to/file.csv' WITH SKIP_ROWS=1 THREAD=10;
SHOW IMPORT JOBS;
CANCEL IMPORT JOB 1;

ADMIN CANCEL DDLS;
ADMIN SHOW DDL JOBS;

SET @@global.tidb_ttl_job_enable = OFF;     # cancel all ttl jobs
SELECT * FROM mysql.tidb_ttl_table_status;    # query ttl jobs

What changed and how does it work?

  • Add the grammar above in the parser. All the tokens are not keywords.
  • Add COMPRESS() to FunctionCallNonKeyword because the name conflicts.
  • Define TrafficStmt. CANCEL TRAFFIC JOBS and SHOW TRAFFIC JOBS are also TrafficStmt, the same as BRIEStmt, to keep all traffic-related codes together.

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 do-not-merge/needs-triage-completed release-note-none Denotes a PR that doesn't merit a release note. labels Nov 28, 2024
Copy link
ti-chi-bot bot commented Nov 28, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign bb7133, benmeadowcroft for approval, ensuring that each of them provides their approval before proceeding. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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 size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Nov 28, 2024
Copy link
tiprow bot commented Nov 28, 2024

Hi @djshow832. 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 Nov 29, 2024

Codecov Report

Attention: Patch coverage is 94.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 73.5327%. Comparing base (d0de86b) to head (adb57c8).
Report is 33 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #57808        +/-   ##
================================================
+ Coverage   72.8369%   73.5327%   +0.6958%     
================================================
  Files          1677       1677                
  Lines        464141     470593      +6452     
================================================
+ Hits         338066     346040      +7974     
+ Misses       105185     103617      -1568     
- Partials      20890      20936        +46     
Flag Coverage Δ
integration 43.3873% <ø> (?)
unit 72.2765% <94.0000%> (+0.0328%) ⬆️

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

Components Coverage Δ
dumpling 52.7673% <ø> (ø)
parser ∅ <ø> (∅)
br 45.2605% <ø> (-0.4341%) ⬇️

@djshow832
Copy link
Contributor Author

@benmeadowcroft, @bb7133 PTAL

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

Support traffic statements in parser
1 participant