Open zimulala opened 1 year ago
One problem is that these's no "real session" when use lightning as a standalone binary. In the old way we just extend the mocked session that lightning uses.
It's better that when TiDB uses lightning as a library we can use the real session and fallback to mocked session otherwise. And also it can solve many other problems.
cc @D3Hunter
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
Run TestConcurrentDDLCreateUniqueIndex.
https://github.com/pingcap/tidb/blob/09a83b8a46cc53db68d4a79ff4b51e95cfa6e031/ddl/ingest/backend.go#L137
https://github.com/pingcap/tidb/blob/09a83b8a46cc53db68d4a79ff4b51e95cfa6e031/br/pkg/lightning/backend/kv/kv2sql.go#L124-L136
And we do
RewriteAstExpr
inCollectGeneratedColumns
, we'd better to a real session toCollectRemoteDuplicateRows
inFinishImport
.2. What did you expect to see? (Required)
no panic
3. What did you see instead (Required)
https://do.pingcap.net/jenkins/blue/organizations/jenkins/pingcap%2Ftidb%2Fghpr_check2/detail/ghpr_check2/28159/pipeline
4. What is your TiDB version? (Required)
https://github.com/pingcap/tidb/pull/46667 https://github.com/pingcap/tidb/pull/46667/commits/30e9373044a6a87e3f6e8e155f3eabdd8902abe4