Clarification on deletes and scavenging

Hullo,

Just wanted to clarify, on URL, the following is stated:

A hard delete is permanent and the stream is not removed during a scavenge. If you hard delete a stream, the stream can never be recreated.

I wanted to check that is accurate, and shouldn’t be:

A hard delete is permanent and the stream is NOW removed during a scavenge. If you hard delete a stream, the stream can never be recreated.

Because to me, at first glance, that seems to make more sense (i.e. soft deletes don’t get scavenged so they can come back, hard deletes do so they can’t).

Cheers,

Neil.

Close. Hard deletes get tombstoned and can never come back.

Hi Neil,

That is not a typo, a hard delete event is not scavenged away.

What happens when a stream is hard deleted is a tombstone event is written to that stream.

This event is never scavenged away, effectively locking the stream down as nothing else can be written to it.

A soft delete simply writes metadata for the stream specifying where to truncate the stream from.

This means that writing more events to this stream will continue from where it left off.

I think I see. My confusion was over “stream” vs. “event”. What I currently understand then, is that:

  • Hard deletes delete the stream and leave a “tombstone” with the stream’s ID such that ES knows the ID is “used” and can never come back. Scavenging is therefore irrelevant for hard deletes.
  • Soft deletes somehow mark the stream as deleted (by writing a “deleted” event?), but enough metadata is kept so that you can bring the stream back by writing to the same ID. When scavenging occurs, events prior to the deletion are removed. The only additional thing of note being that if you write more events to the stream the version does not restart from 0 (although you still won’t be able to read the deleted events, scavenged or otherwise).
    That makes sense. I think specifying “stream” or “event” in that note on that part of the docs would help, though.

Thanks for your help, chaps.

Events are also removed for hard deleted streams by scavenge, a tombstone is left.

But the docs say “A hard delete is permanent and the stream is not removed during a scavenge. If you hard delete a stream, the stream can never be recreated.”. This is what I’m saying about confusion. Are you saying that hard and soft deletes are basically the same when the deletion occurs, except scavenging hard deletes leaves only a tombstone, while scavenging soft deletes merely deletes the events so the stream can be resumed?

The wording should be changed to a “tombstone remains”. The rest of the stream is removed.