-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Copied from this comment:
Requires investigation to confirm the issues noted below.
purgeruses a go map, which doesn't release backing memory ever - so it'll be as large as the largest set of compaction input files (which might be a lot for a full compaction). Minor issue, but could remedy by allocating a new map whenlen(p.files) == 0.- The purger seems to suffer from a similar issue that @gwossum identified with the retention service. It calls
tsmfile.InUse()and then latertsmfile.Close()without blocking new readers in the inbetween - a time of check, time of use flaw. Thereforetsmfile.Close()which waits on readers to finish (Unref()) has an unbounded runtime. The purger's lock is held over the close() call, which means the lock is held for an unbounded time, which you might say is ok because this happens in the purger's "purge" goroutine, but thepurger.Add(files[])call needs to get that lock too andpurger.Add()is called synchronously inFilestore.replace()which means replace() has an unbounded runtime. All this means, if i'm reading it right, that purging tsm files could freeze up compaction.- One could make it
go f.purger.add(inuse)to decouple the purger and compaction which is nice, but it'd be better to use a sync map and/or reduce the purger lock holding time and/or put tsm file closing into a goroutine and/or callSetNewReadersBlockedbefore the InUse check, like the retention service does.
- One could make it
Reactions are currently unavailable