From 361e2f04f6176130ad83d5c369501466372c15cd Mon Sep 17 00:00:00 2001 From: Andrea Cavalli Date: Mon, 27 Nov 2023 22:20:39 +0100 Subject: [PATCH] Use rocksdb .keyExists --- .../database/disk/AbstractRocksDBColumn.java | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/src/main/java/it/cavallium/dbengine/database/disk/AbstractRocksDBColumn.java b/src/main/java/it/cavallium/dbengine/database/disk/AbstractRocksDBColumn.java index c667a80..497bdb3 100644 --- a/src/main/java/it/cavallium/dbengine/database/disk/AbstractRocksDBColumn.java +++ b/src/main/java/it/cavallium/dbengine/database/disk/AbstractRocksDBColumn.java @@ -323,29 +323,8 @@ public sealed abstract class AbstractRocksDBColumn implements try { ensureOpen(); ensureOwned(readOptions); - int size = RocksDB.NOT_FOUND; byte[] keyBytes = LLUtils.asArray(key); - Holder data = new Holder<>(); - boolean mayExistHit = false; - if (db.keyMayExist(cfh, readOptions.getUnsafe(), keyBytes, data)) { - mayExistHit = true; - if (data.getValue() != null) { - size = data.getValue().length; - } else { - size = db.get(cfh, readOptions.getUnsafe(), keyBytes, NO_DATA); - } - } - boolean found = size != RocksDB.NOT_FOUND; - if (found) { - readValueFoundWithBloomSimpleBufferSize.record(size); - } else { - if (mayExistHit) { - readValueNotFoundWithMayExistBloomBufferSize.record(0); - } else { - readValueNotFoundWithBloomBufferSize.record(0); - } - } - return found; + return db.keyExists(cfh, readOptions.getUnsafe(), keyBytes); } finally { closeLock.unlockRead(closeReadLock); }