-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
tidb panic when processing insert select query #39611
Comments
/cc @ekexium |
The sequence of events that leads to the panic is: When reverting to last checkpoint, memdb iterates over the nodes backwards, here is why it panics: |
can reproduce it with the case after the fix pr, reopen. drop table if exists t;
create table t(a int, index idx(a));
insert into t values (1), (2), (3);
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
insert into t select * from t;
set tidb_mem_quota_query=1073741824;
insert /*+ memory_quota(1 MB) */ into t (select * from t);
|
It's directly caused by the panicking leaving memdb in an inconsistent state. I've filed a PR to fix it. |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
Use TPC-H 100 database.
Create a table
lineitem1
whose schema is the same as the lineitem table.Run
explain analyze insert into lineitem1 select * from lineitem limit 10000000;
By the way, when I ran
explain analyze insert into lineitem1 select * from lineitem limit 1000000;
, the result is ok.2. What did you expect to see? (Required)
A result of
explain analyze
.3. What did you see instead (Required)
ERROR 1105 (HY000): runtime error: slice bounds out of range [-20:]
The panic log in TiDB log is:
And the tidb log said this query exceeded memory quota.
4. What is your TiDB version? (Required)
The latest master.
The text was updated successfully, but these errors were encountered: