hyperdb.del() should not add null value for already deleted or non-existent keys
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 748
- Forks
- 56
- PR merge metrics
- No merged PRs in 30d
Description
Currently deleting keys adds a null value to the db regardless of if the key exists or not. It would be great to check if the key exists or not before deleting to avoid unnecessary data in the db.
I wrote some tests for this the first and last are currently failing.
tape('does not delete non existent keys', function (t) {
var db = create.one()
db.del('hello', function (err, node) {
t.error(err, 'no error')
t.same(db._writers[0].length(), 0)
t.end()
})
})
tape('does not delete non existent keys', function (t) {
var db = create.one()
db.put('hello', 'world', function (err, node) {
t.error(err, 'no error')
db.del('hello', function (err, node) {
t.error(err, 'no error')
t.same(db._writers[0].length(), 2)
t.end()
})
})
})
tape('does not delete non existent keys', function (t) {
var db = create.one()
db.put('hello', 'world', function (err, node) {
t.error(err, 'no error')
db.del('hello', function (err, node) {
t.error(err, 'no error')
t.same(db._writers[0].length(), 2)
db.del('hello', function (err, node) {
t.error(err, 'no error')
t.same(db._writers[0].length(), 2)
t.end()
})
})
})
})
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at hyperdb.del() and run the three tape tests included in the issue. Check the writer length after deleting a missing key, deleting an existing key, and deleting the same key twice; done means no null value is added for missing or already deleted keys while the expected single deletion remains recorded.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- database, distributed-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100