{"action":"closed","issue":{"url":"https://api.github.com/repos/mateodelnorte/sourced-repo-mongo/issues/25","repository_url":"https://api.github.com/repos/mateodelnorte/sourced-repo-mongo","labels_url":"https://api.github.com/repos/mateodelnorte/sourced-repo-mongo/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/mateodelnorte/sourced-repo-mongo/issues/25/comments","events_url":"https://api.github.com/repos/mateodelnorte/sourced-repo-mongo/issues/25/events","html_url":"https://github.com/mateodelnorte/sourced-repo-mongo/issues/25","id":336597251,"node_id":"MDU6SXNzdWUzMzY1OTcyNTE=","number":25,"title":"different events with same Version","user":{"login":"stephanknull","id":4189773,"node_id":"MDQ6VXNlcjQxODk3NzM=","avatar_url":"https://avatars2.githubusercontent.com/u/4189773?v=4","gravatar_id":"","url":"https://api.github.com/users/stephanknull","html_url":"https://github.com/stephanknull","followers_url":"https://api.github.com/users/stephanknull/followers","following_url":"https://api.github.com/users/stephanknull/following{/other_user}","gists_url":"https://api.github.com/users/stephanknull/gists{/gist_id}","starred_url":"https://api.github.com/users/stephanknull/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stephanknull/subscriptions","organizations_url":"https://api.github.com/users/stephanknull/orgs","repos_url":"https://api.github.com/users/stephanknull/repos","events_url":"https://api.github.com/users/stephanknull/events{/privacy}","received_events_url":"https://api.github.com/users/stephanknull/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-06-28T12:19:31Z","updated_at":"2018-06-28T19:48:45Z","closed_at":"2018-06-28T19:48:45Z","author_association":"NONE","body":"Inspecting an error in our application i found out, that in our `Entity.events`-Collection were several events with same id & version.\r\nIt turned out that several simultaneous backend requests manipulating the same entity caused this. At the time of the request, version `x` existed and on this version the operation was executed. This led to an event with version `x+1` in all of these requests. \r\nAccording to my understanding this is not good, but it does not yet lead to data loss. The replay works fine.\r\n\r\nIf the new version now leads to the creation of a snapshot, we unfortunately lose data. Since several events exist with the same version, several snapshots are also created with the same version. Of course, each snapshot has only processed its own event. In replay, however, only one of the snapshots is used as the basis for replay.\r\n\r\nI wasn't sure, If i should report it in `sourced` or here. But since I think it can be solved with a simple [unique index](https://docs.mongodb.com/manual/core/index-unique/#unique-compound-index) (on `{id, version}`), I post it here.\r\nPlease let me know, if you need some demonstration-code."}}
{"actor":{"display_login":"mateodelnorte"}}