My end goal is to limit the amount of disk space Badger will take up, and I came across the Max table size.
What happens when the Max Table size is exceeded?
What happens if you run out of disk space?
Is there a different way to limit disk space that I maybe didn’t think of?
type Options struct {
// Maximum size of the table.
TableSize uint64
Edit:
Looking at it, I’m seeing now that this isn’t what I thought it was. Is there a way to manage disk size? I do see the estimate for table size that I could potentially use.
Hey @austincollinpena, the Max Table Size is the maximum size of table (sst file) that badger will build. Badger doesn’t look at disk space while inserting the data.
What happens when the Max Table size is exceeded?
The size could go beyond the table size if you have duplicate keys that don’t fit in the max table size. If the size goes beyond math.MaxUint32 (4 GB), badger will crash with size too big error.
What happens if you run out of disk space?
Badger will stop accepting new writes until the existing operations succeed. You’ll see error messages being logged and badger will keep retrying.
That is the estimated size of key+value of all the keys stored in an SST. You could look at it and stop your writes but it’s an estimate so it wouldn’t be correct.