NEventStore / NEventStore.Persistence.MongoDB

Mongo Persistence Engine for NEventStore
MIT License
22 stars 26 forks source link

Dispatched index definition appears to be incorrect #52

Closed mikegore1000 closed 5 years ago

mikegore1000 commented 7 years ago

At present the Dispatched index is defined like this:

{ 
    "Dispatched" : 1, 
    "CommitStamp" : 1
}

However, when calling the GetUndispatchedCommits method, the query is generated:

query: { $query: { Dispatched: false }, $orderby: { _id: 1 } }

We have encountered performance issues with the current index definition in production (query time of > 30 mins on a 129GB collection), and believe the correct index should be:

{ 
    "Dispatched" : 1, 
    "_id" : 1
}

We are looking to moving away from the dispatcher as we appreciate that moving towards a catch up subscription approach is the way forward here, but would appreciate some guidance here as to whether there is any reason why the CommitStamp is in the current index. Happy to raise a pull request if you agree with this.

We have applied the alternative index to production today, and should have some stats to share this afternoon.

mikegore1000 commented 7 years ago

I can confirm the index made a dramatic difference and fixed all the issues we were having.

AGiorgetti commented 7 years ago

The dispatcher is not used anymore and on the actual development branch (NEventStore v6) has been totally removed.

Can you please do a pull request on the actual v5.x implementation so we can maybe release a fixed version of the persistence?