smengcl commented on code in PR #9813:
URL: https://github.com/apache/ozone/pull/9813#discussion_r3533112410


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBTable.java:
##########
@@ -99,16 +99,16 @@ public boolean isEmpty() throws RocksDatabaseException {
   @Override
   public boolean isExist(byte[] key) throws RocksDatabaseException {
     rdbMetrics.incNumDBKeyMayExistChecks();
-    final Supplier<byte[]> holder = db.keyMayExist(family, key);
-    if (holder == null) {
-      return false;  // definitely not exists
-    }
-    final byte[] value = holder.get();
-    if (value != null) {
-      return true; // definitely exists
+    final Supplier<byte[]> valueSupplier = db.keyMayExist(family, key);
+    if (valueSupplier != null) {
+      final byte[] value = valueSupplier.get();
+      if (value != null) {
+        return true; // definitely exists
+      }
     }
 
-    // inconclusive: the key may or may not exist
+    // keyMayExist can be a false-negative in some RocksDB setups (for example,
+    // snapshot/checkpoint DBs). Verify via point-get to preserve correctness.
     final boolean exists = get(key) != null;

Review Comment:
   Sorry about the confusion. The comment has been reworded:
   
   ```
   // keyMayExist could not return the value; confirm via point-get.
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to