-
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 panicked with index out of range [-1] #30382
Comments
I find the extra PID column is missing in the final schema, and that's the direct cause of the panic. Then I print out the plan and find the extra PID column is eliminated.
and after physical optimize, the plan is
and after postoptimize, the plan is:
As you can see, after the postoptimize step, the final projection is elimitated, this is not expected. |
It's caused by here tidb/planner/core/rule_column_pruning.go Lines 66 to 79 in b585bf9
The plan is DataSource -> ... -> Projection(2) -> Lock -> Projection(1) In column pruning of Project(2), the |
I'll find another way to fix it... |
How to make the Agg executor keep the children's schema even it's not in the agg function?
In Agg's schema, the partition columns from DataSource2 is dropped... |
After some offline discussion, i update some results here. This can simplify this scenario, which can help us a lot. |
@tiancaiamao @winoros any update on this issue? |
Join will block the both tables:
While subquery just blocks the outer table:
It means when rewrite the apply to join, the SelectLock be the children of the Join, rather than be the parent of the join. |
So this seems that sub-q to join rewrite potentially changed the behavior of the lock. If this is the case, one option is that we may need to add exemption in sub-q to join rewrite to block this rewrite when it involves for update; or we mark the table from sub-q to be excluded from update lock during sub-q to join rewrite. What do you guys think? @tiancaiamao @winoros |
/component tablepartition |
Fixed by #31634. |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
related issues: #25812, #28141, #26380 .
2. What did you expect to see? (Required)
All statements are executed without error.
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
master (a046014)
The text was updated successfully, but these errors were encountered: