rocksdb-ruby icon indicating copy to clipboard operation
rocksdb-ruby copied to clipboard

db.exists? return always true

Open sebthemonster opened this issue 2 years ago • 0 comments

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

sebthemonster avatar Jan 28 '23 10:01 sebthemonster