-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
table: fix zero date in different sqlmode #20206
Conversation
No release note, Please follow https://github.com/pingcap/community/blob/master/contributors/release-note-checker.md |
63e73dd
to
fb22ff9
Compare
@qw4990 PTAL, and curious, why this test case failed, seems not related to my pr? If I've missed something, please let me know. [2020-09-24T17:15:23.120Z] PASS: session_test.go:1573: testSessionSuite3.TestISColumns 0.005s
[2020-09-24T17:15:23.376Z] panic: runtime error: invalid memory address or nil pointer dereference
[2020-09-24T17:15:23.376Z] [signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x2acfdf2]
[2020-09-24T17:15:23.376Z]
[2020-09-24T17:15:23.376Z] goroutine 5416 [running]:
[2020-09-24T17:15:23.376Z] github.com/pingcap/tidb/util/execdetails.(*BasicRuntimeStats).GetTime(...)
[2020-09-24T17:15:23.376Z] /home/jenkins/agent/workspace/tidb_ghpr_check_2/go/src/github.com/pingcap/tidb/util/execdetails/execdetails.go:555
[2020-09-24T17:15:23.376Z] github.com/pingcap/tidb/executor.(*insertRuntimeStat).String(0xc01085d500, 0x3acaa40, 0xc0107b9920)
[2020-09-24T17:15:23.376Z] /home/jenkins/agent/workspace/tidb_ghpr_check_2/go/src/github.com/pingcap/tidb/executor/insert_common.go:1072 +0x1d2
[2020-09-24T17:15:23.376Z] github.com/pingcap/tidb/util/execdetails.(*RootRuntimeStats).String(0xc00f769920, 0x1, 0xc00f769920)
[2020-09-24T17:15:23.376Z] /home/jenkins/agent/workspace/tidb_ghpr_check_2/go/src/github.com/pingcap/tidb/util/execdetails/execdetails.go:530 +0x235
[2020-09-24T17:15:23.376Z] github.com/pingcap/tidb/planner/core.getRuntimeInfo(0x3b0f9e0, 0xc00ebc8780, 0x3af92a0, 0xc01066a180, 0xc010861260, 0xc010861230, 0x203004, 0x203004, 0x203004, 0xc010861170, ...)
[2020-09-24T17:15:23.376Z] /home/jenkins/agent/workspace/tidb_ghpr_check_2/go/src/github.com/pingcap/tidb/planner/core/common_plans.go:1069 +0x38b
[2020-09-24T17:15:23.377Z] github.com/pingcap/tidb/planner/core.(*planEncoder).encodePlan(0xc00e2bcde0, 0x3af92a0, 0xc01066a180, 0x1, 0x0)
[2020-09-24T17:15:23.377Z] /home/jenkins/agent/workspace/tidb_ghpr_check_2/go/src/github.com/pingcap/tidb/planner/core/encode.go:64 +0xaa
[2020-09-24T17:15:23.377Z] github.com/pingcap/tidb/planner/core.(*planEncoder).encodePlanTree(0xc00e2bcde0, 0x3af92a0, 0xc01066a180, 0x0, 0x2)
[2020-09-24T17:15:23.377Z] /home/jenkins/agent/workspace/tidb_ghpr_check_2/go/src/github.com/pingcap/tidb/planner/core/encode.go:58 +0x84
[2020-09-24T17:15:23.377Z] github.com/pingcap/tidb/planner/core.EncodePlan(0x3af92a0, 0xc01066a180, 0x0, 0x0)
[2020-09-24T17:15:23.377Z] /home/jenkins/agent/workspace/tidb_ghpr_check_2/go/src/github.com/pingcap/tidb/planner/core/encode.go:52 +0x123
[2020-09-24T17:15:23.377Z] github.com/pingcap/tidb/executor.getPlanTree(0x3af92a0, 0xc01066a180, 0x3af92a0, 0xc01066a180)
[2020-09-24T17:15:23.377Z] /home/jenkins/agent/workspace/tidb_ghpr_check_2/go/src/github.com/pingcap/tidb/executor/adapter.go:955 +0x87
[2020-09-24T17:15:23.377Z] github.com/pingcap/tidb/executor.(*ExecStmt).LogSlowQuery(0xc00f589c30, 0x5d3047314c8000b, 0x3ac0000)
[2020-09-24T17:15:23.377Z] /home/jenkins/agent/workspace/tidb_ghpr_check_2/go/src/github.com/pingcap/tidb/executor/adapter.go:899 +0x456
[2020-09-24T17:15:23.377Z] github.com/pingcap/tidb/executor.(*ExecStmt).FinishExecuteStmt(0xc00f589c30, 0x5d3047314c8000b, 0xc00ebc0000)
[2020-09-24T17:15:23.377Z] /home/jenkins/agent/workspace/tidb_ghpr_check_2/go/src/github.com/pingcap/tidb/executor/adapter.go:810 +0xeb
[2020-09-24T17:15:23.377Z] github.com/pingcap/tidb/session.runStmt(0x3ac7f00, 0xc000062070, 0xc00ebc8780, 0x3ae6680, 0xc00f589c30, 0x0, 0x0, 0x3a6c260, 0xc01085d420)
[2020-09-24T17:15:23.377Z] /home/jenkins/agent/workspace/tidb_ghpr_check_2/go/src/github.com/pingcap/tidb/session/session.go:1235 +0x446
[2020-09-24T17:15:23.377Z] github.com/pingcap/tidb/session.(*session).ExecuteStmt(0xc00ebc8780, 0x3ac7f00, 0xc000062070, 0x3ad1000, 0xc00f599a00, 0x0, 0x0, 0x0, 0x0)
[2020-09-24T17:15:23.377Z] /home/jenkins/agent/workspace/tidb_ghpr_check_2/go/src/github.com/pingcap/tidb/session/session.go:1171 +0x7b9
[2020-09-24T17:15:23.377Z] github.com/pingcap/tidb/util/testkit.(*TestKit).Exec(0xc00f94bf88, 0x357dfcb, 0x24, 0x0, 0x0, 0x0, 0xc00f74e758, 0x12523b2, 0xc00e1df5d0, 0xc00f74e780)
[2020-09-24T17:15:23.377Z] /home/jenkins/agent/workspace/tidb_ghpr_check_2/go/src/github.com/pingcap/tidb/util/testkit/testkit.go:160 +0x215
[2020-09-24T17:15:23.377Z] github.com/pingcap/tidb/session_test.(*testSessionSuite2).TestErrorRollback.func1(0xc00f6e94c0, 0xc00eb9cff0, 0xc0007fea80, 0x14)
[2020-09-24T17:15:23.377Z] /home/jenkins/agent/workspace/tidb_ghpr_check_2/go/src/github.com/pingcap/tidb/session/session_test.go:300 +0x180
[2020-09-24T17:15:23.377Z] created by github.com/pingcap/tidb/session_test.(*testSessionSuite2).TestErrorRollback
[2020-09-24T17:15:23.377Z] /home/jenkins/agent/workspace/tidb_ghpr_check_2/go/src/github.com/pingcap/tidb/session/session_test.go:295 +0x1d9
[2020-09-24T17:15:23.377Z] exit status 2
[2020-09-24T17:15:23.377Z] FAIL github.com/pingcap/tidb/session 4.716s |
/run-check_dev_2 |
expression/integration_test.go
Outdated
tk.MustExec("TRUNCATE TABLE dd") | ||
tk.MustExec("INSERT INTO dd(a) values('2000-10-01')") | ||
tk.MustExec("UPDATE dd SET a = '0000-00-00'") | ||
// tk.MustQuery("SHOW WARNINGS").Check(testkit.Rows("Warning 1292 Incorrect date value: '0000-00-00'")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you tell me why comment it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems there was two identical warning messages , but I have no idea why that happened
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it's to check insert and update both generating a warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the insert stmt is valid, no warnings should generated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i mean line 7521 and 7527 should both be checked
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the advice, and is there any way to clear warnings before an stmt executing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems the warning messages are automatically deleted after a valid STMT executed, IMO, line 7521's warning will not affect this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems our communication is misleading 🤣 i mean this line shouldn't be commented as it could check above update generated a warning. and maybe you say that it generated two identical warnings? that's an unexpected behaviour, maybe some bug in code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😂 sorry for the misunderstanding. In my local tests, the warning count maybe 1 or 2. currently, rebase from the master branch and remove the comment, the local test seems passed. Push it up to see the CI passed or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's passed 🎉
22de6a4
to
02cefbf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good work
PTAL @rebelice @lzmhhh123 |
a300651
to
54158e2
Compare
@rebelice Sorry for the late reply, please have a look again |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests |
/rebuild |
c731b04
to
eaec4f8
Compare
@ichn-hu Please help to review this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest LGTM
table/column.go
Outdated
} | ||
|
||
innerErr := types.ErrWrongValue.GenWithStackByArgs(zeroT, val.GetString()) | ||
ignoreErr := sc.DupKeyAsWarning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use DupKeyAsWarning for ignore error? I think here it is not about dup key, but zero date?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the value of sc.DupKeyAsWarning
is the original value of ignoreError: https://github.com/pingcap/tidb/blob/43a5bb47977fc7952a8aaedffe0154e6918bf4ad/executor/executor.go#L1601-L1615
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
That was my initial plan, but the zero date is used on a table which uses this to signify a
I would have to create a special valid date to replace this, which is not ideal. In anycase, the gorm test is now passing with an expicit sql mode. |
/run-common-test tidb-test=pr/1109 |
/run-common-test tidb-test=pr/1109 |
/run-common-test tidb-test=pr/1109 |
1 similar comment
/run-common-test tidb-test=pr/1109 |
There were more broken tests than I first noticed:
|
@nullnotnil Is there anything I need to fix first, or I can help? |
It's okay. I took another look at it, and I think I will fix the mysql_test cases that break and close pingcap/mysql-tester#9 . It doesn't look as bad as I thought - give me a few hours :-) |
I don't think that we should cherry-pick this into the release branch (v4.0). Given that the regression test suite is breaking in a few places, there are likely apps that are depending on this without knowing it. It is better to have them discover the issue when upgrading to the next major release. |
/run-common-test tidb-test=pr/1109 |
OK, I agree. |
/merge |
Your auto merge job has been accepted, waiting for:
|
/run-all-tests |
@9547 merge failed. |
/run-unit-tests |
/run-cherry-picker |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
cherry pick to release-4.0 in PR #21553 |
What problem does this PR solve?
Issue Number: close #19892, #19634
Problem Summary:
What is changed and how it works?
What's Changed:
How it Works:
Related changes
pingcap/docs
/pingcap/docs-cn
:Check List
Tests
Side effects
Release note
NO_ZERO_DATE
andNO_ZERO_IN_DATE
to MySQL's in INSERT/UPDATE statement