Immediate consistency

Hi guys, I’m new to event store and have a question regarding eventual consistency.

Is it correct, that if I append an event to a stream and right after read from the stream, that there is a guarantee (immediate consistency) that the event will be there?

  1. Appending to a stream in a single write

Task<WriteResult> AppendToStreamAsync(string stream, long expectedVersion, IEnumerable<EventData> events)

https://eventstore.org/docs/dotnet-api/writing-to-a-stream/index.html#appending-to-a-stream-in-a-single-write

  1. Read a specific stream backwards

Task<StreamEventsSlice> ReadStreamEventsBackwardAsync(string stream, long start, int count, bool resolveLinkTos)

https://eventstore.org/docs/dotnet-api/reading-events/index.html#read-a-specific-stream-backwards

I tested it and it seems to be the case but I don’t have the testing possibility at the moment to verify that it’s 100% the case also in production after collection much more streams and events then I currently have.

I couldn’t find the information in the docs, if there is, that would be very helpful :slight_smile:

In a cluster “it depends” it depends on whether you read from a single node or multiple (quorum). Writes will by default always be to a quorum so if you set expected version properly you will always get an error in the edge case.

Hi Greg,

In a cluster “it depends” it depends on whether you read from a single node or multiple (quorum).

I have a multi node cluster and connect with PerformOnMasterOnly (the default).

Is my understanding correct, that I get immediate consistency since all write and read requests are served only by the master?

I’m unsure since I read that the master will forward writes to all nodes and will consider it to be done when n/2+1 have agreed its been done.

thanks a lot for your help!

Koji

It will be known of on the master due to how it works always, it may not be be persisted in the master but it will be known about.