Basically, with bdb, we can’t make a write operation while we are traversing the db with the same db handler. These two operations are performed in different txn contexts and cause a deadlock.
Added coverage by using EraseRecords()
which is the simplest function that executes this process.
To replicate it, need bdb support and drop the first commit. The test will run forever.