You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2020/03/10 04:21:27 UTC

[GitHub] [hadoop-ozone] bharatviswa504 commented on issue #654: HDDS-3150. Implement getIfExist in Table and use it in CreateKey/File

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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org