-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Transaction support #2019
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
Transaction support #2019
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2019 +/- ##
============================================
+ Coverage 87.04% 87.33% +0.29%
- Complexity 667 680 +13
============================================
Files 31 31
Lines 1521 1556 +35
============================================
+ Hits 1324 1359 +35
Misses 197 197
Continue to review full report at Codecov.
|
|
There is still work to do with handling deadlock in transaction, especially configuring exception messages of mongodb. |
|
@ilyasokay do you have plans to continue work with PR? |
@Smolevich Sorry for the delay, I had some urgent works to do; but I will continue this pr as soon as possible. |
|
|
||
| $wheres = $this->compileWheres(); | ||
| $result = $this->collection->UpdateMany($wheres, $query, $options); | ||
| $result = $this->collection->UpdateMany($wheres, $query, array_merge($options, $this->session())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per signature below:
| $result = $this->collection->UpdateMany($wheres, $query, array_merge($options, $this->session())); | |
| $result = $this->collection->UpdateMany($wheres, $query, $this->session($options)); |
There are a few more instances of this in the class.
|
|
||
| protected function session(array $options = []) | ||
| { | ||
| if ($session = $this->connection->getSession()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion to not override an existing session:
| if ($session = $this->connection->getSession()) { | |
| if (!isset($options['session']) && $session = $this->connection->getSession()) { |
| return new Schema\Grammar(); | ||
| } | ||
|
|
||
| public function beginTransaction(array $options = []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the expected behaviour if a transaction is already in progress?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
Closing in favor of #1904 |
Transaction which is supported on Mongo v4 and above is almost ready. Just need 1-2 days to check completely. Thanks for your help @Smolevich .