How to really delete key in sst

What version of Go are you using (go version)?

$ go version 1.14

What operating system are you using?

centos 7

What version of Badger are you using?

v2.2007.2

Does this issue reproduce with the latest master?

yes

Steps to Reproduce the issue

What Badger options were set?

first
for j := 0; j < 10000; j++ {
txn := lvdb.NewTransactionAt(math.MaxUint64, true)
for i := 0; i < 10000; i++ {
err := txn.Set(byte(“pre_”+strconv.Itoa(i)), byte(“aaaaaaaaaaaaaaa”))
require.Empty(t, err)
}
err = txn.CommitAt(uint64(time.Now().UnixNano()), nil)
require.Empty(t, err)
}
err = lvdb.Close()
require.Empty(t, err)
then delete all
txn := lvdb.NewTransactionAt(math.MaxUint64, false)
opt := badger.DefaultIteratorOptions
opt.PrefetchValues = false
iter := txn.NewIterator(opt)
for iter.Rewind(); iter.Valid(); iter.Next() {
txn := lvdb.NewTransactionAt(math.MaxUint64, true)
key := make(byte, 0)
key = iter.Item().KeyCopy(key)
err := txn.Delete(key)
require.Empty(t, err)
err = txn.CommitAt(uint64(time.Now().UnixNano()), nil)
require.Empty(t, err)
}
err = lvdb.Close()
require.Empty(t, err)

What did you do?

I use iter := txn.NewIterator(opt) to get all keys, but it is very slow.
All the keys has been deleted, but they are still in the sst file.
The delete only mark in the value, when it iterate keys, it will iterate all keys include deleted keys.
Is there a func or config could clear the old version keys.
Or what should I do to avoid these things.

What did you expect to see?

What did you see instead?