isamu / isamu/rocksdb-ruby

db.exists? return always true

Open
#34 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
76
Forks
24
PR merge metrics
No merged PRs in 30d

Description

I found a bug in the gem when trying to check for the existence of a key right after opening the database.
Here are examples of the bug, in the IRB console :

db = RocksDB.open("db/path")

db.exists?("user:adadada") # must return false
> true

db.get("user:adadada")  # must return nil
> nil

db.exists?("user:adadada") # must return false
> false

But if before asking for the existence of the key, we do an each_key or other, db.exists? works well :

db = RocksDB.open("db/path")
db.each_key { |k| puts k }
db.exists?("user:adadada") # must return false
> false

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the behavior in IRB using RocksDB.open, exists?, get, and each_key. Start at the db.exists? entry point and compare its first call after opening with calls after iteration or get. Done means a missing key returns false immediately after opening as well as after other database operations.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.