-
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
wrong CM Sketch caused by different encoding method used by TiDB and TiKV #25638
Labels
Comments
/assign time-and-fate |
Closed
Please edit this comment or add a new comment to complete the following informationNot a bug
Duplicate bug
BugNote: Make Sure that 'component', and 'severity' labels are added 1. Root Cause Analysis (RCA) (optional)2. Symptom (optional)3. All Trigger Conditions (optional)4. Workaround (optional)5. Affected versions6. Fixed versions |
This was referenced Jun 23, 2021
Merged
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Bug Report
Reason:
TiKV builds CM Sketch using an encoding method different from what TiDB assumes.
Only real TiKV has this issue, unistore doesn't have this issue.
TiKV side:
https://github.com/tikv/tikv/blob/a3da6cec14857de021da6ed14353ae461303047d/src/coprocessor/statistics/analyze.rs#L748
in which the
val
is fromhttps://github.com/tikv/tikv/blob/a3da6cec14857de021da6ed14353ae461303047d/components/tidb_query_datatype/src/codec/row/v2/compat_v1.rs#L54
TiDB side:
tidb/store/mockstore/unistore/cophandler/analyze.go
Line 488 in 97e7b60
and
tidb/statistics/cmsketch.go
Line 257 in 97e7b60
which comes to
tidb/tablecodec/tablecodec.go
Lines 276 to 284 in 97e7b60
This will make most equal condition row count estimation got 0 rows result.
1. Minimal reproduce step (Required)
wait several seconds
2. What did you expect to see? (Required)
3. What did you see instead (Required)
(0.8 for bit and set type is expected because they can't be pushed down for now, so the default selectivity 0.8 is used)
4. What is your TiDB version? (Required)
from v4.0.0 to current master (ed52601)
(but from 5.1,
tidb_analyze_version
is 2 by default, which is not affected by this issue)The text was updated successfully, but these errors were encountered: