Automatic removal of snapshot events

Hi there,

We’ve recently found out that the time to backup our database (which includes events store) increased significantly. The reason is that we have about 1,5 million large objects that keep snapshot events for past 4 months.

I wonder if it is a good idea to add a feature to Axon framework to remove previous snapshot events from the store when new snapshot event is stored? I understand that there might be a use case to keep monthly or yearly snapshots. But does anybody actually needs that? In most cases, I think, nobody needs more than one snapshot of aggregate.

So, what do you think?

Perhaps only keep the last x snapshots in db is ideal.

Edward Yakop

I can image however that one would want to store the full event log for a later point in time. Eg. for debugging or other analysis purposes.

For this reason, one could also consider ‘move’ events up until a given snapshot out from the database to a compressed file variant in order to preserve the entire audit trail. This way database backup time will shrink, but the entire audit trail will be available when it is needed in the future.

+1 :slight_smile:

I think it’s a good idea to leave x snapshots after an event is created. One (older) event should always be kept, in case another process is reading, while the snapshotter is writing.

As Rob mentions, incremental backups can be created for older events. I’ll think about a way to make that configurable as well. Any ideas are welcome.

Thanks for the good thinking, guys.