jet / equinox

.NET event sourcing library with CosmosDB, DynamoDB, EventStoreDB, message-db, SqlStreamStore and integration test backends. Focused at stream level; see https://github.com/jet/propulsion for cross-stream projections/subscriptions/reactions
https://github.com/jet/dotnet-templates
Apache License 2.0
472 stars 68 forks source link

Improve resync wrt ES WrongExpectedVersionException #19

Closed bartelink closed 6 years ago

bartelink commented 6 years ago

Current behavior is to attempt a re-read without a backoff delay; in prod this is regularly failing despite 3 retries (it's a short stream and the typical timespan is <10ms so the conflict never resolves and the app is yielding excessive 500s as a result).

Considerations:

See https://github.com/EventStore/EventStore/issues/1626

dongdongcai commented 6 years ago

I think it can be implemented in Equinox since we can specify the consistency level for read query. By default, the read query is session consistency but when it failed because of wrongversion. We can then set the consistency level for read query to strong consistency by changing the feedoption for qurey.

bartelink commented 6 years ago

See also https://github.com/EventStore/EventStore-Client-Dotnet/issues/312 - resolving by introducing a twin connection policy which has equivalent scalability but does not require backoffs