-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix bad transaction support #27
Conversation
|
||
This adapter uses die `$isolated` operator to achieve transaction safety for a single collection. | ||
Keep in mind, that `$isolated` does not work with sharded clusters. Therefore it's not safe to use this adapter | ||
in a shared cluster environment, as we MongoDB can't guarantee transaction safety. |
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 we MongoDB" should be "As with MongoDB"?
@@ -187,12 +169,16 @@ public function create(Stream $stream) | |||
*/ | |||
public function appendTo(StreamName $streamName, array $streamEvents) | |||
{ | |||
$this->currentStreamName = $streamName; |
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.
We need to make sure that only one stream can be modified per transaction. So we should check here that either $this->currentStreamName
is null
or the same as $streamName
. On transaction commit/rollback $this->currentStreamName
should be reset to null
@prolic Great job 👍 . I think the BC break is ok here as we really need to change the behavior of the adapter. A new major version will underline the importance of the adjustments. |
I totally missed the checks for current stream name, just slipped through my mind ;) |
Seems like travis won't start this build. However, I'm going to merge the PR and trigger a new build with the merge. |
fixes: #26