-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
[9.x] Don't use locks for queue job popping for PlanetScale's MySQL-compatible Vitess engine #44027
Conversation
PlanetScale provides great serverless MySQL-compatible database and guide on how to integrate it in Laravel (https://planetscale.com/docs/tutorials/connect-laravel-app) but under hood uses Vitess. However it looks that Vitess doesn't support "skip" queries: ```SQLSTATE[HY000]: General error: 1105 syntax error at position 185 near 'SKIP' (SQL: select * from `jobs` where `queue` = default and ((`reserved_at` is null and `available_at` <= 1662479913) or (`reserved_at` <= 1662479823)) order by `id` asc limit 1 FOR UPDATE SKIP LOCKED)``` Following laravel#31536 I've improved engine/version parsing for Vitess so it wouldn't use locks for popping: ```>>> DB::connection()->getPdo()->getAttribute(PDO::ATTR_DRIVER_NAME) => "mysql" >>> DB::connection()->getPdo()->getAttribute(PDO::ATTR_SERVER_VERSION) => "8.0.23-vitess"```
I wonder if we just let this continue to error though? If it doesn't support this feature then database queues are not really a great option? |
@taylorotwell contacted PlanetScale support also and their response was:
I guess Redis is better choice now (which I already switched to) than maintaining this if they plan to resolve all compatibility issues soon anyway. |
Will merge this for now but note that you may experience database deadlocks if you put a lot of queue workers in place and the database doesn't support skip locked, etc. |
Seems like a PR to add skip/lock support was just merged: This PR may be able to be reverted soon. |
@BrandonSurowiec is this available in PlanetScale for you? I just tried but got the following error:
|
They haven't made a release since september: https://github.com/planetscale/vitess-releases/releases |
@rihardsgrislis, @BrandonSurowiec, @dihmeetree, and others subscribed to this issue. This should likely work now within PlanetScale databases as most have been moved onto Vitess 18 which includes the support as part of our rollout for foreign key constraints support that arrived earlier this month. |
That is the wrong repo. The repo is https://github.com/vitessio/vitess/releases. |
The PR was merged to |
It looks like it'll be included in Vitess 19.0. |
PlanetScale provides great serverless MySQL-compatible database and guide on how to integrate it in Laravel (https://planetscale.com/docs/tutorials/connect-laravel-app) but under hood uses Vitess.
However it looks that Vitess doesn't support "skip" queries:
SQLSTATE[HY000]: General error: 1105 syntax error at position 185 near 'SKIP' (SQL: select * from `jobs` where `queue` = default and ((`reserved_at` is null and `available_at` <= 1662479913) or (`reserved_at` <= 1662479823)) order by `id` asc limit 1 FOR UPDATE SKIP LOCKED)
Following #31536 I've added a check for Vitess engine/version parsing so it wouldn't use locks for popping: