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

runtime filter: fix timezone error in runtime filter #8273

Merged
merged 9 commits into from
Oct 30, 2023

Conversation

elsa0520
Copy link
Contributor

@elsa0520 elsa0520 commented Oct 30, 2023

What problem does this PR solve?

This pr fix #8222.
The rs operator which is parsed by filter should change the timezone to UTF when the column type is timestamp.

The tiflash storage layer store the timestamp type value using UTF. So all of literal include runtime filter values should be changed to UTF timezone.

Issue Number: close #8222

Problem Summary:

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
tiup playground --tiflash 1
use test;
create table t1(k1 int , k2 timestamp);
create table t2(k1 int, k2 timestamp);
alter table t1 set tiflash replica 1;
alter table t2 set tiflash replica 1;
set tidb_isolation_read_engines = "tiflash";
insert into t1 values (1, "2023-10-20 00:00:00");
insert into t2 values (1, "2023-10-20 00:00:00");
set tidb_runtime_filter_mode="LOCAL";
explain select * from t1, t2 where t1.k2=t2.k2; -- with runtime filter
mysql> select * from t1, t2 where t1.k2=t2.k2;
+------+---------------------+------+---------------------+
| k1   | k2                  | k1   | k2                  |
+------+---------------------+------+---------------------+
|    1 | 2023-10-20 00:00:00 |    1 | 2023-10-20 00:00:00 |
+------+---------------------+------+---------------------+
1 row in set (0.02 sec)
  • No code

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

None

Fix version

v7.5

This pr fix pingcap#8222.
The rs operator which is parsed by filter should change the timezone to UTF when the column type is timestamp.

The tiflash storage layer store the timestamp type value using UTF.
So all of literal include runtime filter values should be changed to UTF timezone.
@ti-chi-bot ti-chi-bot bot added 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 30, 2023
@elsa0520
Copy link
Contributor Author

/cherry-pick release-7.5

@ti-chi-bot
Copy link
Member

@elsa0520: once the present PR merges, I will cherry-pick it on top of release-7.5 in the new PR and assign it to you.

In response to this:

/cherry-pick release-7.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.

Copy link
Contributor

@Lloyd-Pottiger Lloyd-Pottiger left a comment

Choose a reason for hiding this comment

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

Other LGTM

tests/fullstack-test/mpp/runtime_filter.test Show resolved Hide resolved
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Oct 30, 2023
@JaySon-Huang
Copy link
Contributor

Fix version
v7.1 v7.5

Does this bug affect the release-7.1 branch? @elsa0520

@JaySon-Huang
Copy link
Contributor

/run-all-tests

Copy link
Contributor

@JaySon-Huang JaySon-Huang 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 lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Oct 30, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 30, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-10-30 06:22:22.150325978 +0000 UTC m=+2847739.737436120: ☑️ agreed by Lloyd-Pottiger.
  • 2023-10-30 07:53:50.312427545 +0000 UTC m=+2853227.899537691: ☑️ agreed by JaySon-Huang.

@JaySon-Huang
Copy link
Contributor

Fix version
v7.1 v7.5

Does this bug affect the release-7.1 branch? @elsa0520

Confirm that this bug does not affect the release-7.1 branch

@elsa0520
Copy link
Contributor Author

Fix version
v7.1 v7.5

Does this bug affect the release-7.1 branch? @elsa0520

Confirm that this bug does not affect the release-7.1 branch

Only v7.3 ~v7.5

@Lloyd-Pottiger
Copy link
Contributor

/run-all-tests

Copy link
Contributor

@JaySon-Huang JaySon-Huang left a comment

Choose a reason for hiding this comment

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

Fix test cases

[2023-10-30T09:30:08.983Z] fullstack-test/mpp/runtime_filter.test: Running
[2023-10-30T09:30:08.983Z]   File: fullstack-test/mpp/runtime_filter.test
[2023-10-30T09:30:08.983Z]   Error line: 36
[2023-10-30T09:30:08.983Z]   Error: insert into t1_timestamp values (1, "2023-10-20 00:00:00");
[2023-10-30T09:30:08.983Z]   Result:
[2023-10-30T09:30:08.983Z]     ERROR 1049 (42000): Unknown database '00:00:00);'
[2023-10-30T09:30:08.983Z]   Expected:
[2023-10-30T09:30:08.983Z]     <nothing>

tests/fullstack-test/mpp/runtime_filter.test Outdated Show resolved Hide resolved
tests/fullstack-test/mpp/runtime_filter.test Outdated Show resolved Hide resolved
@JaySon-Huang
Copy link
Contributor

/approve

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 30, 2023

@JaySon-Huang: It seems you want to merge this PR, I will help you trigger all the tests:

/run-all-tests

  • Currently the CI jobs are not prow job style, we need it to notify Jenkins server to run them.
  • If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

If you have any questions about the PR merge process, please refer to pr process.

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
Copy link
Contributor

ti-chi-bot bot commented Oct 30, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JaySon-Huang, Lloyd-Pottiger

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 [JaySon-Huang,Lloyd-Pottiger]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@JaySon-Huang JaySon-Huang changed the title [Bug] runtime filter: fix timezone error in runtime filter [bugfix] runtime filter: fix timezone error in runtime filter Oct 30, 2023
@JaySon-Huang JaySon-Huang changed the title [bugfix] runtime filter: fix timezone error in runtime filter runtime filter: fix timezone error in runtime filter Oct 30, 2023
tests/fullstack-test/mpp/runtime_filter.test Outdated Show resolved Hide resolved
tests/fullstack-test/mpp/runtime_filter.test Outdated Show resolved Hide resolved
tests/fullstack-test/mpp/runtime_filter.test Outdated Show resolved Hide resolved
tests/fullstack-test/mpp/runtime_filter.test Outdated Show resolved Hide resolved
@JaySon-Huang
Copy link
Contributor

/run-all-tests

@ti-chi-bot ti-chi-bot bot merged commit ceb7c24 into pingcap:master Oct 30, 2023
@ti-chi-bot
Copy link
Member

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

ti-chi-bot pushed a commit to ti-chi-bot/tiflash that referenced this pull request Oct 30, 2023
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/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.

Query result maybe wrong when runtime filter on timestamp column
4 participants