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

expressions: make time func now related unit tests stable(#11412)(#11342) #11394

Merged
merged 17 commits into from
Aug 5, 2019

Conversation

cfzjywxk
Copy link
Contributor

What problem does this PR solve?

cherry-pick for #11342.

MySQL will set time to “”time_cache“ structure before doing one command(COM_XXX)
later expresission calculation will use this timestamp as time value

TiDB logic different and default column calculation and now expr calculation will try to get timestamp twice.

more details see jira issue#4391
eg:
TiDB

CREATE TABLE tt4 (
c1 timestamp DEFAULT CURRENT_TIMESTAMP,
c2 int(11) DEFAULT NULL,
c3 timestamp DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin

insert into tt4 set c1 = current_timestamp, c2 = sleep(2);
mysql> select c1 = c3 from tt4;
+---------+
| c1 = c3 |
+---------+
| 0 |
+---------+
1 row in set (0.00 sec)

MySQL

insert into tt4 set c1 = current_timestamp, c2 = sleep(2);
select c1 = c3 from tt4;
+---------+
| c1 = c3 |
+---------+
| 1 |
+---------+
1 row in set (0.00 sec)

remove stmtCtx.sysTs unused variable
cache time value once in stmtCtx.nowTs
refactor nowTs usage, offer Unified function interface for get and reset nowTS. Generally, accessing variable directly is not a good way for further maintenance, refactor these usage code

What is changed and how it works?

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change
  • Has exported variable/fields change
  • Has interface methods change
  • Has persistent data change

Side effects

Related changes

@cfzjywxk
Copy link
Contributor Author

/run-all-tests

@cfzjywxk cfzjywxk added sig/execution SIG execution component/expression type/bug-fix This PR fixes a bug. labels Jul 23, 2019
@cfzjywxk
Copy link
Contributor Author

/run-unit-test-tests

@cfzjywxk
Copy link
Contributor Author

/run-all-tests

@cfzjywxk
Copy link
Contributor Author

eh .. seems tidb-test mysql-test failed, there should be a release branch "release-3.0" for "tidb-test" proj.

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@zz-jason zz-jason added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 24, 2019
@zz-jason
Copy link
Member

/run-integration-common-test
/run-common-test

@lysu
Copy link
Collaborator

lysu commented Jul 26, 2019

/run-all-tests

@cfzjywxk
Copy link
Contributor Author

/run-all-tests

@cfzjywxk
Copy link
Contributor Author

/run-unit-test-tests

@jackysp
Copy link
Member

jackysp commented Jul 29, 2019

/run-unit-test

Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

jackysp
jackysp previously approved these changes Jul 30, 2019
@jackysp jackysp added the status/can-merge Indicates a PR has been approved by a committer. label Jul 30, 2019
@jackysp jackysp added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Jul 30, 2019
Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@cfzjywxk
Copy link
Contributor Author

/run-all-tests

@cfzjywxk
Copy link
Contributor Author

seems
[2019-07-31T03:29:20.546Z] FAIL: client_fail_test.go:32: testClientSuite.TestPanicInRecvLoop
[2019-07-31T03:29:20.546Z]
[2019-07-31T03:29:20.546Z] client_fail_test.go:57:
[2019-07-31T03:29:20.546Z] c.Assert(err, IsNil)
[2019-07-31T03:29:20.546Z] ... value *errors.fundamental = injected error in batchRecvLoop ("injected error in batchRecvLoop")

3.0 release client_fail_test still not fixed?

@jackysp
Copy link
Member

jackysp commented Jul 31, 2019

#11541 is trying to fix it. @cfzjywxk

ngaut
ngaut previously approved these changes Aug 1, 2019
@ngaut
Copy link
Member

ngaut commented Aug 1, 2019


[2019-08-01T02:54:37.232Z] FAIL: region_request_test.go:95: testRegionRequestSuite.TestOnSendFailedWithCloseKnownStoreThenUseNewOne
[2019-08-01T02:54:37.232Z]
[2019-08-01T02:54:37.232Z] region_request_test.go:133:
[2019-08-01T02:54:37.232Z] c.Assert(err, IsNil)
[2019-08-01T02:54:37.232Z] ... value *errors.withStack = [tikv:9002]TiKV server timeout ("[tikv:9002]TiKV server timeout")
[2019-08-01T02:54:37.232Z]

@jackysp
Copy link
Member

jackysp commented Aug 1, 2019

Please resolve the conflicts, @cfzjywxk .

@cfzjywxk
Copy link
Contributor Author

cfzjywxk commented Aug 1, 2019

/run-all-tests

@cfzjywxk
Copy link
Contributor Author

cfzjywxk commented Aug 1, 2019

/run-unit-test

@jackysp
Copy link
Member

jackysp commented Aug 1, 2019

[2019-08-01T07:05:55.311Z] FAIL: show_stats_test.go:173: testSuite1.TestShowAnalyzeStatus
[2019-08-01T07:05:55.311Z] 
[2019-08-01T07:05:55.311Z] show_stats_test.go:183:
[2019-08-01T07:05:55.311Z]     c.Assert(len(result.Rows()), Equals, 2)
[2019-08-01T07:05:55.311Z] ... obtained int = 4
[2019-08-01T07:05:55.311Z] ... expected int = 2

@lamxTyler PTAL

@bb7133
Copy link
Member

bb7133 commented Aug 5, 2019

/run-all-tests

@bb7133
Copy link
Member

bb7133 commented Aug 5, 2019

/run-unit-test

@bb7133 bb7133 closed this Aug 5, 2019
@bb7133 bb7133 reopened this Aug 5, 2019
@bb7133
Copy link
Member

bb7133 commented Aug 5, 2019

/run-unit-test

1 similar comment
@winkyao
Copy link
Contributor

winkyao commented Aug 5, 2019

/run-unit-test

@winkyao winkyao merged commit 94498e7 into pingcap:release-3.0 Aug 5, 2019
@cfzjywxk cfzjywxk changed the title executor, expression: fix current_timestamp/now not consistent… (#11342) expressions: make time func now related unit tests stable(#11342) Apr 8, 2020
@cfzjywxk cfzjywxk changed the title expressions: make time func now related unit tests stable(#11342) expressions: make time func now related unit tests stable(#11412) Apr 8, 2020
@cfzjywxk cfzjywxk changed the title expressions: make time func now related unit tests stable(#11412) expressions: make time func now related unit tests stable(#11412)(#11342) Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression sig/execution SIG execution status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bug-fix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants