bharatviswa504 commented on issue #654: HDDS-3150. Implement getIfExist in Table and use it in CreateKey/File URL: https://github.com/apache/hadoop-ozone/pull/654#issuecomment-596895075 > Why do we need a new API for this? Can the caller not just use the isExist API first and then get? Because if we use isExist(), if keyMayExist returns true, then we will do 2 times db.get isExist() ``` boolean keyMayExist = db.keyMayExist(handle, key, outValue); if (keyMayExist) { boolean keyExists = (outValue.length() > 0) || (db.get(handle, key) != null); ``` Now to use in OMKeyCreateRequest ``` if(omMetadataManager.getKeyTable().isExist(dbKeyName)) { dbKeyInfo = omMetadataManager.getKeyTable().getIfExist(dbKeyName); . . ``` So if keyMayExist returns true, then we do 2 times db.get, to avoid that new API is introduced.
---------------------------------------------------------------- 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: ozone-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: ozone-issues-h...@hadoop.apache.org