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

It raised encoding failed when executing select statement on medium blob type #23322

Closed
lilinghai opened this issue Mar 15, 2021 · 5 comments
Closed
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Milestone

Comments

@lilinghai
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

deploy the tide cluster containing TiKV instance
download 1.txt

source 1.txt
select * from t where a=1;

2. What did you expect to see? (Required)

successfully

3. What did you see instead (Required)

ERROR 1105 (HY000): encoding failed
tidb log
[err="[tikv:10000]encoding failed"]

4. What is your TiDB version? (Required)

Release Version: v4.0.0-beta.2-2365-g46f5f2177-dirty
Edition: Community
Git Commit Hash: 46f5f21
Git Branch: release-5.0
UTC Build Time: 2021-03-13 14:50:59
GoVersion: go1.13
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false

@lilinghai lilinghai added the type/bug The issue is confirmed as a bug. label Mar 15, 2021
@jebter jebter added this to the v5.0.0 ga milestone Mar 22, 2021
@zimulala
Copy link
Contributor

/cc @XuHuaiyu

@zz-jason
Copy link
Member

It's better to figure out the affected versions firstly.

@guo-shaoge
Copy link
Collaborator

guo-shaoge commented Mar 22, 2021

drop table if exists t1;
create table t1(c1 blob);
insert into t1 values(unhex('f7'));
select hex(c1) from t1;
mysql> select * from t1 where c1 = 1;
ERROR 1105 (HY000): encoding failed

root cause: Copr tries to convert 0xf7 into utf8, then convert it to float, which will be compared by 1. But 0xf7 is not a valid utf8 char(one byte and first bit is 1, check wiki). So TiKV gives error. May be we should std::str::from_utf8_unchecked instead of std::str::from_utf8 when convert bytes to real or any other type.

@guo-shaoge
Copy link
Collaborator

We close this. Fix in tikv.

@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.0 This bug affects 4.0.x versions. affects-5.0 This bug affects 5.0.x versions. severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

No branches or pull requests

10 participants