-
Notifications
You must be signed in to change notification settings - Fork 556
db: make DB.Ingest return bytes ingested into L0 #1600
Description
This is needed for improvements to admission control that will use byte based tokens, that is part of cockroachdb/cockroach#75066 (see the prototype code in https://github.com/cockroachdb/cockroach/blob/ec4149e310f9b383f87cc7ff8776258d72927394/pkg/util/admission/work_queue.go#L911).
This is complicated by #25, since the actual placement into a Version will be asynchronously done. However, it is viable to produce an estimate at the time of Ingest based on the current spans of L0 files and memtables. This may be an over-estimate since (a) a memtable can be split into multiple sstables when flushing, and an ingested sstable may be able to slip through a gap, (b) an overlapping L0 file may get compacted down to Lbase by the time the ingest is applied to produce a new Version. An estimate is acceptable for admission control.