anuengineer commented on a change in pull request #102: HDDS-2380. Use the Table.isExist() API instead of get() API while checking for presence of key. URL: https://github.com/apache/hadoop-ozone/pull/102#discussion_r341243501
########## File path: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/file/OMFileRequest.java ########## @@ -60,15 +60,15 @@ public static OMDirectoryResult verifyFilesInPath( String dbDirKeyName = omMetadataManager.getOzoneDirKey(volumeName, bucketName, pathName); - if (omMetadataManager.getKeyTable().get(dbKeyName) != null) { + if (omMetadataManager.getKeyTable().isExist(dbKeyName)) { Review comment: This patch looks correct, but I have a question about the earlier patch that went in to support this. The documentation of keyMayExist -- says this. _public boolean keyMayExist(ColumnFamilyHandle columnFamilyHandle, byte[] key, java.lang.StringBuilder value) If the key definitely does not exist in the database, then this method returns false, else true. This check is potentially lighter-weight than invoking DB::Get(). One way to make this lighter weight is to avoid doing any IOs. Parameters: columnFamilyHandle - ColumnFamilyHandle instance key - byte array of a key to search for value - StringBuilder instance which is a out parameter if a value is found in block-cache._ There is a value parameter in the call, which is documented as -- out parameter if the value is found in the block cache. The objective of calling into this function, I suppose to leverage that -- Mind you the keyMayExist is not bloom filter lookup, it says If the value is in memory already you get access to it. However, if you read the code -- it looks like we ignore the possiblity of gettting the value back from the block cache. Here is the code that was committed via "HDDS-1691 : RDBTable#isExist should use Rocksdb#keyMayExist" ` // RocksDB#keyMayExist // If the key definitely does not exist in the database, then this // method returns false, else true. return db.keyMayExist(handle, key, new StringBuilder()) && db.get(handle, key) != null;` So how does this call eliminate the IO cost, since the new StringBuilder is completely ignored ? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-dev-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-dev-h...@hadoop.apache.org