Scavenging linkTo's which point to (hard) deleted events

Hi there,

we have an event store with lots of streams with lots of events (4.0.3). Some of these events are linked to a single stream like this:

fromAll()

.when({

$any: function(stream, event, metaData) {

linkTo(‘ALL’, event, metaData);

}

});

(please don’t discuss whether this is a good approach or not - I’m about to get this thing out of here…)

I tried to delete links by hard-deleting the origin stream and some of the other events are deleted because of the maxAge-setting in the origin stream.

Unfortunately I can still see them in there (as dead links). Even after a scavenge.

When I start reading the stream from the beginning I have to skip over millions (2 Mio?) of dead links which consumes some time.

I found that one which should be in 4.0.2: https://github.com/EventStore/EventStore/pull/1286 - “Scavenge away LinkTo events that point to events that no longer exist”

Can anyone confirm that this works?

RSp

It should. There are a bunch of caveats around scavenging and when it actually removes data though.

There are times when there are things that are eligible to be removed but removing them would actually result in a larger file as such it won’t be scavenged.

This did not work for me (4.1.0.0).

I was actually only using the $by_event_type stream for a handful of types. I wrote a custom projection, redirected subscriptions, stopped the built-in projections, deleted the streams, and started scavenging. My estimated is that the db will shrink by 95% by the time it’s done.