Comments (1)
I looked at this failure, and I know what's happening.
The plan that Vitess produces for this query is this -
{
"OperatorType": "FkCascade",
"Inputs": [
{
"InputName": "Selection",
"OperatorType": "Route",
"Variant": "Unsharded",
"Keyspace": {
"Name": "uks",
"Sharded": false
},
"FieldQuery": "select fk_t11.col from fk_t11, fk_t12 where 1 != 1",
"Query": "select fk_t11.col from fk_t11, fk_t12 where fk_t11.id = 4 and fk_t11.id = fk_t12.id for update",
"Table": "fk_t11, fk_t12"
},
{
"InputName": "CascadeChild-1",
"OperatorType": "Delete",
"Variant": "Unsharded",
"Keyspace": {
"Name": "uks",
"Sharded": false
},
"TargetTabletType": "PRIMARY",
"BvName": "fkc_vals",
"Cols": [
0
],
"Query": "delete from fk_t12 where (col) in ::fkc_vals",
"Table": "fk_t12"
},
{
"InputName": "Parent",
"OperatorType": "Delete",
"Variant": "Unsharded",
"Keyspace": {
"Name": "uks",
"Sharded": false
},
"TargetTabletType": "PRIMARY",
"Query": "delete fk_t11 from fk_t11, fk_t12 where fk_t11.id = 4 and fk_t11.id = fk_t12.id",
"Table": "fk_t11"
}
]
}
From the outset, the plan looks fine, but when we try to see the exact order of execution, the problem becomes apparent.
The order of queries Vitess runs is this -
select fk_t11.col from fk_t11, fk_t12 where fk_t11.id = 4 and fk_t11.id = fk_t12.id for update
delete from fk_t12 where (col) in ::fkc_vals
delete fk_t11 from fk_t11, fk_t12 where fk_t11.id = 4 and fk_t11.id = fk_t12.id
The problem is that once the 2nd query runs, (which is the cascade), the rows with id = 4
are gone from the fk_t12
table!! So now when we run the last query, there is no delete, since no row qualifies and therefore no failure!
This essentially shows up as though the delete query only ended up deleting 2 rows from fk_t12
and nothing else!
from vitess.
Related Issues (20)
- Throttle tablet collation mismatch warnings
- Chore: use new range for loops
- RFC: Optimizing Joins in Vitess with Bloom Filters
- Bug: output fields not typed not correct
- Bug Report: Pointing vttablet to different (unmaged) MySQL makes it get stuck in loop HOT 6
- Feature Request: Support for Update with multi table reference
- Question: How do I deploy Vitees on Kubernetes with MariaDB. HOT 3
- Feature Request: add more visibility/stats in Tablet Throttler
- Feature Request: Restricting users which VSchemas can do Online VSchema DDL HOT 1
- `vttestserver` example does not work
- Bug Report: Unable to cancel movetables with keep_data=false on database with foreign keys
- Bug Report: `queryserver-config-*-pool-waiter-cap` flags have no effect in v19 HOT 1
- Query planner does not route routed queries to the proper keyspace HOT 1
- Bug Report: Noisy `vtexplain` log output HOT 3
- Bug Report: Routing Rules throwing error on query
- Aggregation Planner doesn't handle Literals properly
- Feature Request: Enable TCP/IP Connection Access to the Underlying MySQL Instance in vttestserver
- Convert endtoend tests to use `vtctldclient` everywhere
- Feature Request: in `RestoreFromBackup`, add `mysqlbinlog` output upon error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vitess.