FAQ? Inserting/Deleting events

I’ve got a couple of questions based on my understanding of event sourcing and event stores.

When event sourcing using eventual consistency I believe it is quite common to insert compensating events into a stream to correct bad data / bugs, is this possible with event store? Can you insert/delete events at a certain point in the stream? Will projections be updated?

If not, what is the best/recommended way to perform a compensating action in the case of bugs/bad data?

Ben

I am no expert on this area. From understanding of Event Store, you cannot insert an event into the middle of a stream, only append at the end. I remember seeing an example of this kind of thing in a financial model. An adjustment needed to be added to a previous period that has already been closed. Part of the compensating event or it’s metadata, you would indicate where/when the event applies to. The event model would be fundamentally broken if you could randomly insert into the stream at any point.

The problem with inserting, updating or removing something in the past is that things then become mutable and it breaks the model. There are however some things you can do. The best thing to look at is how something might be handled in accounting (and accounting does have this!). I can put in a post dated transaction to my journal. I talk a bit about how to do tis in this post http://codebetter.com/gregyoung/2014/03/02/event-sourcing-and-postpre-dated-transactions/

This is really an event sourcing thing as opposed to an event store specific implementation.

Cheers,

Greg