sst files not being deleted
wellington-felix-movile opened this issue · comments
wellington-felix-movile commented
Hi everyone! First of all thank you for porting leveldb to Java, awesome work!
I was running some tests and ran into what seems to be a bug, although I'm not sure.
Here is the code I'm using (in kotlin):
fun main() {
val db = Iq80DBFactory.factory.open(File("storage-test"), Options())
repeat(100_000) {
db.put(it.toString().toByteArray(), Random.nextBytes(1000))
println("Inserted id=$it")
}
repeat(100_000) {
try {
db.delete(it.toString().toByteArray())
println("Deleted id=$it")
} catch (e: Exception) {
println("[ERROR] error deleting key=$it. ex: $e")
}
}
db.close()
}
Basically I'm just inserting 100K entries with a random byte array payload of size 1KB. Right after the insertion I then delete all entries. What happens is that about 50 .sst
files are created but never deleted from disk. Shouldn't the deleteObsoleteFiles()
method in DBImpl.java
remove these leftover files? Am I missing something here?
Appreciate any help!