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
MongoDB as EventStore #151
Conversation
8f32753
to
6c391ba
Compare
|
||
if (count($events) == 1) { | ||
try { | ||
$this->saveEvent(reset($events)); |
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.
Is there a specific reason you choose to do this separately if there is exactly 1 event? I'm not really seeing the benefit.
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.
Single document insert does not require 2pc. It's done to save number of requests.
Thanks for the PR, really appreciate it! |
31be3bf
to
035bfe9
Compare
@wjzijderveld updated, but scrutinizer failed by some unexpected reason. |
I just restarted The scrutrnizer job, they fsil from time to time. I'll look at you other comments later :-) |
} | ||
|
||
/** | ||
* {@inheritdoc} |
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.
This method isn't in the interface, no doc-block required here.
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.
updated
- read against primary node - read committed isolation level
035bfe9
to
c1731ef
Compare
👍 |
@qandidate-labs/broadway I'm fine with merging this as is (can optionally fix the exception assignment separate). What do others think? @jaymecd Have you been running this in production? If not, maybe we should add a note in the README that this is experimental? |
@wjzijderveld nope, not yet, so |
*/ | ||
public function configureCollection() | ||
{ | ||
$this->eventCollection->ensureIndex(array( |
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.
ensureIndex is deprecated. use createIndex instead.
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.
sorry, doctrine mongodb uses still the ensureIndex method ;)
@jmikola tnx for tips, I review code a bit later. |
Any news on this one? |
MongoDB has no transaction support. Using the $isolated operator you can achieve atomic updates on a single collection, but not on multiple ones. Additionally the $isolated operator does not work in a sharded cluster environment. That said, it's not a good idea to run this in a very high performant situation with sharding enabled. |
Hey guys, I spent last weeks in hospital.
Continue with PR in next days.
Tnx for understanding.
|
@jaymecd No problem, hope you are okay! If you want any help on it, let me know! |
@wjzijderveld, I've made a deep dive into the problems and issues noted by @jmikola and @prolic and have doubts if solution should be based on:
So, I'm asking for your opinion on this issue before continue. Personally I'd go with |
@jaymecd Thanks for diving into it! Hmm, tricky choice there. But I think the better way would be to go with the new extension. Compatibility with HHVM is something I would definitely like to support :-) @qandidate-labs/broadway What do you think? |
Also the legacy driver will not be updated to support php7. No HHVM support ok, but PHP7 should not be a question ;) If you also want to have legacy version you can wrap the 1.0 version of prooph/event-store-mongodb-adapter in a class implementing Broadway event store. Maybe faster than writing a legacy adapter yourself. |
@codeliner, I don't think wrapping |
@codeliner @jmikola - $isolated operator does not work in a sharded cluster. Is there any way to have same atomicity within sharded setup? As event store data could consume all disk space on single shard, isn't it? |
@jaymecd : @prolic is our mongoDB specialist. As far as I know there is no way. We are looking for alternatives, too. Depending on your domain contexts one shard per context is maybe enough. Also when using snapshots in combination with "archiving" old events you may not run out of disk space. So mongoDB is still a valid option.
Well, Broadway provides only an ES interface and different independent ES implementations. prooph/event-store on the other hand uses different adapters. I did not say you should require prooph/event-store but only one of the available adapters. Our packages are stand-alone (btw. something that Broadway should consider, too). However, it was more a hint for people who may need to use the old extension but want to use other features of Broadway. I don't consider Broadway a competitor. Would like to use the Saga implementation but unfortunately it is not available as a stand-alone package and installing everything incl. the Sf bundle, aggregate root classes, etc. is really not an option. |
Running out of disk-space? Really? I can store all your events on my micro-sd card! Unless you are not twitter and have multiple thousands events per second, you never run out of disk space. Even if so, you should upgrade your hardware and buy a larger hard disk. For $isolated: There is no other solution, you can't run mongodb event store in a sharded cluter environment. If you need more speed, consider using postgres. |
Here 👍 |
In order to save time I've started to update implementation (using hints above) with |
Hi @jaymecd,
How is your progress on that? |
I started to refactor the Saga\MongoDBRepository to use the new extension #236 |
@Konafets @wjzijderveld I didn't had a chance to continue on that, so far could not provide any ETA from my side. |
I'm closing this for now. Additional event stores are very welcome, though! We are actually splitting implementations to separate repositories at the moment. If someone wants to work on a new broadway/event-store-mongodb implementation, please ping us! /cc @broadway/broadway Thank you for your effort! |
work on this will continue in this repo: https://github.com/broadway/event-store-mongodb |
Introducing support of MongoDB as EventStore.
Features included in this PR: