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

executor, session: fix ExecStmt.OriginText to use the actual original text #57393

Merged
merged 4 commits into from
Nov 20, 2024

Conversation

b6g
Copy link
Contributor

@b6g b6g commented Nov 14, 2024

What problem does this PR solve?

Issue Number: close #57396

Problem Summary:

When a query statement is not in utf-8, e.g. _binary 'some_binary_data', GENERAL_LOG logs the utf-8 text, not the original text. This is because ExecStmt.OriginText simply returns Text, not StmtNode.OriginalText.

This PR fixes ExecStmt.OriginText to return StmtNode.OriginalText, and includes the quoted query in GENERAL_LOG.

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

@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. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 14, 2024
Copy link

ti-chi-bot bot commented Nov 14, 2024

Hi @b6g. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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/test-infra repository.

Copy link

tiprow bot commented Nov 14, 2024

Hi @b6g. 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.

@lance6716
Copy link
Contributor

/ok-to-test

@ti-chi-bot ti-chi-bot bot added ok-to-test Indicates a PR is ready to be tested. do-not-merge/needs-triage-completed and removed needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. do-not-merge/needs-linked-issue labels Nov 15, 2024
Copy link

codecov bot commented Nov 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 73.7168%. Comparing base (058d947) to head (1b01e59).
Report is 17 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #57393        +/-   ##
================================================
+ Coverage   72.8577%   73.7168%   +0.8590%     
================================================
  Files          1672       1676         +4     
  Lines        462711     468570      +5859     
================================================
+ Hits         337121     345415      +8294     
+ Misses       104809     102489      -2320     
+ Partials      20781      20666       -115     
Flag Coverage Δ
integration 43.4560% <62.5000%> (?)
unit 72.5887% <100.0000%> (+0.3436%) ⬆️

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

Components Coverage Δ
dumpling 52.7673% <ø> (ø)
parser ∅ <ø> (∅)
br 46.6973% <ø> (+1.6157%) ⬆️
---- 🚨 Try these New Features:

@lance6716
Copy link
Contributor

/check-issue-triage-complete

@lance6716
Copy link
Contributor

Hi, the failed CI is TestBinaryPlanOfPreparedStmt. You can run it in your local environment to fix it

@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 15, 2024
@b6g b6g force-pushed the b6g/origin1 branch 2 times, most recently from 65e265c to dbc9f23 Compare November 17, 2024 05:52
@b6g
Copy link
Contributor Author

b6g commented Nov 17, 2024

Hi, the failed CI is TestBinaryPlanOfPreparedStmt. You can run it in your local environment to fix it

The test failed because OriginalSQL is needed by GetTextToLog to get the sql statement of a prepared query.

@lance6716
Copy link
Contributor

Hi, the failed CI is TestBinaryPlanOfPreparedStmt. You can run it in your local environment to fix it

The test failed because OriginalSQL is needed by GetTextToLog to get the sql statement of a prepared query.

The test is still failing now. Just a simple glance it checks that general log should contain the input data.

@b6g
Copy link
Contributor Author

b6g commented Nov 19, 2024

Hi, the failed CI is TestBinaryPlanOfPreparedStmt. You can run it in your local environment to fix it

The test failed because OriginalSQL is needed by GetTextToLog to get the sql statement of a prepared query.

The test is still failing now. Just a simple glance it checks that general log should contain the input data.

fixed

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Nov 19, 2024
@b6g
Copy link
Contributor Author

b6g commented Nov 19, 2024

Can I get another approval to merge the PR?

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

ti-chi-bot bot commented Nov 20, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lance6716, lcwangchao

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 [lance6716,lcwangchao]

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 20, 2024
Copy link

ti-chi-bot bot commented Nov 20, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-11-19 06:16:13.537886161 +0000 UTC m=+941735.728755155: ☑️ agreed by lance6716.
  • 2024-11-20 03:10:45.058579156 +0000 UTC m=+1232.678233669: ☑️ agreed by lcwangchao.

@ti-chi-bot ti-chi-bot bot merged commit 5450000 into pingcap:master Nov 20, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ExecStmt.OriginText doesn't return the original text
3 participants