-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Compatibility of Job Batch with a proxy sql #49062
Comments
Thank you for reporting this issue! As Laravel is an open source project, we rely on the community to help us diagnose and fix issues as it is not possible to research and fix every issue reported to us via GitHub. If possible, please make a pull request fixing the issue you have described, along with corresponding tests. All pull requests are promptly reviewed by the Laravel team. Thank you! |
framework/src/Illuminate/Bus/DatabaseBatchRepository.php Lines 71 to 87 in c3844dc
|
Seems Taylor doesn't wants to change anything here right now so closing this one sorry. |
A proxy sql to split query is an external stack. For dev ops, i don't want Laravel to manage different database connection. Without transaction here or a change to not insert+select immediately, Laravel will be incompatible with this type or product. |
Laravel Version
10.32.1
PHP Version
8.1.7
Database Driver & Version
SkySQL : mariadb 10.5.21-15 + maxscale 23.02.2 + maxscale readwritesplit V1.1.0
Description
When using maxscale (proxy sql to split query on a master database and a slave database), with Batch Jobs, Laravel throw an exception on
PendingBatch->dispatch()
Error come from this
vendor/laravel/framework/src/Illuminate/Bus/PendingBatch.php
methodThe line
$batch = $repository->store($this);
callDatabaseBatchRepository->store(PendingBatch $batch)
:This method do an INSERT and follow with a SEELECT with line
return $this->find($id);
With a split read/write database proxy sql, the insert is send to master and immediately we are doing a select on the inserted data. Data replication is not done and the $batch is null throwing an exception on the next line of
dispatch
method$batch = $batch->add($this->jobs);
Solution
Adding a transaction force all requests to be played on database master
Steps To Reproduce
The text was updated successfully, but these errors were encountered: